class Uwn::Api::Connect
Constants
- DEFAULT_PATH
Public Class Methods
new(options={})
click to toggle source
# File lib/uwn/api/connect.rb, line 17 def initialize options={} begin # setup plugin directory unless options.include? :plugins_path plugins_path = DEFAULT_PATH else plugins_path = options[:plugins_path] end f = java.io.File.new(plugins_path.to_s) # load uwn @uwn = UWN.new(f) rescue Exception => e # hide java verbose output raise e.message end end
Public Instance Methods
meaning(term, language)
click to toggle source
lookup meaning of term by name and language
# File lib/uwn/api/connect.rb, line 35 def meaning term, language meaning = Meaning.new connect: self, term: term, language: language # get meaning entities mes = @uwn.get_meaning_entities term, language # iterate entities while mes.has_next do # append statment to meaning object meaning.append_statement mes.next end meaning end
statements(object_string)
click to toggle source
get statements by direct uwn query
# File lib/uwn/api/connect.rb, line 48 def statements object_string ret = [] mes = @uwn.get(Entity.new(object_string)) while mes.has_next do ret << mes.next end ret end