Open guangyuli-uoe opened 1 year ago
Hi guangyuli-uoe, Looks like spacy changed how they do pipeline creation. The example code is actually in the wmd repo (https://github.com/src-d/wmd-relax), and it's been updated there:
nlp = spacy.load('en_core_web_md') nlp.add_pipe(wmd.WMD.SpacySimilarityHook(nlp), last=True) doc1 = nlp("Politician speaks to the media in Illinois.") doc2 = nlp("The president greets the press in Chicago.") print(doc1.similarity(doc2))
Hope that works for you!
hi,
when i tried to run the following script:
import spacy import wmd
nlp = spacy.load('en', create_pipeline=wmd.WMD.create_spacy_pipeline) doc1 = nlp("Politician speaks to the media in Illinois.") doc2 = nlp("The president greets the press in Chicago.") print(doc1.similarity(doc2))
an error occurs: Traceback (most recent call last): File "home/sms/1.py", line 20, in
nlp = spacy.load('en', create_pipeline=wmd.WMD.create_spacy_pipeline)
TypeError: load() got an unexpected keyword argument 'create_pipeline'