M lib/wordnet/constants.rb +51 -51
@@ 14,11 14,11 @@ module WordNet::Constants
# Synset syntactic-category names -> indicators
SYNTACTIC_CATEGORIES = {
- :noun => "n",
- :verb => "v",
- :adjective => "a",
- :adverb => "r",
- :other => "s",
+ noun: "n",
+ verb: "v",
+ adjective: "a",
+ adverb: "r",
+ other: "s",
}
# Syntactic-category indicators -> names
SYNTACTIC_SYMBOLS = SYNTACTIC_CATEGORIES.invert
@@ 34,29 34,29 @@ module WordNet::Constants
# Synset pointer typenames -> indicators
POINTER_TYPES = {
- :antonym => '!',
- :hypernym => '@',
- :entailment => '*',
- :hyponym => '~',
- :meronym => '%',
- :holonym => '#',
- :cause => '>',
- :verb_group => '$',
- :similar_to => '&',
- :participle => '<',
- :pertainym => '\\',
- :attribute => '=',
- :derived_from => '\\',
- :see_also => '^',
- :derivation => '+',
- :domain => ';',
- :member => '-',
+ antonym: '!',
+ hypernym: '@',
+ entailment: '*',
+ hyponym: '~',
+ meronym: '%',
+ holonym: '#',
+ cause: '>',
+ verb_group: '$',
+ similar_to: '&',
+ participle: '<',
+ pertainym: '\\',
+ attribute: '=',
+ derived_from: '\\',
+ see_also: '^',
+ derivation: '+',
+ domain: ';',
+ member: '-',
}
# Synset pointer indicator -> typename
POINTER_SYMBOLS = POINTER_TYPES.invert
- # Map the pointer types into their own symbols (eg., :verb_group => VerbGroup)
+ # Map the pointer types into their own symbols (eg., verb_group: VerbGroup)
POINTER_TYPES.each do |sym,val|
cname = sym.to_s.gsub( /(?:^|_)(.)/ ) { $1.upcase }
const_set( cname, val )
@@ 65,7 65,7 @@ module WordNet::Constants
# Hypernym synset pointer types
HYPERNYM_TYPES = {
nil => '@', # Install non-subtype methods, too
- :instance => '@i',
+ instance: '@i',
}
# Hypernym indicator -> type map
@@ 74,7 74,7 @@ module WordNet::Constants
# Hyponym synset pointer types
HYPONYM_TYPES = {
nil => '~', # Install non-subtype methods, too
- :instance => '~i',
+ instance: '~i',
}
# Hyponym indicator -> type map
@@ 82,13 82,13 @@ module WordNet::Constants
# Meronym synset pointer types
MERONYM_TYPES = {
- :member => '%m',
- :stuff => '%s',
- :portion => '%o',
- :component => '%p',
- :feature => '%f',
- :phase => '%a',
- :place => '%l',
+ member: '%m',
+ stuff: '%s',
+ portion: '%o',
+ component: '%p',
+ feature: '%f',
+ phase: '%a',
+ place: '%l',
}
# Meronym indicator -> type map
@@ 102,13 102,13 @@ module WordNet::Constants
# Holonym synset pointer types
HOLONYM_TYPES = {
- :member => '#m',
- :stuff => '#s',
- :portion => '#o',
- :component => '#p',
- :feature => '#f',
- :phase => '#a',
- :place => '#l',
+ member: '#m',
+ stuff: '#s',
+ portion: '#o',
+ component: '#p',
+ feature: '#f',
+ phase: '#a',
+ place: '#l',
}
# Holonym indicator -> type map
@@ 122,9 122,9 @@ module WordNet::Constants
# Domain synset pointer types
DOMAIN_TYPES = {
- :category => ';c',
- :region => ';r',
- :usage => ';u',
+ category: ';c',
+ region: ';r',
+ usage: ';u',
}
# Domain indicator -> type map
@@ 138,9 138,9 @@ module WordNet::Constants
# Member synset pointer types
MEMBER_TYPES = {
- :category => '-c',
- :region => '-r',
- :usage => '-u',
+ category: '-c',
+ region: '-r',
+ usage: '-u',
}
# Member indicator -> type map
@@ 154,12 154,12 @@ module WordNet::Constants
# Map of primary types to maps of their subtypes
POINTER_SUBTYPES = {
- :hyponym => HYPONYM_TYPES,
- :hypernym => HYPERNYM_TYPES,
- :meronym => MERONYM_TYPES,
- :holonym => HOLONYM_TYPES,
- :member => MEMBER_TYPES,
- :domain => DOMAIN_TYPES,
+ hyponym: HYPONYM_TYPES,
+ hypernym: HYPERNYM_TYPES,
+ meronym: MERONYM_TYPES,
+ holonym: HOLONYM_TYPES,
+ member: MEMBER_TYPES,
+ domain: DOMAIN_TYPES,
}
M lib/wordnet/lexicallink.rb +6 -6
@@ 14,16 14,16 @@ class WordNet::LexicalLink < WordNet::Mo
##
# The WordNet::Sense the link is pointing *from*.
many_to_one :origin,
- :class => :"WordNet::Sense",
- :key => :synset1id,
- :primary_key => :synsetid
+ class: 'WordNet::Sense',
+ key: :synset1id,
+ primary_key: :synsetid
##
# The WordNet::Synset the link is pointing *to*.
one_to_many :target,
- :class => :"WordNet::Synset",
- :key => :synsetid,
- :primary_key => :synset2id
+ class: 'WordNet::Synset',
+ key: :synsetid,
+ primary_key: :synset2id
######
M lib/wordnet/lexicon.rb +1 -1
@@ 279,7 279,7 @@ class WordNet::Lexicon
### definition using a LIKE query.
###
def lookup_synsets( word, *args )
- dataset = WordNet::Synset.filter( :words => WordNet::Word.filter(lemma: word.to_s) )
+ dataset = WordNet::Synset.filter( words: WordNet::Word.filter(lemma: word.to_s) )
self.log.debug "Looking up synsets for %p" % [ word.to_s ]
# Add filters to the dataset for each argument
M lib/wordnet/morph.rb +3 -3
@@ 36,9 36,9 @@ class WordNet::Morph < WordNet::Model( :
# "fk_morphmaps_morphid" FOREIGN KEY (morphid) REFERENCES morphs(morphid)
# "fk_morphmaps_wordid" FOREIGN KEY (wordid) REFERENCES words(wordid)
many_to_many :words,
- :join_table => :morphmaps,
- :right_key => :wordid,
- :left_key => :morphid
+ join_table: :morphmaps,
+ right_key: :wordid,
+ left_key: :morphid
### Return the stringified word; alias for #lemma.
M lib/wordnet/semanticlink.rb +7 -7
@@ 13,15 13,15 @@ class WordNet::SemanticLink < WordNet::M
set_primary_key [:synset1id, :synset2id, :linkid]
many_to_one :origin,
- :class => :"WordNet::Synset",
- :key => :synset1id,
- :primary_key => :synsetid
+ class: 'WordNet::Synset',
+ key: :synset1id,
+ primary_key: :synsetid
one_to_one :target,
- :class => :"WordNet::Synset",
- :key => :synsetid,
- :primary_key => :synset2id,
- :eager => :words
+ class: 'WordNet::Synset',
+ key: :synsetid,
+ primary_key: :synset2id,
+ eager: :words
######
M lib/wordnet/sense.rb +7 -7
@@ 12,19 12,19 @@ class WordNet::Sense < WordNet::Model( :
##
# The Synset this is a Sense for
- many_to_one :synset, :key => :synsetid
+ many_to_one :synset, key: :synsetid
##
# The Word this is a Sense for
- many_to_one :word, :key => :wordid
+ many_to_one :word, key: :wordid
##
# The lexical links between this sense and its related Synsets.
# Sense -> [ LexicalLinks ] -> [ Synsets ]
one_to_many :lexlinks,
- :class => :"WordNet::LexicalLink",
- :key => [ :synset1id, :word1id ],
- :primary_key => [ :synsetid, :wordid ]
+ class: 'WordNet::LexicalLink',
+ key: [ :synset1id, :word1id ],
+ primary_key: [ :synsetid, :wordid ]
### Generate a method that will return Synsets related by the given lexical pointer
@@ 37,8 37,8 @@ class WordNet::Sense < WordNet::Model( :
method_body = Proc.new do
linkinfo = WordNet::Synset.linktypes[ typekey ] or
raise ScriptError, "no such link type %p" % [ typekey ]
- ssids = self.lexlinks_dataset.filter( :linkid => linkinfo[:id] ).select( :synset2id )
- self.class.filter( :synsetid => ssids )
+ ssids = self.lexlinks_dataset.filter( linkid: linkinfo[:id] ).select( :synset2id )
+ self.class.filter( synsetid: ssids )
end
define_method( type, &method_body )
M lib/wordnet/sumoterm.rb +3 -3
@@ 69,9 69,9 @@ class WordNet::SumoTerm < WordNet::Model
##
# WordNet::Synsets that are related to this term
many_to_many :synsets,
- :join_table => :sumomaps,
- :left_key => :sumoid,
- :right_key => :synsetid
+ join_table: :sumomaps,
+ left_key: :sumoid,
+ right_key: :synsetid
end # class WordNet::SumoTerm
M lib/wordnet/synset.rb +21 -21
@@ 179,42 179,42 @@ class WordNet::Synset < WordNet::Model(
##
# The WordNet::Words associated with the receiver
many_to_many :words,
- :join_table => :senses,
- :left_key => :synsetid,
- :right_key => :wordid
+ join_table: :senses,
+ left_key: :synsetid,
+ right_key: :wordid
##
# The WordNet::Senses associated with the receiver
one_to_many :senses,
- :key => :synsetid,
- :primary_key => :synsetid
+ key: :synsetid,
+ primary_key: :synsetid
##
# The WordNet::SemanticLinks indicating a relationship with other
# WordNet::Synsets
one_to_many :semlinks,
- :class => :"WordNet::SemanticLink",
- :key => :synset1id,
- :primary_key => :synsetid,
- :eager => :target
+ class: 'WordNet::SemanticLink',
+ key: :synset1id,
+ primary_key: :synsetid,
+ eager: :target
##
# The WordNet::SemanticLinks pointing *to* this Synset
many_to_one :semlinks_to,
- :class => :"WordNet::SemanticLink",
- :key => :synsetid,
- :primary_key => :synset2id
+ class: 'WordNet::SemanticLink',
+ key: :synsetid,
+ primary_key: :synset2id
##
# Terms from the Suggested Upper Merged Ontology
many_to_many :sumo_terms,
- :join_table => :sumomaps,
- :left_key => :synsetid,
- :right_key => :sumoid
+ join_table: :sumomaps,
+ left_key: :synsetid,
+ right_key: :sumoid
#################################################################
@@ 331,10 331,10 @@ class WordNet::Synset < WordNet::Model(
def self::linktype_table
@linktype_table ||= self.db[:linktypes].inject({}) do |hash,row|
hash[ row[:linkid] ] = {
- :id => row[:linkid],
- :typename => row[:link],
- :type => row[:link].gsub( /\s+/, '_' ).to_sym,
- :recurses => row[:recurses] && row[:recurses] != 0,
+ id: row[:linkid],
+ typename: row[:link],
+ type: row[:link].gsub( /\s+/, '_' ).to_sym,
+ recurses: row[:recurses] && row[:recurses] != 0,
}
hash
end
@@ 401,9 401,9 @@ class WordNet::Synset < WordNet::Model(
typekey = SEMANTIC_TYPEKEYS[ type ]
linkinfo = self.class.linktypes[ typekey ] or
raise ArgumentError, "no such link type %p" % [ typekey ]
- ssids = self.semlinks_dataset.filter( :linkid => linkinfo[:id] ).select( :synset2id )
+ ssids = self.semlinks_dataset.filter( linkid: linkinfo[:id] ).select( :synset2id )
- return self.class.filter( :synsetid => ssids )
+ return self.class.filter( synsetid: ssids )
end
M lib/wordnet/word.rb +8 -8
@@ 66,22 66,22 @@ class WordNet::Word < WordNet::Model( :w
##
# The WordNet::Sense objects that relate the word with its Synsets
one_to_many :senses,
- :key => :wordid,
- :primary_key => :wordid
+ key: :wordid,
+ primary_key: :wordid
##
# The WordNet::Synsets related to the word via its senses
many_to_many :synsets,
- :join_table => :senses,
- :left_key => :wordid,
- :right_key => :synsetid
+ join_table: :senses,
+ left_key: :wordid,
+ right_key: :synsetid
##
# The WordNet::Morphs related to the word
many_to_many :morphs,
- :join_table => :morphmaps,
- :left_key => :wordid,
- :right_key => :morphid
+ join_table: :morphmaps,
+ left_key: :wordid,
+ right_key: :morphid
#