Skip to content

Instantly share code, notes, and snippets.

@kaiinui
Created May 30, 2014 12:43
Show Gist options
  • Save kaiinui/b760fc72c7d053b17280 to your computer and use it in GitHub Desktop.
Save kaiinui/b760fc72c7d053b17280 to your computer and use it in GitHub Desktop.
require 'yahoo_parse_api'
class YahooMA
def self.parse(sentence)
client.parse(sentence, param)
end
def self.nouns(sentence)
parse(sentence)["ResultSet"]["ma_result"]["word_list"]["word"].map {|a| a["surface"]}
end
def self.param
{
results: 'ma',
filter: '7|9'
}
end
def self.client
@client ||= YahooParseApi::Parse.new
end
end
@kaiinui
Copy link
Author

kaiinui commented May 30, 2014

[5] pry(main)> YahooMA.nouns("AirPortの無線ネットワークはどうやって設定しますか ")
["AirPort", "無線", "ネットワーク", "設定"]

Really smart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment