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
TypeError: condition.regex.exec is not a function #463
Comments
im having this problem too, any solution? |
I found a fix for this problem. Basically, it looks like the trim feature generates a regex pattern, to get the text between the two words, but this is regex isn't passed for some reason, but there's a small workaround. Just to quickly explain what this trim feature does: This is the code that does this but doesn't work because
If right on top of the Another problem is that even when this is fixed, the result will not show up, because the
Hope this helps 🤝 |
SHould be fixed already in current v4 versions, right? |
seems like the bug still exists |
Then please post a complete stack trace with the current v4 release version |
Describe the bug
The addBetweenCondition method once saved to a model.nlp will make the model unusable.
Next usage will throw an exception:
TypeError: condition.regex.exec is not a function
at ExtractorTrim.matchBetween (C:\pvd\crmAI\node_modules@nlpjs\ner\src\extractor-trim.js:58:37)
at ExtractorTrim.extractFromRule (C:\pvd\crmAI\node_modules@nlpjs\ner\src\extractor-trim.js:281:28)
at ExtractorTrim.extract (C:\pvd\crmAI\node_modules@nlpjs\ner\src\extractor-trim.js:294:29)
at ExtractorTrim.run (C:\pvd\crmAI\node_modules@nlpjs\ner\src\extractor-trim.js:311:22)
at DefaultCompiler.executeReference (C:\pvd\crmAI\node_modules@nlpjs\core\src\default-compiler.js:154:37)
at DefaultCompiler.executeAction (C:\pvd\crmAI\node_modules@nlpjs\core\src\default-compiler.js:282:21)
at DefaultCompiler.execute (C:\pvd\crmAI\node_modules@nlpjs\core\src\default-compiler.js:310:26)
at async Ner.process (C:\pvd\crmAI\node_modules@nlpjs\ner\src\ner.js:329:20)
at async Ner.generateEntityUtterance (C:\pvd\crmAI\node_modules@nlpjs\ner\src\ner.js:405:13)
at async Nlp.process (C:\pvd\crmAI\node_modules@nlpjs\nlp\src\nlp.js:451:31)
To Reproduce
Steps to reproduce the behavior:
Add this code block to sample
manager.addBetweenCondition("it", "username", "fatto", "il");
manager.train()
manager.save()
or
add this json part to jour current model.nlp:
"username":{"name":"username","type":"trim","rules":[{"type":"between","leftWords":["fatto"],"rightWords":["il"],"regex":"//gi","options":{}}]}
Each time you load this model with manager.load() and run manager.process("it", "Anything")the procedure will crash.
Expected behavior
Should work as expected
Screenshots
N/A
Desktop (please complete the following information):
Additional context
NA
The text was updated successfully, but these errors were encountered: