trinker / qdap

Quantitative Discourse Analysis Package: Bridging the gap between qualitative data and quantitative analysis
http://cran.us.r-project.org/web/packages/qdap/index.html
175 stars 44 forks source link

Potential bug in check_spelling #217

Closed trinker closed 9 years ago

trinker commented 9 years ago

Per this SO post: http://stackoverflow.com/q/33516466/1000343

Check the following:

library(qdap)
spellcheckstring = c("universal motor vlb", "end")
mydictionary = c("brake", "starter", "shock", "pad", "kit", "bore", "toyota", 
    "ford", "pump", "nissan", "gas", "alternator", "switch", "motor")

class(spellcheckstring) # character
class(mydictionary) # character

check_spelling(spellcheckstring, dictionary = mydictionary, parallel=F)

Throws:

Error in data.frame(word.no = names(misses), not.found = misses, suggestion = unlist(lapply(replacements,  : 
  arguments imply differing number of rows: 2, 0
trinker commented 9 years ago

The dictionary is so small that when it is split up there are no possible matches for that letter:

check_spelling(spellcheckstring, dictionary = mydictionary, assume.first.correct=FALSE)

Leaving open as safety handling should be built in and defaults to: assume.first.correct=FALSE if not all 26 letters are available.