-
Notifications
You must be signed in to change notification settings - Fork 12
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
Customize the hyphenation bounds? #20
Comments
Although default values are indeed hard-coded, the hyphenation boundaries are a public field of the dictionary type and can be changed freely. I will add a note in the documentation to this effect. |
It doesn't seem to be working: let word = "hyphenation";
let mut en_us = Standard::from_path(Language::EnglishUS,
"en-us.standard.bincode").unwrap();
println!("{:?}", en_us.opportunities(word));
en_us.minima.0 = 3;
println!("{:?}", en_us.opportunities(word)); The output I'm getting is:
|
I can get close to the expected result ( en_us.opportunities_within(word, en_us.boundaries(word).unwrap()) which returns |
In fact it seems to occur only when a word has a known hyphenation: fn opportunities(&'h self, lowercase_word : &str) -> Vec<Self::Opportunity> {
match self.boundaries(lowercase_word) {
None => vec![],
Some(mins) => {
match self.exact(lowercase_word) {
None => self.opportunities_within(lowercase_word, mins),
Some(known) => known
}
}
}
} You can't just return |
The reason |
I have a vague recollection of deliberately skipping boundary checks for exceptions, but you are right: the current behavior is counter-intuitive at best and plainly broken at worst. I'll see if I can release an updated version over the weekend. |
I concur. |
Fixed in b5f526f. Exceptions now respect hyphenation boundaries. The old behavior can be replicated by manually calling the internal method |
The hyphenation bounds are currently hardcoded. Would it be possible to load the bounds from a file instead? For example, a file named
en-us.bnd.txt
with content2 3
would define the bounds for theEnglishUS
language.The text was updated successfully, but these errors were encountered: