我正在使用SpaCy来查找文本中的模式。对于一些模式,如单个单词,这是直截了当的,我对结果感到满意。对于日期的模式,事情要复杂一些。我使用SpaCy允许搜索作为正则表达式的模式。SpaCy提供的解决方案是“在doc.text上与re.finditer匹配”:
for match in re.finditer("1 January 2022",
在Spacy模式匹配中,如何编写可由以下模式触发的单个模式匹配规则: "red", apple" # ie, the rule must trigger when the input sentencefan"] # ie, the rule must trigger when the input sentence contains a token "light" 在上面的代码中,每个部分都没有相同数量<em