Module: Spellchecker::Dictionaries::EnglishWords
- Defined in:
- lib/spellchecker/dictionaries/english_words.rb
Constant Summary collapse
- PATH =
Dictionaries.path.join('english_words.txt')
- MUTEX =
Mutex.new
Class Method Summary collapse
Class Method Details
.all ⇒ Set<String>
13 14 15 16 17 |
# File 'lib/spellchecker/dictionaries/english_words.rb', line 13 def all @all || MUTEX.synchronize do @all ||= Set.new(PATH.read.split("\n")) end end |
.include?(word) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/spellchecker/dictionaries/english_words.rb', line 21 def include?(word) return false unless word all.include?(word.downcase) end |