module Spellchecker::Dictionaries::TyposList
Constants
- MUTEX
- PATH
Public Instance Methods
all()
click to toggle source
@return [Hash<String, String>]
# File lib/spellchecker/dictionaries/typos_list.rb, line 12 def all @all || MUTEX.synchronize do @all ||= CSV.parse(PATH.read).to_h end end
include?(word)
click to toggle source
@param word [String] @return [Boolean]
# File lib/spellchecker/dictionaries/typos_list.rb, line 20 def include?(word) !match(word).nil? end
match(word)
click to toggle source
@param word [String] @return [String, nil]
# File lib/spellchecker/dictionaries/typos_list.rb, line 26 def match(word) all[Utils.replace_quote(word.to_s.downcase)] end
match_token(token)
click to toggle source
@param token [Spellchecker::Tokenizer::Token] @return [String, nil]
# File lib/spellchecker/dictionaries/typos_list.rb, line 32 def match_token(token) all[token.normalized] end