We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot import name 'Mapping' from 'collections'
some modules in collections has changed its position. please follow the source where the error occurred, and correct package name like below.
#old: from collectionsimport Mapping from collections.abc import Mapping
#old: from collections import Iterable from collections.abc import Iterable
my environments
gensim==3.8.1 numpy==1.25.2 scipy==1.11.2 six==1.16.0 smart-open==6.3.0
my code
from gensim.models import Word2Vec ko_model = Word2Vec.load('./ko/ko.bin') while True: query = input('Query: ') if query == "exit": break try: answer = ko_model.wv.most_similar(query) print(f'Answer: {answer}') except Exception as error: print(f'Error: {error}')
when running my code
Query: 강아지 /Users/bachtaeyeong/PROJECTS/pythonProjects/word2vec/main.py:14: DeprecationWarning: Call to deprecated `most_similar` (Method will be removed in 4.0.0, use self.wv.most_similar() instead). answer = ko_model.most_similar(query) Answer: [('고양이', 0.7290452718734741), ('거위', 0.7185635566711426), ('토끼', 0.7056223750114441), ('멧돼지', 0.6950401067733765), ('엄마', 0.693433403968811), ('난쟁이', 0.6806551218032837), ('한마리', 0.6770296096801758), ('아가씨', 0.6750353574752808), ('아빠', 0.6729634404182434), ('목걸이', 0.6512461304664612)] Query: 시장 Answer: [('도매', 0.6068975925445557), ('점유율', 0.5579971671104431), ('증시', 0.5483343005180359), ('내수', 0.54777592420578), ('농수산물', 0.5392422080039978), ('대기업', 0.5372408628463745), ('기업', 0.5371351838111877), ('미두', 0.5245275497436523), ('코스닥', 0.5162377953529358), ('중소기업', 0.5123578310012817)]
🤓 thanks for reading! If you know any other solution, please share yours.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
some modules in collections has changed its position.
please follow the source where the error occurred,
and correct package name like below.
my environments
my code
when running my code
🤓 thanks for reading! If you know any other solution, please share yours.
The text was updated successfully, but these errors were encountered: