Class: Zenra
- Inherits:
-
Object
- Object
- Zenra
- Defined in:
- lib/zenra.rb
Constant Summary collapse
- VERSION =
'0.1.0'
- @@app_id =
ENV['YAHOO_APPID']
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Zenra
constructor
A new instance of Zenra.
- #zenrize(sentence, opts = {}) ⇒ Object
Constructor Details
Class Method Details
.app_id ⇒ Object
13 14 15 |
# File 'lib/zenra.rb', line 13 def self.app_id @@app_id end |
.app_id=(app_id) ⇒ Object
17 18 19 |
# File 'lib/zenra.rb', line 17 def self.app_id= app_id @@app_id = app_id end |
Instance Method Details
#zenrize(sentence, opts = {}) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/zenra.rb', line 25 def zenrize sentence, opts = {} opts = { :pos => '動詞', :add => '全裸で' }.merge(opts) YahooApiDAService.new(Zenra.app_id, sentence).parsed_array.inject('') do |r, v| r += opts[:add] if v['POS'].eql? opts[:pos] r += v['Surface'] end end |