Algorithm to find multiple string matches

前端 未结 6 964
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 17:03

I\'m looking for suggestions for an efficient algorithm for finding all matches in a large body of text. Terms to search for will be contained in a list and can have 1000+ p

6条回答
  •  执念已碎
    2020-11-27 17:46

    Are the search terms words that you are looking for or can it be full sentances too ?

    If it's only words, then i would suggest building a Red-Black Tree from all the words, and then searching for each word in the tree.

    If it could be sentances, then it could get a lot more complex... (?)

提交回复
热议问题