AutoVoice AutoVoice Regex word boundry not working

Discussion in 'AutoApps' started by easiuser, Nov 4, 2015.

  1. easiuser

    easiuser Member

    Joined:
    Mar 7, 2015
    Messages:
    50
    Likes Received:
    4
    I am trying to capture a yes or no response from a query and having trouble isolating words.

    For a negative response, my filter is "/b(no|negative|nope|forget it)\b"
    Using a test command of "I did not understand" the profile will fire with:
    avcomms() = no
    avcommsnofilter() = I did t understand

    The \b should require a word boundry before and after "no"

    I expected the profile not to fire. Any suggestion on isolating a single word or phrase from the recongized string?
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Maybe this helps?
     
  3. easiuser

    easiuser Member

    Joined:
    Mar 7, 2015
    Messages:
    50
    Likes Received:
    4
    I am not sure you understood what I was trying to do. I want to be able to accept a wide variety of words/phrases that indicate a specific response catagorized as no, yes, reply, retry, save and send.

    For example, if I have Tasker say "Would you like to reply to this message?", I would like the following phrases to be interpreted as no:
    no
    negative
    nope
    forget it

    But if I respond by saying "Acknowledged" or "Reply now", I don't want the "no" in "Acknowledged" or "now" to be interpreted as no.

    All I want to do is isolate the words or phrases from whatever surrounds it. Regex should be able to do this with the word boundry switch \b.

    The video appears to show the opposite. Isolating a variable when you know what surrounds it.
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    oh, I see :) Thanks for the explanation. Here, try this:

    Code (Text):
    ^(no|negative|nope|forget it)$
    The ^ and $ signs say that the expression must start and end right after the desired expressions :)

    Hope this helps
     
  5. easiuser

    easiuser Member

    Joined:
    Mar 7, 2015
    Messages:
    50
    Likes Received:
    4
    Unfortunately that forces it to be that word or phrase and only that word or phrase. I wanted to ignore all the extra words.

    Fortunately autovoice does recognize the white space expression, \s and I combined it with your suggestion.

    (\s|^)(no|negative|nope|forget it)(\s|$)

    Thanks for the tip.
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    great :) in your initial regex you had "/b" instead of "\b". maybe that's what was wrong initially?
     
  7. easiuser

    easiuser Member

    Joined:
    Mar 7, 2015
    Messages:
    50
    Likes Received:
    4
    Your right. That was it. Must have been staring at it too long . My apologies.
     
: autovoice, regex

Share This Page