Skip to content

Commit 2b13342

Browse files
author
Jonathan Chang
committed
Merge pull request #2 from johnmyleswhite/master
Minimal changes to make example work
2 parents 5bb9282 + d66c994 commit 2b13342

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

examples/LDA.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
load("TopicModels")
21
using TopicModels
32

4-
testDocuments = readDocuments(open("cora.documents"))
5-
testLexicon = readLexicon(open("cora.lexicon"))
6-
model = Model(fill(0.1, 10), 0.01, length(testLexicon), testDocuments)
7-
trainModel(testDocuments, model, 30)
3+
exdir = Pkg.dir("TopicModels", "examples")
4+
5+
testDocuments = readDocuments(open(joinpath(exdir, "cora.documents")))
6+
testLexicon = readLexicon(open(joinpath(exdir, "cora.lexicon")))
7+
8+
corpus = Corpus(testDocuments)
9+
10+
model = Model(fill(0.1, 10), 0.01, length(testLexicon), corpus)
11+
12+
@time trainModel(model, 30)
13+
814
topWords = topTopicWords(model, testLexicon, 21)

src/TopicModels.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ function readLexicon(stream)
193193
map(chomp, convert(Array{String,1}, lines))
194194
end
195195

196-
export trainModel, topTopicWords, readDocuments, readLexicon
196+
export Corpus,
197+
Model,
198+
readDocuments,
199+
readLexicon,
200+
topTopicWords,
201+
trainModel
197202

198203
end

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy