if this is a bottleneck you can make it faster via tries or suffix trees. a trie is rather easy to implement but limited to queries like a.startswith(b), while suffix trees are appropriate for full text search (pretty sure there's a library for that if you don't mind additional dependencies)
if this is a bottleneck you can make it faster via tries or suffix trees. a trie is rather easy to implement but limited to queries like
a.startswith(b)
, while suffix trees are appropriate for full text search (pretty sure there's a library for that if you don't mind additional dependencies)_Originally posted by @e-dorigatti in https://github.com/Wikidata/soweego/pull/405#discussion_r679783311_