# File lib/proiel/annotation_schema.rb, line 39 def primary_relations @relation_tags.select { |_, features| features.primary } end
class PROIEL::AnnotationSchema
A representation of the annotation schema found in the header of a PROIEL
XML file. This should not be confused with the PROIEL
XML schema, which is used for validating the XML in a PROIEL
XML file.
Attributes
Public Class Methods
new(xml_object)
click to toggle source
Creates a new annotation schema object.
# File lib/proiel/annotation_schema.rb, line 24 def initialize(xml_object) if xml_object @part_of_speech_tags = make_part_of_speech_tags(xml_object).freeze @relation_tags = make_relation_tags(xml_object).freeze @morphology_tags = make_morphology_tags(xml_object).freeze @information_status_tags = make_information_status_tags(xml_object).freeze else @part_of_speech_tags = {}.freeze @relation_tags = {}.freeze @morphology_tags = {}.freeze @information_status_tags = {}.freeze end end
Public Instance Methods
==(o)
click to toggle source
Tests for equality of two annotation schema objects.
@return [true,false]
# File lib/proiel/annotation_schema.rb, line 52 def ==(o) @part_of_speech_tags.sort_by(&:first) == o.part_of_speech_tags.sort_by(&:first) and @relation_tags.sort_by(&:first) == o.relation_tags.sort_by(&:first) end
primary_relations()
click to toggle source
@return [Hash<String,RelationTagDefinition>] definition of primary relation tags
secondary_relations()
click to toggle source
@return [Hash<String,RelationTagDefinition>] definition of secondary relation tags
# File lib/proiel/annotation_schema.rb, line 44 def secondary_relations @relation_tags.select { |_, features| features.secondary } end
Private Instance Methods
make_tag_hash(element) { |e| ... }
click to toggle source
# File lib/proiel/annotation_schema.rb, line 59 def make_tag_hash(element) element.values.map { |e| [e.tag, yield(e)] }.compact.to_h end