lib/yard/spellcheck/checker.rb
#
# Spellchecks a piece of text.
#
# @param [String] text
#   The text to spellcheck.
#
# @param [FFI::Hunspell::Dictionary] dict
#   The dictionary to use.
#
# @return [Set<String>]
#   The misspelled words from the text.
#
Spellchecks a piece of text.
Spellchecks a piece of text .
def spellcheck(text,dict)
        typos = Set[]
        text.each_line do |line|
          next if line =~ /^\s{2,}/
          line.scan(WORD_REGEXP).each do |word|
            next if word.include?('_')
            next if (word =~ ACRONYM_REGEXP || word =~ CAMEL_CASE_REGEXP)
            next if @ignore.include?(word)
            if (@misspelled.has_key?(word) || !dict.valid?(word))
              @misspelled[word] += 1
              typos << word
            end
          end
        end
        return typos
      end
def spellcheck ( text , dict ) typos = Set [ ] text . each_line do | line | next if line =~ / ^ \s {2,} / line . scan ( WORD_REGEXP ) . each do | word | next if word . include? ( '_' ) next if ( word =~ ACRONYM_REGEXP || word =~ CAMEL_CASE_REGEXP ) next if @ignore . include? ( word ) if ( @misspelled . has_key? ( word ) || ! dict . valid? ( word ) ) @misspelled [ word ] += 1 typos << word end end end return typos end
Spellchecks a piece of text.
Spellchecks a piece of text .
# ignore indented lines # ignore all underscored names # ignore all acronyms and CamelCase words # skip ignored words
The misspelled words from the text.
The misspelled words from the text .
Set<String>
text
dict
dict The dictionary to use.
dict The dictionary to use .