Skip to content
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

Tokenization of 's #3

Open
kornelski opened this issue Mar 12, 2019 · 1 comment
Open

Tokenization of 's #3

kornelski opened this issue Mar 12, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@kornelski
Copy link
Contributor

The punctuation regex includes apostrophe, so it splits "foo's" as two separate phrases. I'm seeing "s something" in keywords.

I think it could be fixed by using less smart splitting:

    text.split(|c: char| match c {
                '.'| ',' | '!' | '?' | ':' | ';' | '(' | ')' | '{' | '}' => true,
                _ => false,
            }).filter(|s| !s.is_empty()).for_each(|s| {
                let mut phrase = Vec::new();
                s.split(|c:char| !c.is_alphanumeric() && c != '\'' && c != '’').filter(|s| !s.is_empty()).for_each(|word| {
                    let word = word.trim_matches(|c: char| !c.is_alphanumeric());
@yaa110
Copy link
Owner

yaa110 commented Mar 12, 2019

Please note that the library should be multilingual, e.g. ، and ؛ are punctuation characters in Persian. So, \p{P} is easier to be used for multilingual support. However, 's must be ignored as you mentioned.

@yaa110 yaa110 added the bug Something isn't working label Mar 12, 2019
likewhatevs added a commit to likewhatevs/rake-rs that referenced this issue Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants