-
Notifications
You must be signed in to change notification settings - Fork 65
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
don't remove existing hyphens when use.hyphening
#311
Comments
Good catch, thanks! I'd be open to this, good idea, but not sure if that works: > koRpus::hyphen('foobar and foo self-explanatory ok', hyph.pattern = 'en.us', rm.hyph = TRUE)@hyphen[1, 2]
Hyphenation (language: en.us)
[1] "foo-bar an-d f-oo s-el-fexpl-an-atory ok"
> koRpus::hyphen('foobar and foo self-explanatory ok', hyph.pattern = 'en.us', rm.hyph = FALSE)@hyphen[1, 2]
Hyphenation (language: en.us)
[1] "foo-bar an-d f-oo s-el-fexpl-an-atory ok" Any ideas? |
Well, I'm not familiar at all with the koRpus package, but maybe I was wrong with the assumption that the parameter Anyway, as far as I understand it, the Consider this modification of your first example: suppressPackageStartupMessages({
library(dplyr)
library(magrittr)
library(stringr)
})
"foobar and foo self-explanatory ok" %>% str_split(pattern = " ") %>% unlist() %>%
koRpus::hyphen(hyph.pattern = "en.us", rm.hyph = TRUE, quiet = TRUE) %>%
slot("hyphen") %$% word
#> [1] "foo-bar" "and" "foo"
#> [4] "self-ex-plana-to-ry" "ok" Now interestingly, if suppressPackageStartupMessages({
library(dplyr)
library(magrittr)
library(stringr)
})
"foobar and foo self-explanatory ok" %>% str_split(pattern = " ") %>% unlist() %>%
koRpus::hyphen(hyph.pattern = "en.us", rm.hyph = FALSE, quiet = TRUE) %>%
slot("hyphen") %$% word
#> [1] "foo-bar" "and" "foo"
#> [4] "self-e-xplan-at-ory" "ok" So it might have it's reason that the default value is Do I get it right that you're currently feeding whole sentences to the |
Consider the following reprex:
In the output table the hyphen of the word self-explanatory gets removed (because the parameter
rm.hyph
ofkoRpus::hyphen()
is left at it's default value ofTRUE
).I'm not familiar with the code and therefore didn't submit a pull request (yet). But I guess it would be enough to add the argument
rm.hyph = FALSE
to the following line ofhelpers.R
:pander/R/helpers.R
Line 404 in 32e0f75
What do you think? Alternatively, if you see any benefit/use case in having the hyphenator removing existing hyphens beforehand (I don't), an additional parameter could be introduced which passes the the option on to
koRpus::hyphen
.The text was updated successfully, but these errors were encountered: