-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
allow users to load custom hmm model #92
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #92 +/- ##
==========================================
+ Coverage 86.41% 87.59% +1.17%
==========================================
Files 8 7 -1
Lines 1067 693 -374
==========================================
- Hits 922 607 -315
+ Misses 145 86 -59
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this is the best way to do it. How about making viterbi
a method of HmmModel
and let Jieba
own a HmmModel
?
struct Jieba {
hmm_model: Option<HmmModel>,
...
}
impl Jieba {
pub fn set_hmm_model(&mut self, hmm_model: HmmModel) -> &mut Self {
...
}
}
struct HmmModel {
...
}
impl HmmModel {
pub fn new(..) -> Self {
todo!()
}
}
#[cfg(feature = "default-hmm-model")]
impl Default for HmmModel {
fn default() -> HmmModel {
// load default hmm model
}
}
cedarwood = "0.4" | ||
ordered-float = { version = "3.0", optional = true } | ||
once_cell = "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no point in use both lazy_static
and once_cell
, please also replace lazy_static
with once_cell
@@ -30,17 +30,18 @@ required-features = ["tfidf", "textrank"] | |||
regex = "1.0" | |||
lazy_static = "1.0" | |||
phf = "0.11" | |||
hashbrown = { version = "0.12", default-features = false, features = ["inline-more"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would need a benchmark result to justify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if instead HMMModel should be a seprate struct and that Jieba's interface should be expanded to be
cut()
hmm_cut()
Will discussion back in #48
close #48