JuliaText / TextAnalysis.jl

Julia package for text analysis
Other
373 stars 95 forks source link

Summarize function throws error for docs with less than 5 sentences. #153

Closed Ayushk4 closed 5 years ago

Ayushk4 commented 5 years ago

Here's how to replicate the error

julia> using TextAnalysis

julia> s = StringDocument("Assume this short Document. We will use this to show working of summarize function. This document has too foo sentences.")
julia> TextAnalysis.summarize(s)
ERROR: BoundsError: attempt to access 3-element Array{Int64,1} at index [1:5]
Ayushk4 commented 5 years ago

This is an easy to solve bug, changing the following to check for min b/w ns and the number of sentences after sentence_tokenizing should fix this. https://github.com/JuliaText/TextAnalysis.jl/blob/3b046d2c205d1525b2acaf3c2f66b52ce69bfad5/src/summarizer.jl#L10