convert list of strings to set of regexes; convert list of strings to trie

Klaus Neuner klaus_neuner82 at yahoo.de
Mon Jul 19 09:47:03 EDT 2004


Hello,

I need a function that converts a list into a set of regexes. Like so:

  string_list = ["blaa", "blab", "raaa", "rabb"]

  print string_list2regexes(string_list)


This should return something like:

  ["bla(a|b)", "ra(aa|bb)"]

I am aware of the fact that converting the list to a *trie* would almost do
the job. But I couldn't find anything about Python modules that produce tries.

Are there any modules that I could use? Or do I have to implement it myself?

Klaus



More information about the Python-list mailing list