module Spellchecker::Dictionaries::NgramList

Constants

MUTEX
PATH

Public Instance Methods

all() click to toggle source

@return [Hash<Array<String>, String>]

# File lib/spellchecker/dictionaries/ngram_list.rb, line 12
def all
  @all || MUTEX.synchronize do
    @all ||= CSV.parse(PATH.read).to_h.transform_keys(&:split)
  end
end
include?(list) click to toggle source

@param list [Array<String>] @return [Boolean]

# File lib/spellchecker/dictionaries/ngram_list.rb, line 20
def include?(list)
  !match(list).nil?
end
match(list) click to toggle source

@param list [Array<String>] @return [String]

# File lib/spellchecker/dictionaries/ngram_list.rb, line 26
def match(list)
  all[list]
end