Frame elements of a FrameNet::Frame
References: - framenet.icsi.berkeley.edu/fndrupal/glossary#frame-element
The xpath of the FEs of a frame
The Element's abbreviation
The Element's background color when displayed in a visual medium
The Element's background color when displayed in a visual medium
The Element's background color when displayed in a visual medium
The Element's creation time as a Time object
The Element's creation time as a Time object
The Element's core type
The Element's core type
The Element's creation time as a Time object
The FrameNet::Definition associated with this Element (if one exists)
The Element's foreground color when displayed in a visual medium
The Element's foreground color when displayed in a visual medium
The Element's foreground color when displayed in a visual medium
The Element's id
The Element's name
The FrameNet::SemanticType associated with this Element (if one exists)
Construct an Element from the given
node
(a LibXML::XML::Node).
# File lib/frame_net/frame/element.rb, line 25
def self::from_fe_node( node )
return new do |elem|
elem.id = Integer( node['ID'] )
elem.name = node['name'].to_sym
elem.core_type = node['coreType']
elem.abbrev = node['abbrev']
elem.creation_time = FrameNet.parse_time( node['cDate'] )
elem.foreground_color = node['fgColor']
elem.background_color = node['bgColor']
if def_node = node.find_first( './fn:definition' )
elem.definition = FrameNet::Definition.from_node( def_node )
end
if st_node = node.find_first( './fn:semType' )
elem.semantic_type = FrameNet::SemanticType.from_node( st_node )
end
end
end
Construct one or more Elements from the FEs of the specified
doc
(a LibXML::XML::Document parsed from
the XML for a frame)
# File lib/frame_net/frame/element.rb, line 19
def self::from_frame_data( doc )
return doc.find( XPATH ).map {|node| self.from_fe_node(node) }
end
Create a new frame Element. If a block is given, yield the new object to it so its attributes can be set.
# File lib/frame_net/frame/element.rb, line 48
def initialize # :yields: self
@id = id
@name = name
@core_type = core_type
@abbrev = nil
@creation_time = nil
@foreground_color = nil
@background_color = nil
@definition = nil
@semantic_type = nil
yield( self ) if block_given?
end
Return the Element as a human-readable string suitable for debugging.
# File lib/frame_net/frame/element.rb, line 114
def inspect
return %Q{#<%p:%#016x %s%s(%s) [%d] "%s">} % [
self.class,
self.object_id * 2,
self.name || "(Unnamed)",
self.semantic_type ? ":#{self.semantic_type.name}" : '',
self.core_type,
self.id || 0,
self.definition ? self.definition.stripped_content : '',
]
end