Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/sentences/sentence_splitting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ function rulebased_split_sentences(sentences)
sentences = replace(sentences, r"([?!.])\s" => Base.SubstitutionString("\\1\n"))

sentences = postproc_splits(sentences)
split(sentences, "\n")
split(sentences, "\n"; keepempty=false)
end



function replace_til_no_change(input, pattern, replacement)
while(occursin(pattern, input))
input = replace(input, pattern => replacement)
Expand Down Expand Up @@ -38,7 +37,6 @@ function postproc_splits(sentences::AbstractString)
# Before we do anything remove windows line-ends
sentences = replace(sentences, "\r" => "")


# breaks sometimes missing after "?", "safe" cases
sentences = replace(sentences, r"\b([a-z]+\?) ([A-Z][a-z]+)\b" => Base.SubstitutionString("\\1\n\\2"))
# breaks sometimes missing after "." separated with extra space, "safe" cases
Expand Down