Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Basic text mining using RegEx - match a phrase that starts and ends with specific words

chickenlicken
8 - Asteroid

I'm trying to categorise phrases into BEFORE or AFTER lunch or another meal.

 

"Following lunch with a friend" - AFTER

"Before breakfast with a colleague" - BEFORE

"After I ate a meal." - AFTER

"In the morning" - BEFORE (basically because there is nothing here to indicate AFTER)

"Later than breakfast and lunch" - AFTER (and ideally I'd also be able to show that this is after 2 meals, not just 1.

 

I was trying to do something like use RegEx to match this phrase pattern, but it's not working

 

((FOLLOWING|AFTER)\s+\w+\s+(LUNCH|DINNER|SUPPER))

 

This is just the start of the type of analysis I'd like to do in Alteryx and I'm also wondering if now is the time to start learning NLTK in python and using it in Alteryx, but I don't have a lot of time to invest in it...

 

Any ideas? 

2 REPLIES 2
PhilipMannering
16 - Nebula
16 - Nebula

Hi @chickenlicken 

 

I think this might be quite difficult with just regex, but at least I can start you off with an expression that's (semi-)working.

 

PhilipMannering_0-1649332943001.png

 

chickenlicken
8 - Asteroid

@PhilipMannering Thanks!  Useful to see that simpler Regex👍

Labels