- Notifications
You must be signed in to change notification settings - Fork87
🐍💯pySBD (Python Sentence Boundary Disambiguation) is a rule-based sentence boundary detection that works out-of-the-box.
License
nipunsadvilkar/pySBD
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
pySBD - python Sentence Boundary Disambiguation (SBD) - is a rule-based sentence boundary detection module that works out-of-the-box.
This project is a direct port of ruby gem -Pragmatic Segmenter which provides rule-based sentence boundary detection.
'PySBD: Pragmatic Sentence Boundary Disambiguation' a short research paper got accepted into 2nd Workshop for Natural Language Processing Open Source Software (NLP-OSS) at EMNLP 2020.
Research Paper:
https://arxiv.org/abs/2010.09657
Poster:
Python
pip install pysbd
- Currently pySBD supports 22 languages.
importpysbdtext="My name is Jonas E. Smith. Please turn to p. 55."seg=pysbd.Segmenter(language="en",clean=False)print(seg.segment(text))# ['My name is Jonas E. Smith.', 'Please turn to p. 55.']
- Use
pysbd
as aspaCy pipeline component. (recommended)
Please refer to examplepysbd_as_spacy_component.py - Use pysbd throughentrypoints
importspacyfrompysbd.utilsimportPySBDFactorynlp=spacy.blank('en')# explicitly adding component to pipeline# (recommended - makes it more readable to tell what's going on)nlp.add_pipe(PySBDFactory(nlp))# or you can use it implicitly with keyword# pysbd = nlp.create_pipe('pysbd')# nlp.add_pipe(pysbd)doc=nlp('My name is Jonas E. Smith. Please turn to p. 55.')print(list(doc.sents))# [My name is Jonas E. Smith., Please turn to p. 55.]
If you want to contribute new feature/language support or found a text that is incorrectly segmented using pySBD, then please head toCONTRIBUTING.md to know more and follow these steps.
- Fork it (https://github.com/nipunsadvilkar/pySBD/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
If you usepysbd
package in your projects or research, please citePySBD: Pragmatic Sentence Boundary Disambiguation.
@inproceedings{sadvilkar-neumann-2020-pysbd, title = "{P}y{SBD}: Pragmatic Sentence Boundary Disambiguation", author = "Sadvilkar, Nipun and Neumann, Mark", booktitle = "Proceedings of Second Workshop for NLP Open Source Software (NLP-OSS)", month = nov, year = "2020", address = "Online", publisher = "Association for Computational Linguistics", url = "https://www.aclweb.org/anthology/2020.nlposs-1.15", pages = "110--114", abstract = "We present a rule-based sentence boundary disambiguation Python package that works out-of-the-box for 22 languages. We aim to provide a realistic segmenter which can provide logical sentences even when the format and domain of the input text is unknown. In our work, we adapt the Golden Rules Set (a language specific set of sentence boundary exemplars) originally implemented as a ruby gem pragmatic segmenter which we ported to Python with additional improvements and functionality. PySBD passes 97.92{\%} of the Golden Rule Set examplars for English, an improvement of 25{\%} over the next best open source Python tool.",}
This project wouldn't be possible without the great work done byPragmatic Segmenter team.
About
🐍💯pySBD (Python Sentence Boundary Disambiguation) is a rule-based sentence boundary detection that works out-of-the-box.
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.