2
$\begingroup$

I am using hyperscan to search through large texts for a lot of regexes. One addition should be selective phonetic search for individual words. The algorithm of choice is Double Metaphone (but please feel free to recommend any other algorithm that might be more suitable to the problem and offers at least the same quality).

To search for phonetic matches I would have to translate every single word in my large text to its phonetic code and then compare them with the phonetic code of the word to search for. This is impractical for large texts. Also, to work together with hyperscan, I have to provide the search term as regex.

So my question is if it is possible to translate the phonetic code into a regex and pass it on, so that my text can remain unmodified while being searched?

$\endgroup$
  • $\begingroup$ This is really hard to answer unless you describe the Double Metaphone algorithm. $\endgroup$ – Yuval Filmus May 1 at 14:35
  • $\begingroup$ Your issue seems like a software problem. The software doesn't support Double Metaphone, and you are trying to find a workaround. I suggest replacing your piece of software. $\endgroup$ – Yuval Filmus May 1 at 14:37
  • $\begingroup$ See here: arstechnica.com/civis/viewtopic.php?f=20&t=107192. $\endgroup$ – Yuval Filmus May 1 at 14:39
  • $\begingroup$ If you have a dictionary, you can apply Double Metaphone for every word in your dictionary, and then given the Double Metaphone key, your regex is just the union of all words mapping into that key. $\endgroup$ – Yuval Filmus May 1 at 14:39
  • $\begingroup$ @YuvalFilmus Generating a list of "false" words is too impractical. Thank you for the link. It looks like I'm not the only one with this problem and all existing solutions transform the text to search in. That is not the answer I was hoping for, but seems to be the only way for existing phonetic search algorithms. $\endgroup$ – a.ilchinger May 3 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.