Class: DictCommand

Inherits:
Thor
  • Object
show all
Defined in:
lib/kotoshu/cli.rb

Overview

Dictionary command class.

Examples:

kotoshu dict list
kotoshu dict info en-US

Instance Method Summary collapse

Instance Method Details

#info(type) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/kotoshu/cli.rb', line 25

def info(type)
  case type.to_sym
  when :unix_words
    puts "UnixWords Dictionary:"
    puts "  Reads from Unix system dictionary files"
    puts "  Default paths:"
    puts "    - /usr/share/dict/words"
    puts "    - /usr/share/dict/web2"
    puts "    - /usr/share/dict/american-english"
  when :plain_text
    puts "PlainText Dictionary:"
    puts "  Reads from plain text word lists"
    puts "  One word per line, # comments supported"
  when :custom
    puts "Custom Dictionary:"
    puts "  In-memory dictionary for user-defined words"
  when :hunspell
    puts "Hunspell Dictionary:"
    puts "  Reads Hunspell .dic and .aff files"
    puts "  Supports morphological affix rules"
  when :cspell
    puts "CSpell Dictionary:"
    puts "  Reads CSpell .txt or .trie files"
    puts "  Uses trie data structure for fast lookups"
  else
    puts "Unknown dictionary type: #{type}"
    puts "Run 'kotoshu dict list' for available types"
  end
end

#listObject



15
16
17
18
19
20
21
22
# File 'lib/kotoshu/cli.rb', line 15

def list
  puts "Available dictionary types:"
  puts "  - unix_words: Unix system dictionary"
  puts "  - plain_text: Plain text word list"
  puts "  - custom: Custom in-memory dictionary"
  puts "  - hunspell: Hunspell (.dic/.aff)"
  puts "  - cspell: CSpell (.txt/.trie)"
end