Update documents to sentence_splitter.py
* Update sentence_splitter.py
Update some legacy documents that look like copied from `WordSplitter`.
* Update sentence_splitter.py
@@ -15,13 +15,12 @@ class SentenceSplitter(Registrable):
def split_sentences(self, text: str) -> List[str]:
"""
- Splits ``texts`` into a list of :class:`Token` objects.
+ Splits a ``text`` :class:`str` paragraph into a list of :class:`str`, where each is a sentence.
"""
raise NotImplementedError
def batch_split_sentences(self, texts: List[str]) -> List[List[str]]:
"""
- This method lets you take advantage of spacy's batch processing.
Default implementation is to just iterate over the texts and call ``split_sentences``.
"""
return [self.split_sentences(text) for text in texts]
@@ -59,4 +58,7 @@ class SpacySentenceSplitter(SentenceSplitter):
@overrides
def batch_split_sentences(self, texts: List[str]) -> List[List[str]]:
+ """
+ This method lets you take advantage of spacy's batch processing.
+ """
return [[sentence.string.strip() for sentence in doc.sents] for doc in self.spacy.pipe(texts)]
