Python 3.x 空间问题与';Vocab&x27;或';StringStore&x27;

Python 3.x 空间问题与';Vocab&x27;或';StringStore&x27;,python-3.x,spacy,rasa-nlu,rasa,Python 3.x,Spacy,Rasa Nlu,Rasa,我正在为管道使用spaCy对Rasa NLU进行培训,但当我尝试对其进行培训时,spaCy出现以下错误: KeyError: "[E018] Can't retrieve string for hash '18446744072967274715'. This usually refers to an issue with the `Vocab` or `StringStore`." 我有python 3.7.3,spaCy版本是2.2.3,rasa版本是1.6.1 有人知道如何解决这个问题吗

我正在为管道使用spaCy对Rasa NLU进行培训,但当我尝试对其进行培训时,spaCy出现以下错误:

KeyError: "[E018] Can't retrieve string for hash '18446744072967274715'. This usually refers to an issue with the `Vocab` or `StringStore`."
我有python 3.7.3,spaCy版本是2.2.3,rasa版本是1.6.1


有人知道如何解决这个问题吗?

这听起来像是一个命名错误,我猜你在另一个文本上应用了匹配器,匹配器id变得不同,因此它变得混乱。 要解决此问题,请确保对同一文本使用相同的匹配器,如下所示:

执行标准导入、重置nlp、短语匹配器库 首先,创建匹配短语的列表: 接下来,将每个短语转换为文档对象: 将每个文档对象传递到matcher(注意星号的使用!): 生成匹配项列表: 查看匹配项:
有关此问题,请参阅此GitHub超级线程:。
import spacy
nlp = spacy.load('en_core_web_sm')
from spacy.matcher import PhraseMatcher
matcher = PhraseMatcher(nlp.vocab)
dd = 'refers to the economic policies  associated with supply-side economics, voodoo economics'
doc3 = nlp(dd) # convert string to spacy.tokens.doc.Doc
phrase_list = ['voodoo economics', 'supply-side economics', 'free-market economics']
phrase_patterns = [nlp(text) for text in phrase_list]
matcher.add('VoodooEconomics', None, *phrase_patterns)
matches = matcher(doc3)
matches #(match_id, start, end)
for match_id, start, end in matches: # the matcher have to be the same one that we build on this text
     string_id = nlp.vocab.strings[match_id] 
     span = doc3[start:end]                   
     print(match_id, string_id, start, end, span.text)