Home   Archive   Permalink

Parsing to find a multi-word phrase

Parsing makes my head hurt. Someone on the REBOL facebook page asked about finding a multi-word phrase in some text. I thought about that, looked again at the parsing documentation, found that I could not understand how to do it, and tried to formulate a question in the sample below. The problem seems to be finding a phrase of words when that string of characters is part of something bigger that is actually NOT that phrase.
Thank you.
R E B O L [
     Title: "Demo to find if a word exists in some text"
TEXT-1: {
The village left armed men with firearms from the army
to defend the farm during warm weather.}
TEXT-2: {You left army life because you broke your left arm?}
     "Return true if PHRASE is in TEXT, otherwise return false"
] [
FIND-PHRASE TEXT-1 "arm"     ;; false
FIND-PHRASE TEXT-1 "left arm" ;; false
FIND-PHRASE TEXT-2 "arm"     ;; true
FIND-PHRASE TEXT-2 "left arm" ;; true

posted by:   Steven White       26-Apr-2019/12:54:02-7:00

Would need to check, but this seems similar to an earlier question (I took the liberty of moving my original response to a Gist):

posted by:   Chris       26-Apr-2019/16:05:38-7:00

OK, that's funny (as in ha ha). It looks like your response mentioned above was a response to a question I asked. We have come in a circle. I will read it again.
I seem to be experiencing a steepening "forgetting curve" where things that are not reinforced often enough are forgotten. Time to retire perhaps. But some good has come of it. I never have heard of "gist" until just now.

posted by:   Steven White       26-Apr-2019/16:20:34-7:00



Type the reverse of this captcha text: "r e f f u B n i"