AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Match priority
 
 

Little confused about match priority with *


The pattern ( * _[my i] _*)

and the input “I have my heart set on her”

matches _0 _1 “my heart set on her” not as “I have my heart set on her”. Is there any way I can get a pattern to not use * if the next element after * works.
The only way I can currently think is to check for some words in in * by using burst and findtext.
Is there some builtin way to change match priority of *?

The reason is because I want to capture the text following the second I of strings like “I am happy because it feels like I have my heart set on her” and current patterns like

(I _* _~emotions * [since because as when* time so ] * _[ my a the I] _* )

do not work properly.

 

 
  [ # 1 ]

I’m not sure what you mean with “matches _0 _1 “my heart set on her” not as “I have my heart set on her”. “.  The value of ‘_0 from your pattern and input is “my” and the value of ‘_1 is “heart set on her”, which is exactly what you requested in your pattern. 

There is no way to not use the * you gave. And in that particular pattern it is of no value and is equivalent to
( _[my I] _*)  which in turn is equivalent to
( _I _*) because “my” has as its canonical form “I”

Not sure why you use * on when*, but if I ignore that for a moment, then
(I _* _~emotions * [since because as when time so ] * _[ my a the I] _* ) works just perfectly to retrieve the bits specified.  One could simplify this to (I _* _~emotions * [since because as when time so ] * _[ a I] _* )

 

 
  [ # 2 ]

I am requesting a single pattern that for the following inputs will match the following text:

I am happy because I have my heart set on her
I have my heart set on her

I am happy because for sure I have my heart set on her
I have my heart set on her

I am happy because I feel like I have my heart set on her
I feel like I have my heart set on her

I am sad because my girl might leave me
my girl might leave me

Currently the pattern I posted matches “my heart set on her” on _2 _3 which is not what I want. It is matching the LAST occurrence of [my I] in the string but I want the FIRST whether there is text in * or not between because and I. I understand if such a single pattern is not possible. I tried placing the * between {} but got an error.

* on when was to catch whenever too but I guess canonical take care of that.

 

 
  [ # 3 ]

u: ( because {"for sure"} _*)  is a pattern that matches your input requests… 


Of course you might prefer a more general one
concept: ~nounmarker (~pronoun ~noun ~determiner ~adjective)
u: ( because * _~nounmarker _*)

 

 
  [ # 4 ]

Thanks Bruce. I don’t want ~nounmarker to match ~pronouns or ~determiners so I guess I could create a concept for that.

 

 
  [ # 5 ]

But if it doesnt match pronouns, it wouldnt match
because I like jam or because my dog eats fish or any of the similar ones of yours

 

 
  login or register to react