Homophones must be a lower priority than other plugin's command

A weird behavior happens when homophones are setup in Google plugin "search" -> "google" and having a command with match: "search *" in Netflix plugin. When issuing command “search something” It seems Lipsurf decides to choose google over Netflix, probably caused by plugin load orders.

To fix this issue, exact matches must be prioritized higher than homophone matches.

1 Like

Nice catch. The expected behavior is that homophones replace parts of the transcript iteratively while no command matches the working transcript. So it shouldn’t use a homophone if there is a command with “search *” that is matching. I’ll look into why it’s apparently not working that way.

This is a rough guess and an assumption to how it’s done under the hood. Feel free to ignore

A rough guess but the command processing sequence might look like this right now

onVoice(voice):
  for each plugins
    for each command in plugin
      return match (voice + command) || match (voice + command + homophones)

Changing the sequence to iterate the commands first before the command+homophone might do the trick.

onVoice(voice):
  let commandPluginPairs = []
  for each plugin
    for each command
      commandPluginPairs.push([plugin, command])
  let matchExact = {
    foreach commandPluginPairs as [plugin, command]
      returnIfTrue match command
  }
  let matchHomonyms = {
    for each commandPluginPairs -> [plugin, command]
      returnIfTrue match command + homophone
  }
    

I think this was happening because of the context order. In your case it must’ve been [‘Normal’, …other contexts] and the Normal commands would hence take priority. Can you try it with explicit context ordering?