Nlp 字向量在哪里计算?
我处理术语和首字母缩略词,所以我将术语的单词向量与其首字母缩略词的向量相等。例如,MPH的矢量将与英里/小时相同。但是,我在管道中作为自定义组件执行此步骤,特别是在标记器之前。我看不到首字母缩略词的指定向量有任何变化。我是不是遗漏了什么Nlp 字向量在哪里计算?,nlp,spacy,Nlp,Spacy,我处理术语和首字母缩略词,所以我将术语的单词向量与其首字母缩略词的向量相等。例如,MPH的矢量将与英里/小时相同。但是,我在管道中作为自定义组件执行此步骤,特别是在标记器之前。我看不到首字母缩略词的指定向量有任何变化。我是不是遗漏了什么 matches = self.matcher(doc) for match_id, start, end in matches: span = doc[start:end] print("matched_span: ",
matches = self.matcher(doc)
for match_id, start, end in matches:
span = doc[start:end]
print("matched_span: ", span.text)
#Get string representation
term = self.abbr_term_dict[span.text]
term_doc = nlp(term)
# nlp.vocab.set_vector("MPH", nlp('Miles Per hour').vector)
# setting the vecor for acronym
nlp.vocab.set_vector(span.text, term_doc.vector)