-
Notifications
You must be signed in to change notification settings - Fork 655
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
.not()
is destructive to punctuation
#1065
Comments
I noticed this happens too. // Works as expected
> nlp('this is (kinda) messy').not('messy').parentheses().out('array')
[ '(kinda)' ]
// No results for parentheses()
> nlp('this is (kinda) messy').not('this').parentheses().out('array')
[]
// Multiple terms in parentheses are lost
> nlp('this is (kinda really) messy').not('this').parentheses().out('array')
[ '(kinda' ] |
hey, yep that's right - compromise is tokenizing punctuation into There's also the guesswork in That being said, this does appear to be a bug: nlp('this is (kinda) messy').not('this').parentheses() I'll take a look at all of these, if I can, today. |
hey @Fdawgs - you may want to try const text3 = 'The leftorium sells left-handed products, the owner is Ned Flanders!'
const result3 = nlp(text3).remove('Ned Flanders').text()
console.log(result3)
//The leftorium sells left-handed products, the owner is! Please let me know if you spot @track0x1 fix is on dev, will be part of next release, likely this week. |
fixed in nlp('this is (kinda) messy').not('this').parentheses() //'(kinda)' cheers |
Node version: 20.10.0
Compromise version: 14.10.1
As title states, punctuation is removed if it is next to what is being removed by
.not()
.In the examples below, you can see the brackets have been removed in the first two, and the exclamation mark with the last.
Reproduction:
Potentially related to #1022.
The text was updated successfully, but these errors were encountered: