New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convenience API suggestion: return an array #1
Comments
|
The main API in the readme returns an iterator. The point of this convenience API is for when you know you need all the results. |
Apologies; I had somehow interpreted your suggestion as “an array of strings: one for each segment”. |
I guess I was ambiguous. Now that you mention it, as a convenience API, that sounds better to me. |
#4 is similar. |
If we want something like this, maybe it should be a method on a Segmenter instance, e.g.,
What should be the output exactly? Would you want just the words in this case, ignoring the whitespace and punctuation segments? |
Yeah, just the words is what I was assuming. A static method feels more convenient than newing up a new object, but I guess Intl has not gone with that style so far. |
Closing since it doesn't fit with the style of Intl. |
E.g.
Intl.Segmenter.segments("string", "fr", { type: "word" })
The text was updated successfully, but these errors were encountered: