-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contentful/lazy language engines #1160
Conversation
8a98d6c
to
46fa59b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing refactor @dpinol 💯 💯 👏!!
[locales.CROATIAN]: () => new TokenizerHr(), | ||
[locales.SLOVAK]: () => new TokenizerSk(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why TokenizerHr
and TokenizerSk
are always imported? Shouldn't they be lazy loaded too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't do it because require() failed initially, but I found out that it works it you specify the extension
hr: () => new StemmerHr(), | ||
sk: () => new StemmerSk(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why StemmerHr
and StemmerSk
are always imported? Shouldn't they be lazy loaded too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, done
sk: new StemmerSk(), | ||
} | ||
const stemmers = new SingletonMap<Stemmer>({ | ||
ca: () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to use the constants for the keys (locales.CATALAN
instead of ca
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
46fa59b
to
977f052
Compare
for performance reasons, and also to avoid failures in case an unused language tokenizer/stemmer cannot be loaded (eg. due to bug in browser)
languageFromLocale does the same
for performance reasons, and also to avoid failures in case an unused language tokenizer/stemmer cannot be loaded (eg. due to bug in browser)
977f052
to
71951aa
Compare
Depends on #1118
Description
Only import nlp-js stemmers and tokenizers when using them.
removed rootLocale, as it did the same as languageFromLocale
Context
Approach taken / Explain the design
Testing
The pull request has unit tests