Skip to content

Commit b460196

Browse files
author
guoyongzhi
committed
support IOStream
1 parent e491416 commit b460196

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LanguageIdentification"
22
uuid = "35248bf2-58a5-46a0-9b1d-c0a73a50a105"
33
authors = ["guoyongzhi <[email protected]>"]
4-
version = "1.0.0"
4+
version = "1.0.1"
55

66
[compat]
77
julia = "1.9"

src/ngrams.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ function count_all_ngrams(text_list, n, counter = Dict{Vector{UInt8},Float32}();
3939
end
4040
counter
4141
end
42-
42+
function count_all_ngrams(textfile::IO, args...; kwargs...)
43+
count_all_ngrams(eachline(textfile), args...; kwargs...)
44+
end
4345
# function count_dataset_ngrams(dataset, n; kwargs...)
4446
# counters = [Dict{Vector{UInt8},Float32}() for i in 1:n]
4547
# for (text, lang) in dataset

0 commit comments

Comments
 (0)