You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When we process a regex with a group that result of group is undefined, the library return this error: "ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'length')"
The problem occurs on the path "node_modules/@nlpjs/ner/src/extractor-regex.js".
I added some consoles on the file and the problem is on "else", specifically at "match[1].length". When process, the first position is the match and has value, the second position is the group, but, sometimes, the group can be undefined, as soon as I describe below.
Add a new regex below and train.
Exemple: /^[a-zA-ZÀ-ÿ]+ [a-zA-ZÀ-ÿ]+([ ]+[a-zA-ZÀ-ÿ]+)*$/gm
Process a new message per exemple: test test
The error in terminal will be:
"ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'length')..."
Expected behavior
Process without error. I believe that a simple and working solution is to clear null properties before performing validations on the array.
Desktop (please complete the following information):
OS: macOS
node-nlp: ^4.26.1
Node version: v20.3.0
The text was updated successfully, but these errors were encountered:
Describe the bug
When we process a regex with a group that result of group is undefined, the library return this error: "ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'length')"
The problem occurs on the path "node_modules/@nlpjs/ner/src/extractor-regex.js".
I added some consoles on the file and the problem is on "else", specifically at "match[1].length". When process, the first position is the match and has value, the second position is the group, but, sometimes, the group can be undefined, as soon as I describe below.
To Reproduce
Steps to reproduce the behavior:
Add a new regex below and train.
Exemple: /^[a-zA-ZÀ-ÿ]+ [a-zA-ZÀ-ÿ]+([ ]+[a-zA-ZÀ-ÿ]+)*$/gm
Process a new message per exemple: test test
The error in terminal will be:
"ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'length')..."
Expected behavior
Process without error. I believe that a simple and working solution is to clear null properties before performing validations on the array.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: