-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hello Team,
Thank you for this repo and the python package.
I am using the python package for topic modelling on a simple test data and has my code set up based on your example on medium as follows:
from gensim import corpora
from gdtm.wrappers import TNDMallet
Set the path to the path where you saved the Mallet implementation of the model, plus bin/mallet
tnd_path = 'D:/mallet-tnd/bin/mallet'
dataset = [['model', 'study', 'patient', 'university', 'student', 'result', 'method', 'patient'],
['statistics', 'data', 'patient', 'study', 'analysis', 'method'], ['test', 'using', 'regression',
'statistical', 'research', 'article', 'group', 'score', 'factor']]
Format the data set for consumption by the wrapper (this is done automatically in class-based models)
dictionary = corpora.Dictionary(dataset)
corpus = [dictionary.doc2bow(doc) for doc in dataset]
Pass in the path to the java code along with the data set and parameters
model = TNDMallet(tnd_path, corpus, num_topics=1, id2word=dictionary,
skew=25, noise_words_max=1, iterations=1000)
topics = model.get_topics()
noise = model.load_noise_dist()
When I run the code, I get the traceback below:
Traceback (most recent call last):
File "C:/Users/雷神/Desktop/毕业论文改/主题模型/GDTM.py", line 12, in
model = TNDMallet(tnd_path, corpus, num_topics=1, id2word=dictionary,
File "D:\Anaconda3\lib\site-packages\gdtm\wrappers\tnd.py", line 83, in init
self.train(corpus)
File "D:\Anaconda3\lib\site-packages\gdtm\wrappers\tnd.py", line 121, in train
self.word_topics = self.load_word_topics()
File "D:\Anaconda3\lib\site-packages\gdtm\wrappers\base_wrapper.py", line 271, in load_word_topics
with utils.open(self.fstate(), 'rb') as fin:
File "D:\Anaconda3\lib\site-packages\smart_open\smart_open_lib.py", line 235, in open
binary = _open_binary_stream(uri, binary_mode, transport_params)
File "D:\Anaconda3\lib\site-packages\smart_open\smart_open_lib.py", line 398, in _open_binary_stream
fobj = submodule.open_uri(uri, mode, transport_params)
File "D:\Anaconda3\lib\site-packages\smart_open\local_file.py", line 34, in open_uri
fobj = io.open(parsed_uri['uri_path'], mode)
FileNotFoundError: [Errno 2] No such file or directory: 'D:\Temp\e5be94_state.mallet.gz'
Process finished with exit code 1
I will be grateful if you would have a look and provide some guidance regarding this issue.
Regards
Yuehong