-
Notifications
You must be signed in to change notification settings - Fork 624
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
Update extractor-trim.js #1278
Update extractor-trim.js #1278
Conversation
fix for error: exec is not a function
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.
Beside the minimal code reveiw stuff I would more ask if not the place where we ADD the condition is the best place to do this conversion once instead of here maaaany times because it is done on every match try ....
Co-authored-by: Ingo Fischer <github@fischer-ka.de>
Co-authored-by: Ingo Fischer <github@fischer-ka.de>
Kudos, SonarCloud Quality Gate passed!
|
I am aware of that fact. However I'm not sure of the source where the |
The code how to add a regex rule is here nlp.js/packages/ner/src/ner.js Lines 239 to 247 in 032d409
Adding a Between condition is done in nlp.js/packages/ner/src/ner.js Line 269 in 032d409
and basically in the end addRukeis used to add new rules If your case is more the "restore from json" then nlp.js/packages/ner/src/ner.js Line 511 in 032d409
|
Hi @DK013 @Apollon77 this might be fixed by #1314 |
As @Apollon77 suggested, closed in favor of #1314 |
fix for error: exec is not a function
Pull Request
PR Checklist
npm test
locally and all tests are passing.PR Description
#463
In production if someone tries to load model nlp/json file instead of trainning from corpus, the match between function in extractor-trim.js under @nlpjs/ner package throws error:
TypeError: condition.regex.exec is not a function
The reason of this error is when saved in a json file the generated regex is saved as a string instead of regex data type.
FIX:
condition.regex
is a stringRegExp
function so it doesn't escape characters unneccesserilycondition.regex
to regexcondition.regex
is already regex, the program executes as it should normally