TM-Town benefits from many open source natural language processing technologies and advancements. To give back to the community TM-Town strives to provide educational materials (through the TM-Town blog), NLP resources, and to open source some of TM-Town's internal algorithms (such as TM-Town's ruby segmentation gem Pragmatic Segmenter). This page contains a collection of natural language processing resources focused mainly on:
The importance of segmentation is often ignored in the literature on text alignment.
Segmentation in this section refers specifically to sentence segmentation - also known as sentence boundary disambiguation or sentence boundary detection. According to Wikipedia, sentence boundary disambiguation is defined as:
Sentence boundary disambiguation (SBD), also known as sentence breaking, is the problem in natural language processing of deciding where sentences begin and end. Often natural language processing tools require their input to be divided into sentences for a number of reasons. However sentence boundary identification is challenging because punctuation marks are often ambiguous. For example, a period may denote an abbreviation, decimal point, an ellipsis, or an email address – not the end of a sentence. About 47% of the periods in the Wall Street Journal corpus denote abbreviations. As well, question marks and exclamation marks may appear in embedded quotations, emoticons, computer code, and slang. Languages like Japanese and Chinese have unambiguous sentence-ending markers.
Pragmatic Segmenter
Pragmatic Segmenter is TM-Town's open source segmentation tool for Ruby. Pragmatic Segmenter is a rule-based sentence boundary detection gem that works out-of-the-box across many languages.
The goal of Pragmatic Segmenter is to provide a "real-world" segmenter that works without any setup across many languages and does a reasonable job when the format and domain of the input text are unknown. Pragmatic Segmenter does not use any machine-learning techniques and thus does not require training data.
Pragmatic Segmenter aims to improve on other segmentation engines in 2 main areas:
Language support (most segmentation tools only focus on English)
Text cleaning and preprocessing
Pragmatic Segmenter is opinionated and made for the explicit purpose of segmenting texts to create translation memories. Therefore, things such as parenthesis within a sentence are kept as one segment, even if technically there are two or more sentences within the segment in order to maintain coherence. The algorithm is also conservative in that if it comes across an ambiguous sentence boundary it will ignore it rather than splitting.
Live Demo
Give Pragmatic Segmenter a try by adding some text below that you would like segmented. If you find any text does not segment the way you would expect, please let us know by opening an issue.
Analyzing your text, please wait...
Tools, Libraries and Algorithms
*GRS = Golden Rule Score. See below to download the full Golden Rule Test Set.
† GRS (Other Languages) is the total of the Golden Rules listed above for all languages other than English. This metric by no means includes all languages, only the ones that have Golden Rules listed above. ‡ Speed is based on the performance benchmark results detailed in the section "Speed Performance Benchmarks" below. The number is an average of 10 runs.
Speed Performance Benchmarks
To test the relative performance of different segmentation tools and libraries I created a simple benchmark test. The test takes the 50 English Golden Rules combined into one string and runs it 100 times through the segmenter. This speed benchmark is by no means the most scientific benchmark, but it should help to give some relative performance data. The tests were done on a Mac Pro 3.7 GHz Quad-Core Intel Xeon E5 running 10.9.5. For Punkt, Standford CoreNLP and OpenNLP the tests were run using the Ruby port of the library.
The Golden Rules are a set of tests developed by TM-Town that can be run through a segmenter to check its accuracy. This list is by no means complete and will evolve and expand over time.
English
Simple period to end sentence Hello World. My name is Jonas. ["Hello World.", "My name is Jonas."]
Question mark to end sentence What is your name? My name is Jonas. ["What is your name?", "My name is Jonas."]
Exclamation point to end sentence There it is! I found it. ["There it is!", "I found it."]
One letter upper case abbreviations My name is Jonas E. Smith. ["My name is Jonas E. Smith."]
One letter lower case abbreviations Please turn to p. 55. ["Please turn to p. 55."]
Two letter lower case abbreviations in the middle of a sentence Were Jane and co. at the party? ["Were Jane and co. at the party?"]
Two letter upper case abbreviations in the middle of a sentence They closed the deal with Pitt, Briggs & Co. at noon. ["They closed the deal with Pitt, Briggs & Co. at noon."]
Two letter lower case abbreviations at the end of a sentence Let's ask Jane and co. They should know. ["Let's ask Jane and co.", "They should know."]
Two letter upper case abbreviations at the end of a sentence They closed the deal with Pitt, Briggs & Co. It closed yesterday. ["They closed the deal with Pitt, Briggs & Co.", "It closed yesterday."]
Two letter (prepositive) abbreviations I can see Mt. Fuji from here. ["I can see Mt. Fuji from here."]
Two letter (prepositive & postpositive) abbreviations St. Michael's Church is on 5th st. near the light. ["St. Michael's Church is on 5th st. near the light."]
Possesive two letter abbreviations That is JFK Jr.'s book. ["That is JFK Jr.'s book."]
Multi-period abbreviations in the middle of a sentence I visited the U.S.A. last year. ["I visited the U.S.A. last year."]
Multi-period abbreviations at the end of a sentence I live in the E.U. How about you? ["I live in the E.U.", "How about you?"]
U.S. as sentence boundary I live in the U.S. How about you? ["I live in the U.S.", "How about you?"]
U.S. as non sentence boundary with next word capitalized I work for the U.S. Government in Virginia. ["I work for the U.S. Government in Virginia."]
U.S. as non sentence boundary I have lived in the U.S. for 20 years. ["I have lived in the U.S. for 20 years."]
A.M. / P.M. as non sentence boundary and sentence boundary At 5 a.m. Mr. Smith went to the bank. He left the bank at 6 P.M. Mr. Smith then went to the store. ["At 5 a.m. Mr. Smith went to the bank.", "He left the bank at 6 P.M.", "Mr. Smith then went to the store."]
Number as non sentence boundary She has $100.00 in her bag. ["She has $100.00 in her bag."]
Number as sentence boundary She has $100.00. It is in her bag. ["She has $100.00.", "It is in her bag."]
Parenthetical inside sentence He teaches science (He previously worked for 5 years as an engineer.) at the local University. ["He teaches science (He previously worked for 5 years as an engineer.) at the local University."]
Web addresses The site is: https://www.example.50.com/new-site/awesome_content.html. Please check it out. ["The site is: https://www.example.50.com/new-site/awesome_content.html.", "Please check it out."]
Single quotations inside sentence She turned to him, 'This is great.' she said. ["She turned to him, 'This is great.' she said."]
Double quotations inside sentence She turned to him, "This is great." she said. ["She turned to him, \"This is great.\" she said."]
Double quotations at the end of a sentence She turned to him, \"This is great.\" She held the book out to show him. ["She turned to him, \"This is great.\"", "She held the book out to show him."]
Double punctuation (exclamation point) Hello!! Long time no see. ["Hello!!", "Long time no see."]
Double punctuation (question mark) Hello?? Who is there? ["Hello??", "Who is there?"]
Double punctuation (exclamation point / question mark) Hello!? Is that you? ["Hello!?", "Is that you?"]
Double punctuation (question mark / exclamation point) Hello?! Is that you? ["Hello?!", "Is that you?"]
List (period followed by parens and no period to end item) 1.) The first item 2.) The second item ["1.) The first item", "2.) The second item"]
List (period followed by parens and period to end item) 1.) The first item. 2.) The second item. ["1.) The first item.", "2.) The second item."]
List (parens and no period to end item) 1) The first item 2) The second item ["1) The first item", "2) The second item"]
List (parens and period to end item) 1) The first item. 2) The second item. ["1) The first item.", "2) The second item."]
List (period to mark list and no period to end item) 1. The first item 2. The second item ["1. The first item", "2. The second item"]
List (period to mark list and period to end item) 1. The first item. 2. The second item. ["1. The first item.", "2. The second item."]
List with bullet • 9. The first item • 10. The second item ["• 9. The first item", "• 10. The second item"]
List with hypthen ⁃9. The first item ⁃10. The second item ["⁃9. The first item", "⁃10. The second item"]
Alphabetical list a. The first item b. The second item c. The third list item ["a. The first item", "b. The second item", "c. The third list item"]
Errant newline in the middle of a sentence (PDF) This is a sentence\ncut off in the middle because pdf. ["This is a sentence\ncut off in the middle because pdf."]
Errant newline in the middle of a sentence It was a cold \nnight in the city. ["It was a cold night in the city."]
Lower case list separated by newline features\ncontact manager\nevents, activities\n ["features", "contact manager", "events, activities"]
Geo Coordinates You can find it at N°. 1026.253.553. That is where the treasure is. ["You can find it at N°. 1026.253.553.", "That is where the treasure is."]
Named entities with an exclamation point She works at Yahoo! in the accounting department. ["She works at Yahoo! in the accounting department."]
I as a sentence boundary and I as an abbreviation We make a good team, you and I. Did you see Albert I. Jones yesterday? ["We make a good team, you and I.", "Did you see Albert I. Jones yesterday?"]
Ellipsis at end of quotation Thoreau argues that by simplifying one’s life, “the laws of the universe will appear less complex. . . .” ["Thoreau argues that by simplifying one’s life, “the laws of the universe will appear less complex. . . .”"]
Ellipsis with square brackets "Bohr [...] used the analogy of parallel stairways [...]" (Smith 55). ["\"Bohr [...] used the analogy of parallel stairways [...]\" (Smith 55)."]
Ellipsis as sentence boundary (standard ellipsis rules) If words are left off at the end of a sentence, and that is all that is omitted, indicate the omission with ellipsis marks (preceded and followed by a space) and then indicate the end of the sentence with a period . . . . Next sentence. ["If words are left off at the end of a sentence, and that is all that is omitted, indicate the omission with ellipsis marks (preceded and followed by a space) and then indicate the end of the sentence with a period . . . .", "Next sentence."]
Ellipsis as sentence boundary (non-standard ellipsis rules) I never meant that.... She left the store. ["I never meant that....", "She left the store."]
Ellipsis as non sentence boundary I wasn’t really ... well, what I mean...see . . . what I'm saying, the thing is . . . I didn’t mean it. ["I wasn’t really ... well, what I mean...see . . . what I'm saying, the thing is . . . I didn’t mean it."
4-dot ellipsis One further habit which was somewhat weakened . . . was that of combining words into self-interpreting compounds. . . . The practice was not abandoned. . . . ["One further habit which was somewhat weakened . . . was that of combining words into self-interpreting compounds.", ". . . The practice was not abandoned. . . ."]
No whitespace in between sentences Credit: Don_Patrick Hello world.Today is Tuesday.Mr. Smith went to the store and bought 1,000.That is a lot. ["Hello world.", "Today is Tuesday.", "Mr. Smith went to the store and bought 1,000.", "That is a lot."]
German
Quotation at end of sentence „Ich habe heute keine Zeit“, sagte die Frau und flüsterte leise: „Und auch keine Lust.“ Wir haben 1.000.000 Euro. ["„Ich habe heute keine Zeit“, sagte die Frau und flüsterte leise: „Und auch keine Lust.“", "Wir haben 1.000.000 Euro."]
Abbreviations Es gibt jedoch einige Vorsichtsmaßnahmen, die Du ergreifen kannst, z. B. ist es sehr empfehlenswert, dass Du Dein Zuhause von allem Junkfood befreist. ["Es gibt jedoch einige Vorsichtsmaßnahmen, die Du ergreifen kannst, z. B. ist es sehr empfehlenswert, dass Du Dein Zuhause von allem Junkfood befreist."]
Numbers Was sind die Konsequenzen der Abstimmung vom 12. Juni? ["Was sind die Konsequenzen der Abstimmung vom 12. Juni?"]
Japanese
Simple period to end sentence これはペンです。それはマーカーです。 ["これはペンです。", "それはマーカーです。"]
Question mark to end sentence それは何ですか?ペンですか? ["それは何ですか?", "ペンですか?"]
Exclamation point to end sentence 良かったね!すごい! ["良かったね!", "すごい!"]
Errant newline in the middle of a sentence これは父の\n家です。 ["これは父の家です。"]
Arabic
Regular punctuation سؤال وجواب: ماذا حدث بعد الانتخابات الايرانية؟ طرح الكثير من التساؤلات غداة ظهور نتائج الانتخابات الرئاسية الايرانية التي أججت مظاهرات واسعة واعمال عنف بين المحتجين على النتائج ورجال الامن. يقول معارضو الرئيس الإيراني إن الطريقة التي اعلنت بها النتائج كانت مثيرة للاستغراب. ["سؤال وجواب:", "ماذا حدث بعد الانتخابات الايرانية؟", "طرح الكثير من التساؤلات غداة ظهور نتائج الانتخابات الرئاسية الايرانية التي أججت مظاهرات واسعة واعمال عنف بين المحتجين على النتائج ورجال الامن.", "يقول معارضو الرئيس الإيراني إن الطريقة التي اعلنت بها النتائج كانت مثيرة للاستغراب."]
Abbreviations وقال د. ديفيد ريدي و الأطباء الذين كانوا يعالجونها في مستشفى برمنجهام إنها كانت تعاني من أمراض أخرى. وليس معروفا ما اذا كانت قد توفيت بسبب اصابتها بأنفلونزا الخنازير. ["وقال د. ديفيد ريدي و الأطباء الذين كانوا يعالجونها في مستشفى برمنجهام إنها كانت تعاني من أمراض أخرى.", "وليس معروفا ما اذا كانت قد توفيت بسبب اصابتها بأنفلونزا الخنازير."]
Numbers and Dates ومن المنتظر أن يكتمل مشروع خط أنابيب نابوكو البالغ طوله 3300 كليومترا في 12/08/2014 بتكلفة تُقدر بـ 7.9 مليارات يورو أي نحو 10.9 مليارات دولار. ومن المقرر أن تصل طاقة ضخ الغاز في المشروع 31 مليار متر مكعب انطلاقا من بحر قزوين مرورا بالنمسا وتركيا ودول البلقان دون المرور على الأراضي الروسية. ["ومن المنتظر أن يكتمل مشروع خط أنابيب نابوكو البالغ طوله 3300 كليومترا في 12/08/2014 بتكلفة تُقدر بـ 7.9 مليارات يورو أي نحو 10.9 مليارات دولار.", "ومن المقرر أن تصل طاقة ضخ الغاز في المشروع 31 مليار متر مكعب انطلاقا من بحر قزوين مرورا بالنمسا وتركيا ودول البلقان دون المرور على الأراضي الروسية."]
Time الاحد, 21 فبراير/ شباط, 2010, 05:01 GMT الصنداي تايمز: رئيس الموساد قد يصبح ضحية الحرب السرية التي شتنها بنفسه. العقل المنظم هو مئير داجان رئيس الموساد الإسرائيلي الذي يشتبه بقيامه باغتيال القائد الفلسطيني في حركة حماس محمود المبحوح في دبي. ["الاحد, 21 فبراير/ شباط, 2010, 05:01 GMT الصنداي تايمز:", "رئيس الموساد قد يصبح ضحية الحرب السرية التي شتنها بنفسه.", "العقل المنظم هو مئير داجان رئيس الموساد الإسرائيلي الذي يشتبه بقيامه باغتيال القائد الفلسطيني في حركة حماس محمود المبحوح في دبي."]
Comma عثر في الغرفة على بعض أدوية علاج ارتفاع ضغط الدم، والقلب، زرعها عملاء الموساد كما تقول مصادر إسرائيلية، وقرر الطبيب أن الفلسطيني قد توفي وفاة طبيعية ربما إثر نوبة قلبية، وبدأت مراسم الحداد عليه ["عثر في الغرفة على بعض أدوية علاج ارتفاع ضغط الدم، والقلب،", "زرعها عملاء الموساد كما تقول مصادر إسرائيلية،", "وقرر الطبيب أن الفلسطيني قد توفي وفاة طبيعية ربما إثر نوبة قلبية،", "وبدأت مراسم الحداد عليه"]
Italian
Abbreviations Salve Sig.ra Mengoni! Come sta oggi? ["Salve Sig.ra Mengoni!", "Come sta oggi?"]
Quotations Una lettera si può iniziare in questo modo «Il/la sottoscritto/a.». ["Una lettera si può iniziare in questo modo «Il/la sottoscritto/a.»."]
Numbers La casa costa 170.500.000,00€! ["La casa costa 170.500.000,00€!"]
Russian
Abbreviations Объем составляет 5 куб.м. ["Объем составляет 5 куб.м."]
Quotations Маленькая девочка бежала и кричала: «Не видали маму?». ["Маленькая девочка бежала и кричала: «Не видали маму?»."]
Numbers Сегодня 27.10.14 ["Сегодня 27.10.14"]
Spanish
Question mark to end sentence ¿Cómo está hoy? Espero que muy bien. ["¿Cómo está hoy?", "Espero que muy bien."]
Exclamation point to end sentence ¡Hola señorita! Espero que muy bien. ["¡Hola señorita!", "Espero que muy bien."]
Abbreviations Hola Srta. Ledesma. Buenos días, soy el Lic. Naser Pastoriza, y él es mi padre, el Dr. Naser. ["Hola Srta. Ledesma.", "Buenos días, soy el Lic. Naser Pastoriza, y él es mi padre, el Dr. Naser."]
Numbers ¡La casa cuesta $170.500.000,00! ¡Muy costosa! Se prevé una disminución del 12.5% para el próximo año. ["¡La casa cuesta $170.500.000,00!", "¡Muy costosa!", "Se prevé una disminución del 12.5% para el próximo año."]
Quotations «Ninguna mente extraordinaria está exenta de un toque de demencia.», dijo Aristóteles. ["«Ninguna mente extraordinaria está exenta de un toque de demencia.», dijo Aristóteles."]
Greek
Question mark to end sentence Με συγχωρείτε· πού είναι οι τουαλέτες; Τις Κυριακές δε δούλευε κανένας. το κόστος του σπιτιού ήταν £260.950,00. ["Με συγχωρείτε· πού είναι οι τουαλέτες;", "Τις Κυριακές δε δούλευε κανένας.", "το κόστος του σπιτιού ήταν £260.950,00."]
Hindi
Full stop सच्चाई यह है कि इसे कोई नहीं जानता। हो सकता है यह फ़्रेन्को के खिलाफ़ कोई विद्रोह रहा हो, या फिर बेकाबू हो गया कोई आनंदोत्सव। ["सच्चाई यह है कि इसे कोई नहीं जानता।", "हो सकता है यह फ़्रेन्को के खिलाफ़ कोई विद्रोह रहा हो, या फिर बेकाबू हो गया कोई आनंदोत्सव।"]
Armenian
Sentence ending punctuation Ի՞նչ ես մտածում: Ոչինչ: ["Ի՞նչ ես մտածում:", "Ոչինչ:"]
Ellipsis Ապրիլի 24-ին սկսեց անձրևել...Այդպես էի գիտեի: ["Ապրիլի 24-ին սկսեց անձրևել...Այդպես էի գիտեի:"]
Period is not a sentence boundary Այսպիսով` մոտենում ենք ավարտին: Տրամաբանությյունը հետևյալն է. պարզություն և աշխատանք: ["Այսպիսով` մոտենում ենք ավարտին:", "Տրամաբանությյունը հետևյալն է. պարզություն և աշխատանք:"]
Sentence ending punctuation خوشبختم، آقای رضا. شما کجایی هستید؟ من از تهران هستم. ["خوشبختم، آقای رضا.", "شما کجایی هستید؟", "من از تهران هستم."]
Urdu
Sentence ending punctuation کیا حال ہے؟ ميرا نام ___ ەے۔ میں حالا تاوان دےدوں؟ ["کیا حال ہے؟", "ميرا نام ___ ەے۔", "میں حالا تاوان دےدوں؟"]
Dutch
Sentence starting with a number Hij schoot op de JP8-brandstof toen de Surface-to-Air (sam)-missiles op hem af kwamen. 81 procent van de schoten was raak. ["Hij schoot op de JP8-brandstof toen de Surface-to-Air (sam)-missiles op hem af kwamen.", "81 procent van de schoten was raak."]
Sentence starting with an ellipsis 81 procent van de schoten was raak. ...en toen barste de hel los. ["81 procent van de schoten was raak.", "...en toen barste de hel los."]
Papers and Books
Elephant: Sequence Labeling for Word and Sentence Segmentation [pdf | mirror]
Kilian Evang, Valerio Basile, Grzegorz Chrupała and Johan Bos (2013)
Sentence Boundary Detection: A Long Solved Problem? [pdf | mirror]
Jonathon Read, Rebecca Dridan, Stephan Oepen, Lars Jørgen Solberg (2012)
Handbook of Natural Language Processing (Second Edition) [amazon]
Nitin Indurkhya and Fred J. Damerau (2010)
Sentence Boundary Detection and the Problem with the U.S. [pdf | mirror]
Dan Gillick (2009)
Thoughts on Word and Sentence Segmentation in Thai [pdf | mirror]
Wirote Aroonmanakun (2007)
Unsupervised Multilingual Sentence Boundary Detection [pdf | mirror]
Tibor Kiss and Jan Strunk (2005)
An Analysis of Sentence Boundary Detection Systems for English and Portuguese Documents [pdf | mirror]
Carlos N. Silla Jr. and Celso A. A. Kaestner (2004)
Periods, Capitalized Words, etc. [pdf]
Andrei Mikheev (2002)
Scaled log likelihood ratios for the detection of abbreviations in text corpora [pdf | mirror]
Tibor Kiss and Jan Strunk (2002)
Viewing sentence boundary detection as collocation identification [pdf | mirror]
Tibor Kiss and Jan Strunk (2002)
Automatic Sentence Break Disambiguation for Thai [pdf | mirror]
Paisarn Charoenpornsawat and Virach Sornlertlamvanich (2001)
Sentence Boundary Detection: A Comparison of Paradigms for Improving MT Quality [pdf | mirror]
Daniel J. Walker, David E. Clements, Maki Darwin and Jan W. Amtrup (2001)
A Sentence Boundary Detection System [ppt | mirror]
Wendy Chen (2000)
Tagging Sentence Boundaries [pdf | mirror]
Andrei Mikheev (2000)
Automatic Extraction of Rules For Sentence Boundary Disambiguation [pdf]
E. Stamatatos, N. Fakotakis, AND G. Kokkinakis (1999)
A Maximum Entropy Approach to Identifying Sentence Boundaries [pdf | mirror]
Jeffrey C. Reynar and Adwait Ratnaparkhi (1997)
Adaptive Multilingual Sentence Boundary Disambiguation [pdf | mirror]
David D. Palmer and Marti A. Hearst (1997)
What is a word, What is a sentence? Problems of Tokenization [pdf | mirror]
Gregory Grefenstette and Pasi Tapanainen (1994)
Chapter 2: Tokenisation and Sentence Segmentation [pdf | mirror]
David D. Palmer
Using SRX standard for sentence segmentation in LanguageTool [pdf | mirror]
Marcin Miłkowski and Jarosław Lipski
Alignment
Papers and Books
Evaluating (and Improving) Sentence Alignment under Noisy Conditions [pdf | mirror]
Omar Zaidan and Vishal Chowdhary (2013)
Evaluation of Sentence Alignment Systems [pdf | mirror]
Sadaf Abdul-Rauf, Mark Fishel, Patrik Lambert, Sandra Noubours, and Rico Sennrich (2010)
Extrinsic Evaluation of Sentence Alignment Systems [pdf | mirror]
Sadaf Abdul-Rauf, Mark Fishel, Patrik Lambert, Sandra Noubours, Rico Sennrich (2010)
Improved Unsupervised Sentence Alignment for Symmetrical and Asymmetrical Parallel Corpora [pdf | mirror]
Fabienne Braune and Alexander Fraser (2010)
Improved Sentence Alignment for Movie Subtitles [pdf | mirror]
Jörg Tiedemann (2007)
Segmentation and alignment of parallel text for statistical machine translation [pdf | mirror]
Yoggang Deng, Shankar Kumar, and William Byrne (2006)
Evaluation of Sentence Alignment Methods on Portuguese-English Parallel Texts [pdf | mirror]
Helena de Medeiros Caseli1, Maria das Graças Volpe Nunes (2003)
Bleu: a Method for Automatic Evaluation of Machine Translation [pdf | mirror]
Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu (2001)
A Program for Aligning Sentences in Bilingual Corpora [pdf | mirror]
William A. Gale and Kenneth W. Church (1993)
Aligning sentences in bilingual corpora using lexical information [pdf | mirror]
Stanley F. Chen (1993)
Aligning sentences in parallel corpora [pdf | mirror]
Peter F. Brown, Jennifer C. Lai, and Robert L. Mercer (1991)
Evaluating Word Alignment Systems [pdf]
Magnus Merkel and Lars Ahrenberg
An overview of bitext alignment algorithms [pdf | mirror]
Jody Foo