Class: Kuromoji::Commands
- Inherits:
-
Thor
- Object
- Thor
- Kuromoji::Commands
- Defined in:
- lib/kuromoji/commands.rb
Instance Method Summary collapse
- #all_features ⇒ Object
-
#initialize(args = [], options = {}, config = {}) ⇒ Commands
constructor
A new instance of Commands.
- #reading ⇒ Object
- #tokenize ⇒ Object
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ Commands
Returns a new instance of Commands.
13 14 15 16 17 |
# File 'lib/kuromoji/commands.rb', line 13 def initialize(args = [], = {}, config = {}) super(args, , config) @global_options = config[:shell].base. @core = Kuromoji::Core.new(@global_options[:user_dictionary]) end |
Instance Method Details
#all_features ⇒ Object
26 27 28 29 |
# File 'lib/kuromoji/commands.rb', line 26 def all_features sentence = STDIN.read puts Yajl::Encoder.encode(@core.tokenize(sentence)) end |
#reading ⇒ Object
32 33 34 35 |
# File 'lib/kuromoji/commands.rb', line 32 def reading sentence = STDIN.read puts Yajl::Encoder.encode(@core.reading(sentence)) end |
#tokenize ⇒ Object
20 21 22 23 |
# File 'lib/kuromoji/commands.rb', line 20 def tokenize sentence = STDIN.read puts Yajl::Encoder.encode(@core.tokenize_with_hash(sentence)) end |