Class: PROIEL::AnnotationSchema
- Inherits:
-
Object
- Object
- PROIEL::AnnotationSchema
- Defined in:
- lib/proiel/annotation_schema.rb
Overview
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.
Instance Attribute Summary collapse
-
#information_status_tags ⇒ Hash<String,InformationStatusTagDefinition>
readonly
Definition of information status tags.
-
#morphology_tags ⇒ Hash<Symbol,Hash<String,MorphologyFieldTagDefinition>>
readonly
Definition of morphology tags.
-
#part_of_speech_tags ⇒ Hash<String,PartOfSpeechTagDefinition>
readonly
Definition of part of speech tags.
-
#relation_tags ⇒ Hash<String,RelationTagDefinition>
readonly
Definition of relation tags.
Instance Method Summary collapse
-
#==(o) ⇒ true, false
Tests for equality of two annotation schema objects.
-
#initialize(xml_object) ⇒ AnnotationSchema
constructor
Creates a new annotation schema object.
-
#primary_relations ⇒ Hash<String,RelationTagDefinition>
Definition of primary relation tags.
-
#secondary_relations ⇒ Hash<String,RelationTagDefinition>
Definition of secondary relation tags.
Constructor Details
#initialize(xml_object) ⇒ AnnotationSchema
Creates a new annotation schema object.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/proiel/annotation_schema.rb', line 24 def initialize(xml_object) if xml_object @part_of_speech_tags = (xml_object).freeze @relation_tags = (xml_object).freeze @morphology_tags = (xml_object).freeze @information_status_tags = (xml_object).freeze else @part_of_speech_tags = {}.freeze @relation_tags = {}.freeze @morphology_tags = {}.freeze @information_status_tags = {}.freeze end end |
Instance Attribute Details
#information_status_tags ⇒ Hash<String,InformationStatusTagDefinition> (readonly)
Returns definition of information status tags.
21 22 23 |
# File 'lib/proiel/annotation_schema.rb', line 21 def @information_status_tags end |
#morphology_tags ⇒ Hash<Symbol,Hash<String,MorphologyFieldTagDefinition>> (readonly)
Returns definition of morphology tags.
18 19 20 |
# File 'lib/proiel/annotation_schema.rb', line 18 def @morphology_tags end |
#part_of_speech_tags ⇒ Hash<String,PartOfSpeechTagDefinition> (readonly)
Returns definition of part of speech tags.
12 13 14 |
# File 'lib/proiel/annotation_schema.rb', line 12 def @part_of_speech_tags end |
#relation_tags ⇒ Hash<String,RelationTagDefinition> (readonly)
Returns definition of relation tags.
15 16 17 |
# File 'lib/proiel/annotation_schema.rb', line 15 def @relation_tags end |
Instance Method Details
#==(o) ⇒ true, false
Tests for equality of two annotation schema objects.
52 53 54 55 |
# File 'lib/proiel/annotation_schema.rb', line 52 def ==(o) @part_of_speech_tags.sort_by(&:first) == o..sort_by(&:first) and @relation_tags.sort_by(&:first) == o..sort_by(&:first) end |
#primary_relations ⇒ Hash<String,RelationTagDefinition>
Returns definition of primary relation tags.
39 40 41 |
# File 'lib/proiel/annotation_schema.rb', line 39 def primary_relations @relation_tags.select { |_, features| features.primary } end |
#secondary_relations ⇒ Hash<String,RelationTagDefinition>
Returns definition of secondary relation tags.
44 45 46 |
# File 'lib/proiel/annotation_schema.rb', line 44 def secondary_relations @relation_tags.select { |_, features| features.secondary } end |