JuliaText / TextAnalysis.jl

Julia package for text analysis
Other
374 stars 96 forks source link

Ngram dictionary constructor in Readme does not work #59

Closed ksteimel closed 6 years ago

ksteimel commented 7 years ago

The ngram document constructor for the dictionary of n-grams does not work correctly in Julia 0.5. This appears to be due to the change in Dictionary creation syntax not anything wrong with the classes themselves.

aviks commented 6 years ago

Do you have a line of example code that shows the error ?

ksteimel commented 6 years ago

The line that says

my_ngrams = (UTF8String => Int)["To" => 1, "be" => 2, "or" => 1, "not" => 1, "to" => 1, "be..." => 1]

Should be my_ngrams = Dict{String, Int}("To" => 1, "be" => 2, "or" => 1, "not" => 1, "to" => 1, "be..." => 1)

Due to the new syntax for dictionary definition. The old way throws an error like ERROR: MethodError: no method matching getindex(::Pair{DataType,DataType}, ::Pair{String,Int64}, ::Pair{String,Int64}, ::Pair{String,Int64}, ::Pair{String,Int64}, ::Pair{String,Int64}, ::Pair{String,Int64})