spencermountain / compromise

modest natural-language processing
http://compromise.cool
MIT License
11.41k stars 654 forks source link

"wanna" is not parsed correctly when followed by a noun #1126

Open roschler opened 1 month ago

roschler commented 1 month ago

In a sentence like:

I wanna pickle

The library adds an extra implicit term to the terms object array for the word "to". This is incorrect in the above sentence because pickle is a noun and the library does tag it correctly as such, so it's not a case of the library thinking "pickle" is a verb as in "I want to pickle some beets". Instead, the library should add a determiner instead with the implicit text being "a". It looks like the library is not inspecting the tags of the term that triggers the creation of the pure implicit term, to see if it is a noun instead of a verb. Note, it probably should choose "a" instead of "to" if the word after "wanna" is an adjective too (e.g. - "I wanna green pickle"), but I have not thought about this exhaustively enough to make a blanket recommendation. In fact, it may be prudent to add a rule that says if the very next word after "wanna" is anything but a verb, choose "a" instead of "to".

spencermountain commented 1 month ago

hey Robert, yeah you're right. I can add it to the next release. cheers