Move files

This commit is contained in:
Andras Schmelczer 2022-06-25 14:01:14 +02:00
parent cf0ac4b161
commit 0bf865ce2a
233 changed files with 117 additions and 2394 deletions

View file

@ -0,0 +1,30 @@
from typing import List, cast
from segtok.segmenter import split_multi
from .data import sentence_ending_punctuations
def get_sentences(
text: str, ignore_partial: bool = False, true_case: bool = False
) -> List[str]:
if text.strip() == "":
return []
possible_sentences = [
cast(str, s).strip() for s in split_multi(text) if cast(str, s).strip()
]
if ignore_partial:
possible_sentences = [
s
for s in possible_sentences
if s[0].isupper() and s[-1] in sentence_ending_punctuations
]
if true_case:
possible_sentences = [
s[0].lower() + s[1:] for s in possible_sentences # very crude method
]
return possible_sentences