Skip to content

Improve docs for sentence segmentation #86

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

Merged
merged 2 commits into from
Oct 5, 2020

Conversation

Yorwba
Copy link
Contributor

@Yorwba Yorwba commented Oct 4, 2020

It looks like the doc comments for unicode_sentences and split_sentence_bounds got mixed up. I swapped them so that each function is described correctly.

I also added examples illustrating the difference between the three functions for segmenting sentences.

Yorwba added 2 commits October 4, 2020 19:47
Seems like those two functions got mixed up when the documentation was
written.  `unicode_sentences` is the one that filters for alphanumeric
characters.
///
/// assert_eq!(&us1[..], b);
/// ```
fn unicode_sentences<'a>(&'a self) -> UnicodeSentences<'a>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some text explaining what this function does?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid I don't understand. Do you mean I should expand on

Returns an iterator over substrings of self separated on
UAX#29 sentence boundaries.

Here, "sentences" are just those substrings which, after splitting on
UAX#29 sentence boundaries, contain any alphanumeric characters. That is, the
substring must contain at least one character with the
Alphabetic
property, or with
General_Category=Number.

above the example?

(I'm wondering whether the way the diff is rendered might be confusing you.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, sorry, this was absolutely diff rendering stuff 😄

@Manishearth Manishearth merged commit d1ae69c into unicode-rs:master Oct 5, 2020
@Manishearth
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants