0
匹配我的術語列表如下:術語在文本
a
abc
a abc
a a abc
abc
我想匹配的文本的條款,或者變更爲「字詞1,詞條2」的名字。但我想找到最長的匹配作爲正確的匹配。
Text: I have a and abc maybe abc again and also a a abc.
Output: I have term1 and term2 maybe term2 again and also a term3.
到目前爲止,我用下面的代碼,但它並沒有找到最長的匹配:
for x in terms:
if x in text:
do blabla