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

Add tokenizer trait #48

Merged
merged 11 commits into from
May 3, 2019
Merged

Add tokenizer trait #48

merged 11 commits into from
May 3, 2019

Conversation

rth
Copy link
Owner

@rth rth commented May 1, 2019

This makes it possible to use any object implementing the Tokenizer trait in Vectorizers,

    let tokenizer = VTextTokenizer::new("en");
    let vectorizer = CountVectorizer::new(&tokenizer);

@rth rth changed the title Add tokenizer trait with dynamic dispatch in vectorizers WIP Add tokenizer trait with dynamic dispatch in vectorizers May 1, 2019
@rth
Copy link
Owner Author

rth commented May 1, 2019

This also appears to need pyo3 0.7 (not yet released) to compile the python wrapper. Otherwise currently I get the following error,

error: #[pymethods] can not ve used with lifetime parameters or generics
  --> src/lib.rs:68:5
   |
68 | impl<'b> _HashingVectorizerWrapper<'b> {
   |     ^^^^

error: #[pymethods] can not ve used with lifetime parameters or generics
  --> src/lib.rs:93:5
   |
93 | impl<'b> _CountVectorizerWrapper<'b> {
   |     ^^^^

error[E0658]: The attribute `new` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
  --> src/lib.rs:69:7
   |
69 |     #[new]
   |       ^^^
   |
   = help: add #![feature(custom_attribute)] to the crate attributes to enable

@rth rth changed the title WIP Add tokenizer trait with dynamic dispatch in vectorizers Add tokenizer trait with dynamic dispatch in vectorizers May 1, 2019
@rth rth force-pushed the customize-tokenizer-vectorizer branch from 3d47c8c to 44021d7 Compare May 3, 2019 21:33
@rth rth changed the title Add tokenizer trait with dynamic dispatch in vectorizers Add tokenizer trait May 3, 2019
@rth
Copy link
Owner Author

rth commented May 3, 2019

Merging. This currently only contains the Tokenizer trait, changes to vectorizers will be added in a follow-up PRs due to issues with Pyo3.

@rth rth merged commit 268eca6 into master May 3, 2019
@rth rth deleted the customize-tokenizer-vectorizer branch May 5, 2019 18:11
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.

1 participant