-
Notifications
You must be signed in to change notification settings - Fork 96
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 #91 from baggepinnen/tests
Update test infrastructure
- Loading branch information
Showing
15 changed files
with
95 additions
and
114 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
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
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,19 +1,17 @@ | ||
module TestMetadata | ||
using Base.Test | ||
using Languages | ||
using TextAnalysis | ||
|
||
@testset "Metadata" begin | ||
|
||
sample_text1 = "This is a string" | ||
sample_text2 = "This is also a string" | ||
sample_file = joinpath(dirname(@__FILE__), "data", "poem.txt") | ||
|
||
sd = StringDocument(sample_text1) | ||
|
||
@assert isequal(name(sd), "Unnamed Document") | ||
@assert isequal(language(sd), Languages.English()) | ||
@assert isequal(author(sd), "Unknown Author") | ||
@assert isequal(timestamp(sd), "Unknown Time") | ||
@test isequal(name(sd), "Unnamed Document") | ||
@test isequal(language(sd), Languages.English()) | ||
@test isequal(author(sd), "Unknown Author") | ||
@test isequal(timestamp(sd), "Unknown Time") | ||
|
||
language!(sd, Languages.German()) | ||
@assert isequal(language(sd), Languages.German()) | ||
@test isequal(language(sd), Languages.German()) | ||
end |
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,27 +1,29 @@ | ||
module TestTextAnalysis | ||
using Base.Test | ||
using Languages | ||
using TextAnalysis | ||
using Base.Test | ||
using Languages | ||
using TextAnalysis | ||
using Compat | ||
|
||
my_tests = [ | ||
"tokenizer.jl", | ||
"ngramizer.jl", | ||
"document.jl", | ||
"metadata.jl", | ||
"corpus.jl", | ||
"preprocessing.jl", | ||
"dtm.jl", | ||
"stemmer.jl", | ||
"tf_idf.jl", | ||
"lda.jl", | ||
"summarizer.jl", | ||
"sentiment.jl" | ||
] | ||
|
||
println("Running tests:") | ||
# @testset "TextAnalysis" begin | ||
|
||
for my_test in my_tests | ||
println(" * $(my_test)") | ||
include(my_test) | ||
end | ||
println("Running tests:") | ||
println(typeof(Compat.String)) | ||
|
||
include("tokenizer.jl") | ||
include("ngramizer.jl") | ||
include("document.jl") | ||
include("metadata.jl") | ||
include("corpus.jl") | ||
include("preprocessing.jl") | ||
include("dtm.jl") | ||
include("stemmer.jl") | ||
include("tf_idf.jl") | ||
include("lda.jl") | ||
include("summarizer.jl") | ||
include("sentiment.jl") | ||
|
||
|
||
|
||
# end | ||
end |
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,9 +1,11 @@ | ||
@testset "Sentiment" begin | ||
m = SentimentAnalyzer() | ||
|
||
d=StringDocument("a very nice thing that everyone likes") | ||
d = StringDocument("a very nice thing that everyone likes") | ||
|
||
m(d) > 0.5 | ||
|
||
d=StringDocument("a horrible thing that everyone hates") | ||
d = StringDocument("a horrible thing that everyone hates") | ||
|
||
m(d) < 0.5 | ||
end |
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
Oops, something went wrong.