Sentence segmentation¶
Splitting a text into sentences is the first step of almost every NLP pipeline.
esperantilo does it with
sentence_tokenizer.
from esperantilo import sentence_tokenizer
sentence_tokenizer("Mi lernas Esperanton. Ĉu vere? Jes!")
# ['Mi lernas Esperanton.', 'Ĉu vere?', 'Jes!']
The current rule¶
This tokenizer uses the characters given as an input argument to split the text
into sentences.
By default, they are ., ! and ?.
An example using specific characters would be:
Improvements¶
This tokenizer is a very simplified first version. Some improvements worth implementing are:
- Do not cut on abbreviations such as
Dr.orS-ro. - Do not cut on decimal numbers such as
3.14, or on other punctuation cases such as...or?!. - Do not cut on URLs, e-mail addresses and other tokens that contain
.or?. - etc.
See also¶
- API reference — the generated signature, arguments and examples.
- Guide → Testing — how
pytestpins the rule above down.