Class: Treat::Config::Tags
- Inherits:
-
Object
- Object
- Treat::Config::Tags
- Defined in:
- lib/treat/config/tags.rb
Overview
Handles all configuration related to understanding of part of speech and phrasal tags.
Class Method Summary collapse
-
.align_tags(tags, tag_sets) ⇒ Object
Helper methods for tag set config.
-
.configure! ⇒ Object
Generate a map of word and phrase tags to their syntactic category, keyed by tag set.
Class Method Details
.align_tags(tags, tag_sets) ⇒ Object
Helper methods for tag set config. Align tag tags in the tag set
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/treat/config/tags.rb', line 24 def self.(, tag_sets) wttc = {} .each_slice(2) do |desc, | category = desc.gsub(',', ' ,'). split(' ')[0].downcase tag_sets.each_with_index do |tag_set, i| next unless [i] wttc[[i]] ||= {} wttc[[i]][tag_set] = category end end; return wttc end |
.configure! ⇒ Object
Generate a map of word and phrase tags to their syntactic category, keyed by tag set.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/treat/config/tags.rb', line 9 def self.configure! super config = self.config[:aligned].dup , , tag_sets = config[:word_tags], config[:phrase_tags] tag_sets = config[:tag_sets] config[:word_tags_to_category] = (, tag_sets) config[:phrase_tags_to_category] = (, tag_sets) self.config[:aligned] = config end |