Timeline for Using RegEx for phrase pattern in EntityRuler
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 27, 2019 at 8:49 | comment | added | Wiktor Stribiżew |
@Nemo You do not need any computer science degree. The basic things to learn here are: 1) strings and their representation in Python code, 2) basic regex constructs. Play with the patterns at regex101.com, follow the [python] [regex] tags at SO for a month or two, try answering good on-topic questions and you will learn a lot in no time.
|
|
Aug 27, 2019 at 8:46 | comment | added | Nemo |
Thanks for your suggestions, Wiktor. I wished I have computer science background like you so that I can understand Python re doc!
|
|
Aug 27, 2019 at 8:43 | comment | added | Wiktor Stribiżew |
@Nemo My usual advice is: I can suggest doing all lessons at regexone.com for beginners, reading through regular-expressions.info, regex SO tag description (with many other links to great online resources), and the community SO post called What does the regex mean. rexegg.com is worth having a look at. You should also check Python re docs.
|
|
Aug 27, 2019 at 8:40 | comment | added | Nemo | Thanks, Wiktor. I always find RegEx so confusing. Given your obvious knowledge on the topic, could you please recommend a book/resource that would help me up to speed? | |
Aug 27, 2019 at 8:30 | comment | added | Wiktor Stribiżew |
@Nemo [{"TEXT" : {"REGEX": r"\b[Aa]pples?\b"}}] will NOT match stapples due to word boundaries. Please pay special attention to r prefix that allows using a single backslash to define regex escapes like \b .
|
|
Aug 27, 2019 at 8:29 | vote | accept | Nemo | ||
Aug 27, 2019 at 8:29 | comment | added | Nemo |
Thanks, Wiktor. As always, your explanation is comprehensive, providing additional resources for reference. According to your 3 scenarios, there're no regex expression that will match only Apple, apple, Apples, apples, APPLES, aPPleS but WILL ignore stapples (since it's not strictly a fruit of family Rosaceae)?
|
|
Aug 27, 2019 at 7:49 | history | answered | Wiktor Stribiżew | CC BY-SA 4.0 |