5

I have been running into the error

Error in checkForRemoteErrors(val) : 
  one node produced an error: arguments imply differing number of rows: 3, 0

when trying to use check_spelling in the qdap package. The provided numbers 3 and 0 relate to the data provided below but this is only a small sample of a much larger spell check string and the row numbers vary when I pass it larger strings for both the string to spell check and use as a dictionary. I've had occasional success when all of a sudden it starts to work but as soon as I try to repeat the process I run into the same error again.

I run into the same error when I use the check_spelling_interactive() function also.

My understanding is that both the words I want to use as a spell check and as a dictionary should be in character vectors.

I've updated my version of qdap. Running on Windows 7 64, R Studio Version 0.99.467, R Version 3.2.1.

Any help would be greatly appreciated please as I am losing hair over this and I don't have that much to spare.

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

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

check_spelling(spellcheckstring, dictionary = mydictionary)
CallumH
  • 751
  • 1
  • 7
  • 22
  • For one the dictionary is a single string, it needs those chopped up into words. I still don't understand what you're trying to do. – Tyler Rinker Nov 05 '15 at 02:17
  • 1
    Thnx Tyler for that pointer. I had it single words up until I created this example and have duly edited to single words. It's still giving me the same error though. What I am trying to do is pass a long string (though for this example I have reduced it down to just 3 words) to a custom dictionary in order that I can spell check and make corrections. As a quick exercise I just ran the function without pointing to my custom dictionary check_spelling(spellcheckstring) and it worked (presumably defaulting to a built in dictionary but that wont help me in my case). – CallumH Nov 05 '15 at 06:49
  • My actual list of words I would like to spell check runs into the thousands. Some subsets of it work while others don't. I have narrowed down on three words in the example 'spellcheckstring' that are throwing an error. This leads me to think that there is something funny going on with this string, however, from my comment above, when i remove my custom dictionary, it works, and make me think that 'mydictionary' is the cause. So I am confused. – CallumH Nov 05 '15 at 06:57
  • To add to my confusion... I just added an extra random word ('peter') to spellcheckstring [spellcheckstring = "universal motor vlb peter"] and it ran without problem with check_spelling(spellcheckstring, dictionary = mydictionary). – CallumH Nov 05 '15 at 07:14
  • I'll try to have a look this evening (10 hours from now) to see if I can spot what's happening. https://github.com/trinker/qdap/issues/217 – Tyler Rinker Nov 05 '15 at 12:26

1 Answers1

5

The dictionary is so small that when it is split up (https://github.com/trinker/qdapTRUE) there are no possible matches for that letter. Use assume.first.correct=FALSE:

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

Version 2.2.5 (dev version) automatically enforces assume.first.correct=FALSE if custom dictionary does not have at least one word beginning with all 26 letters of the alphabet.

Get the latest release of qdap

if (!require("pacman")) install.packages("pacman")
pacman::p_load_gh(
    "trinker/qdapDictionaries",
    "trinker/qdapRegex",
    "trinker/qdapTools",
    "trinker/qdap"
)
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
  • 1
    Thanks @Tyler. I increased my dictionary size and it is working. You are a star! BTW... I have been using qdap for a cpl of things and am very happy `mgsub()` also rocks!. I'll get onto pacman next. :) – CallumH Nov 06 '15 at 13:02