gsi-upm / sematch

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

ModuleNotFoundError: No module named 'sematch.semantic'; 'sematch' is not a package #30

Closed LostInDarkMath closed 4 years ago

LostInDarkMath commented 4 years ago

Sematch 1.0.4 doesn't work for me (Python 3.6 on Windows x64, and Python 3.8.3 Arch Linux).

Minimal example:

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

Gives the error:

Traceback (most recent call last):
  File "D:/Github/foo/source/backend_prototyp/models/sematch_minimal_example.py", line 1, in <module>
    from sematch.semantic.similarity import WordNetSimilarity
  File "D:\Github\foo\source\backend_prototyp\models\sematch.py", line 2, in <module>
    from sematch.semantic.similarity import WordNetSimilarity
ModuleNotFoundError: No module named 'sematch.semantic'; 'sematch' is not a package

Process finished with exit code 1
LostInDarkMath commented 4 years ago

Oh shit, it was an error of mine. I named the file 'sematch.py' what causes the error.