Find occurrences of huge list of phrases in text

后端 未结 8 2021
傲寒
傲寒 2021-02-08 05:02

I\'m building a backend and trying to crunch the following problem.

  • The clients submit text to the backend (around 2000 characters on average)
8条回答
  •  别跟我提以往
    2021-02-08 05:51

    You should try a string search / pattern matching algorithm. Most famous algorithm for you task is the Aho-Corasick there is a python library for it (of the top of google search)

    Most of the pattern matching / string search algorithms will require you to convert your "bag of words/phrases" into a trie.

提交回复
热议问题