UNPKG

cldr-segmentation

Version:
22 lines (18 loc) 643 B
<html> <head> <script src='./node_modules/utfstring/utfstring.js'></script> <script src='./dist/cldr-segmentation.js'></script> </head> <body> <script type='text/javascript'> var breakIter = new cldrSegmentation.BreakIterator(cldrSegmentation.suppressions.en); var text = "I like Mrs. Patterson, she's nice."; breakIter.eachSentence(text, function(str, start, stop) { console.log("'" + str + "': " + start + ", " + stop); }); breakIter.eachWord(text, function(str, start, stop) { console.log("'" + str + "': " + start + ", " + stop); }); </script> </body> </html>