stevecondylios / dictionaRy

An R interface to the English Dictionary
Other
6 stars 0 forks source link

cannot access some word #6

Closed jaromilfrossard closed 2 years ago

jaromilfrossard commented 2 years ago

Hello! Thanks for creating this API!

I tried it using a few words and it seems that the define() function cannot access all words.

For instance when I ran:

define("pull out")

I get the following error: Error in rbind(deparse.level, ...) : numbers of columns of arguments do not match

However, the file for "pull out" exists in the API as I was able to visit the following url

https://api.dictionaryapi.dev/api/v2/entries/en/pull%20out

(I try with both the version in CRAN and from github).

Thanks,

Jaromil

stevecondylios commented 2 years ago

Thanks a lot for this. Occasionally an API response contains NULL in a field, although I hadn't encountered a word with NULL in the part_of_speech field, well, until today.

I made some changes to define() (in befcecbde8e61e0add2bcc3c2a035a8d3c5ce1fb and 7a37b1bf6bba099043732f0f8aec7db4981ddb2d) so it now handles for that case.

Thanks again for this, and please use the development version (from GitHub) as it may take some time before the change reaches CRAN.

devtools::install_github("stevecondylios/dictionaRy")
library(dictionaRy)

define("pull out")
# # A tibble: 5 × 11
#   original word     meaning_number part_of_speech phonetic audio                                             origin definition example synonyms antonyms
#   <chr>    <chr>             <int> <chr>          <chr>    <chr>                                             <lgl>  <chr>      <chr>   <I<list> <I<list>
# 1 pull out pull out              1 NA             NA       NA                                                NA     (of a veh… as he … <chr>    <chr>   
# 2 pull out pull out              1 NA             NA       NA                                                NA     withdraw … he was… <chr>    <chr>   
# 3 pull out pull-out              2 adjective      ˈpʊlaʊt  https://ssl.gstatic.com/dictionary/static/sounds… NA     (of a sec… the fi… <chr>    <chr>   
# 4 pull out pull-out              2 noun           ˈpʊlaʊt  https://ssl.gstatic.com/dictionary/static/sounds… NA     a pull-ou… don't … <chr>    <chr>   
# 5 pull out pull-out              2 noun           ˈpʊlaʊt  https://ssl.gstatic.com/dictionary/static/sounds… NA     a withdra… the pe… <chr>    <chr>