Add files

Signed-off-by: András Schmelczer <andras@schmelczer.dev>
This commit is contained in:
Andras Schmelczer 2022-04-02 13:47:33 +02:00
commit 889e79174b
No known key found for this signature in database
GPG key ID: 39260B5B0614A13E
103 changed files with 24322 additions and 0 deletions

View file

@ -0,0 +1,18 @@
from typing import List
from .data import sentence_ending_punctuations
from .nlp import nlp
def get_sentences(text: str, ignore_partial: bool = False) -> List[str]:
doc = nlp(text)
possible_sentences = [s.text for s in doc.sents]
if ignore_partial:
possible_sentences = [
s
for s in possible_sentences
if s[0].isupper() and s[-1] in sentence_ending_punctuations
]
return possible_sentences