File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 66# It is made available under the MIT License
77
88from __future__ import print_function
9- from gensim import corpora , models , similarities
10- from mpltools import style
9+ try :
10+ from gensim import corpora , models , similarities
11+ except :
12+ print ("import gensim failed." )
13+ print ()
14+ print ("Please install it" )
15+ raise
16+
17+ try :
18+ from mpltools import style
19+ style .use ('ggplot' )
20+ except :
21+ print ("Could not import mpltools: plots will not be styled correctly" )
22+
1123import matplotlib .pyplot as plt
1224import numpy as np
1325from os import path
14- style .use ('ggplot' )
1526
1627if not path .exists ('./data/ap/ap.dat' ):
1728 print ('Error: Expected data to be present at data/ap/' )
29+ print ('Please cd into ./data & run ./download_ap.sh' )
1830
1931corpus = corpora .BleiCorpus ('./data/ap/ap.dat' , './data/ap/vocab.txt' )
2032model = models .ldamodel .LdaModel (
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ wget http://www.cs.princeton.edu/~blei/lda-c/ap.tgz
3+ tar xzf ap.tgz
Original file line number Diff line number Diff line change 11#! /bin/sh
22wget http://dumps.wikimedia.org/enwiki/latest/enwiki-latest-pages-articles.xml.bz2
3- wget http://www.cs.princeton.edu/~blei/lda-c/ap.tgz
4- tar xzf ap.tgz
You can’t perform that action at this time.
0 commit comments