--- url: "https://web.dev/blog/intl-segmenter" titulek: "The Intl.Segmenter object is now part of Baseline | Blog | web.dev" h1: "The Intl.Segmenter object is now part of Baseline Stay organized with collections Save and categorize content based on your preferences." popis: "The JavaScript Intl.Segmenter object is now interoperable, enabling locale-sensitive text segmentation." jazyk: "en" kanonicka: "https://web.dev/blog/intl-segmenter" drobecky: ["Blog", "The Intl.Segmenter object is now part of Baseline"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 00:04:39" znaku: 2393 slov: 263 kodovani: "iso-8859-2" sha256: "d55b223751109e09bec6556d4bfad3b1eb533582c2e447be1c4fef2ddc021ff6" --- The Intl.Segmenter object is now part of Baseline Stay organized with collections Save and categorize content based on your preferences. Rachel Andrew You can now use [`Intl.Segmenter`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter) for locale-sensitive text segmentation to split a string into words, sentences, or graphemes. Browser Support 87 87 125 14.1 [Source](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/Segmenter) Many non-Latin languages, such as Chinese and Japanese, don't use spaces to separate words. Therefore, using the JavaScript `split()` method on whitespace to split text into words, will return incorrect results. When creating a new `Intl.Segmenter` object with the [`Intl.segmenter()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/Segmenter) constructor, pass in a `locale` and options including `granularity`, which can have values of `"grapheme"`, `"word"`, or `"sentence"`. The following example creates a new `Intl.Segmenter` object for Japanese, splitting on words. `const segmenter = new Intl.Segmenter('ja-JP', { granularity: 'word' });` Calling the [`segment()`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter/segment) method on an `Intl.Segmenter` object with a string of text returns an iterable: `const segments = segmenter.segment(str); console.table(Array.from(segments));` Read [Using the Intl.Segmenter API](https://polypane.app/blog/using-the-intl-segmenter-api/) on the Polypane blog for an excellent tutorial on how to use this feature. [International Text Segmentation with Intl.Segmenter in JavaScript](https://javascript.plainenglish.io/international-text-segmentation-with-intl-segmenter-in-javascript-639eb1865263) has more examples, including how to use `Intl.Segmenter` with emoji. Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its affiliates. Last updated 2024-04-18 UTC.