convert list of strings to set of regexes; convert list of strings to trie
della at toglimi.linux.it
Tue Jul 20 11:45:08 EDT 2004
Klaus Neuner wrote:
> 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)"]
So, I guess you just want to isolate common prefixes.
> 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.
can be of some use for you, even if I didn't have a look at it.
More information about the Python-list