Improve sentence splitting logic
This commit is contained in:
parent
8b53a5247c
commit
35e71cfa49
2 changed files with 6 additions and 7 deletions
|
@ -8,7 +8,7 @@ end
|
|||
|
||||
local function SplitSentences(paragraph)
|
||||
local sentences = {}
|
||||
for sentence in string.gmatch(paragraph, "([^,%.%?!]+[,%.%?!]?)[%s]*") do
|
||||
for sentence in string.gmatch(paragraph, "([^%.%?!]+[%.%?!]?)[%s]*") do
|
||||
local trimmed = sentence:gsub("^%s+", ""):gsub("%s+$", "")
|
||||
if #trimmed > 0 then
|
||||
table.insert(sentences, trimmed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue