gsi-upm / sematch

semantic similarity framework for knowledge graph
http://gsi-upm.github.io/sematch/
Other
429 stars 109 forks source link

I need some help ,thks #13

Closed Alex804916936 closed 3 years ago

Alex804916936 commented 7 years ago

when I computed the word similarity, I used the test code in introduction. as follows

from sematch.semantic.similarity import WordNetSimilarity wns = WordNetSimilarity()

Computing English word similarity using Li method

wns.word_similarity('dog', 'cat', 'li') # 0.449327301063

Computing Spanish word similarity using Lin method

wns.monol_word_similarity('perro', 'gato', 'spa', 'lin') #0.876800984373

Computing Chinese word similarity using Wu & Palmer method

wns.monol_word_similarity('狗', '猫', 'cmn', 'wup') # 0.857142857143

Computing Spanish and English word similarity using Resnik method

wns.crossl_word_similarity('perro', 'cat', 'spa', 'eng', 'res') #7.91166650904

Computing Spanish and Chinese word similarity using Jiang & Conrad method

wns.crossl_word_similarity('perro', '猫', 'spa', 'cmn', 'jcn') #0.31023804699

Computing Chinese and English word similarity using WPath method

wns.crossl_word_similarity('狗', 'cat', 'cmn', 'eng', 'wpath')#0.593666388463

but I cant get the result . as follows:

E:\Anaconda3\envs\Python27\python.exe E:/Python_Workspace/Python_Sematch_Workspace/Sematch_Test.py [nltk_data] Downloading package wordnet_ic to E:\nltk_data... [nltk_data] Package wordnet_ic is already up-to-date! 0.449327301063 Traceback (most recent call last): File "E:/Python_Workspace/Python_Sematch_Workspace/Sematch_Test.py", line 10, in wns.monol_word_similarity('perro', 'gato', 'spa', 'lin') #0.876800984373 File "E:\Anaconda3\envs\Python27\lib\site-packages\sematch-1.0.4-py2.7.egg\sematch\utility.py", line 79, in call value = self.func(*args) File "E:\Anaconda3\envs\Python27\lib\site-packages\sematch-1.0.4-py2.7.egg\sematch\semantic\similarity.py", line 363, in monol_word_similarity s1 = self.multilingual2synset(w1, lang) File "E:\Anaconda3\envs\Python27\lib\site-packages\sematch-1.0.4-py2.7.egg\sematch\semantic\similarity.py", line 293, in multilingual2synset return wn.synsets(word.decode('utf-8'), lang=lang, pos=wn.NOUN) File "E:\Anaconda3\envs\Python27\lib\site-packages\nltk-3.2.5-py2.7.egg\nltk\corpus\reader\wordnet.py", line 1502, in synsets self._load_lang_data(lang) File "E:\Anaconda3\envs\Python27\lib\site-packages\nltk-3.2.5-py2.7.egg\nltk\corpus\reader\wordnet.py", line 1136, in _load_lang_data if lang not in self.langs(): File "E:\Anaconda3\envs\Python27\lib\site-packages\nltk-3.2.5-py2.7.egg\nltk\corpus\reader\wordnet.py", line 1147, in langs fileids = self._omw_reader.fileids() File "E:\Anaconda3\envs\Python27\lib\site-packages\nltk-3.2.5-py2.7.egg\nltk\corpus\util.py", line 116, in getattr self.load() File "E:\Anaconda3\envs\Python27\lib\site-packages\nltk-3.2.5-py2.7.egg\nltk\corpus\util.py", line 81, in load except LookupError: raise e LookupError:


Resource omw not found. Please use the NLTK Downloader to obtain the resource:

import nltk nltk.download('omw')

Searched in:

could you tell me how to resolve this problem , i have already download the dataset, thanks .

balkian commented 3 years ago

I'm closing this issue. Feel free to reopen it if the issue persists.