Apostrophe in custom word prevents matching
See original GitHub issueI’m developing a custom lexicon of plant names, which include “Queen Anne’s lace” and “baby’s breath”, however when a word in my custom lexicon includes an apostrophe, it doesn’t seem to match. Is there something I need to do to force it to use the custom lexicon?
Additionally, I was looking through compromise’s default lexicon and it seems like words in there with apostrophes aren’t matching, either:
nlp("Starbucks is a great restaurant.").match("#Organization").out("array")
// ✅
nlp("Applebee's is a great restaurant.").match("#Organization").out("array")
// ❌
https://github.com/spencermountain/compromise/blob/52fb03e7a26e8caed08bf04d893b0044aab4c538/data/lexicon/nouns/organizations.js#L275
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
regex - How can I allow or ignore apostrophes? - Stack Overflow
I need an expression that will allow (or ignore) the apostrophe so that all words that end in "ria" are matched independent of...
Read more >How to stop getting e accent when I hit apostrophe - Super User
I hit something that now makes accented vowels come up whenever I hit the apostrophe key. I don't know how to fix it....
Read more >How to get MS Word to stop marking contractions without an ...
I think I can partially do this by deleting every autocorrect entry dealing with apostrophes, but I'm wondering if there is an option...
Read more >Is it possible to search for words with an apostrophe, like ...
After the latest search changes, we'll search any term in quotes as an exact match, including symbols such as apostrophes.
Read more >Regex Boundaries and Delimiters—Standard and Advanced
Word boundaries are useful when you want to match a sequence of letters (or digits) on their own, or to ensure that they...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hey @msjonker this is tagging now in 14.4.0 it just throws-away the apostrophe, when creating the lexicon. if you want to ensure it’s a Possessive, you can do something like:
cheers
Sorry, for the late reply; I was on vacation last week.
This solution looks great! I was working on a PR that evaluated matching the
normal
form of the term first, then falling back to themachine
form of the term, but this seems like a much better solution.Thanks!