Skip to content

Stemming with English preset #535

@amber-huo

Description

@amber-huo

Hi,

I'm using the English preset from flexsearch/lang/en in my Encoder. I noticed that by itself, it will over-stem, for example, cut the '-ing' off of words like 'king', in which '-ing' is not actually a suffix. I don't know a lot about customizing the Encoder, but I still want to have stemming for appropriate words, so I was hoping for a built-in way to do this, while being able to identify words like 'king'.

Here is my current setup with the English preset:

const encoder = new Encoder(
  Charset.Default,
  EnglishPreset,   // import EnglishPreset from 'flexsearch/lang/en';
);

const index = new Document({
  document: {
    store: true,
    index: [{
      field: 'text', 
      tokenize: 'forward',
      encoder: encoder,
    }],
  },
});

Would this be possible? Or can you recommend some way to extend the English preset with custom options to make it intelligent to words where word endings are just arbitrary substrings?

I would be happy to provide more information about anything if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions