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

Handling a vector of dictionaries in get_dict #37

Closed
wants to merge 1 commit into from
Closed

Handling a vector of dictionaries in get_dict #37

wants to merge 1 commit into from

Conversation

meztez
Copy link

@meztez meztez commented Dec 21, 2018

In get_dict :

  • modified file.exists condition check to avoid length > 1 warning
  • modified find_in_dicpath call to handle multiple unfound dict

In get_dict : 
- modified file.exists condition check to avoid length > 1 warning
- modified find_in_dicpath call to handle multiple unfound dict
@codecov-io
Copy link

codecov-io commented Dec 21, 2018

Codecov Report

Merging #37 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #37      +/-   ##
==========================================
+ Coverage   39.81%   39.82%   +<.01%     
==========================================
  Files          28       28              
  Lines        8359     8360       +1     
==========================================
+ Hits         3328     3329       +1     
  Misses       5031     5031
Impacted Files Coverage Δ
R/hunspell.R 81.81% <100%> (+0.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50e57e6...da358a9. Read the comment docs.

@jeroen
Copy link
Member

jeroen commented Dec 21, 2018

Can you include example code of how you use this?

@meztez
Copy link
Author

meztez commented Dec 21, 2018

I use the code below

library(hunspell)
library(curl)

extractdict <- function(url) {
  temp <- tempfile()
  curl_download(url, temp)
  dicts <- grep("\\.aff?|\\.dic?", unzip(temp, list = TRUE)$Name, value = TRUE)
  unzip(temp, files = dicts, overwrite = TRUE, junkpaths = TRUE, exdir = "dict")
  unlink(temp)
  return(paste0("./dict/", basename(grep("\\.dic", dicts, value = TRUE))))
}

dict_fr <- extractdict("https://addons.mozilla.org/firefox/downloads/file/1163947/french_spelling_dictionary-6.3.1webext.xpi")
dict_en <- extractdict("https://addons.mozilla.org/firefox/downloads/file/1163920/canadian_english_dictionary-3.0.6.1webext.xpi")

sc <- hunspell("some text", dict = c(dict_fr, dict_en))

Other test I've made and why I used sapply

get_dict(c(dict_fr, dict_en, "en_US", "poison.dic"))

@meztez
Copy link
Author

meztez commented May 12, 2019

Don't merge yet, it works but the input from print(dict) looks like garbage. Sorry

@meztez
Copy link
Author

meztez commented May 13, 2019

I'm closing it, it is causing a bunch of weird behaviors mostly for the affix part. This is not ready.

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.

None yet

3 participants