-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from piskvorky/dtm-interface
minor doc&format fixes in DTM model
- Loading branch information
Showing
3 changed files
with
31 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import gensim | ||
import os | ||
from gensim import corpora | ||
import cPickle as pickle | ||
from gensim import utils | ||
class DTMcorpus(corpora.textcorpus.TextCorpus): | ||
|
||
class DtmCorpus(corpora.textcorpus.TextCorpus): | ||
def get_texts(self): | ||
return self.input | ||
|
||
def __len__(self): | ||
return len(self.input) | ||
corpus,time_seq = utils.unpickle('gensim/test/test_data/dtm_test') | ||
|
||
corpus, time_seq = utils.unpickle('gensim/test/test_data/dtm_test') | ||
|
||
dtm_home = os.environ.get('DTM_HOME', "C:/Users/Artyom/SkyDrive/TopicModels/dtm-master/") | ||
dtm_path = os.path.join(dtm_home, 'bin', 'dtm') if dtm_home else None | ||
|
||
|
||
model = gensim.models.DTMmodel(dtm_path,corpus,time_seq,num_topics=2,id2word=corpus.dictionary) | ||
topics = model.show_topics(topics=2,times=2, topn=10) | ||
model = gensim.models.DtmModel(dtm_path, corpus, time_seq, num_topics=2, id2word=corpus.dictionary) | ||
topics = model.show_topics(topics=2, times=2, topn=10) |