class LLT::Review::Treebank::Postag
Constants
- CONTAINER_TABLE
- PLURALIZED_POSTAG_SCHEMA
- POSTAG_SCHEMA
All these constants cannot stay. Hardcoding the meaning of every postag datapoint is a no-go.
Attributes
id[R]
Public Class Methods
new(postag)
click to toggle source
# File lib/llt/review/treebank/postag.rb, line 6 def initialize(postag) @id = :postag @postag = new_postag(postag) end
Public Instance Methods
add_datapoints_container(data)
click to toggle source
# File lib/llt/review/treebank/postag.rb, line 56 def add_datapoints_container(data) CONTAINER_TABLE.each do |pl, sg| data.add(Report::Generic.new(pl, 0, sg)) end end
analysis()
click to toggle source
# File lib/llt/review/treebank/postag.rb, line 40 def analysis @analysis ||= begin Hash[POSTAG_SCHEMA.zip(@postag.each_char)] end end
datapoints()
click to toggle source
# File lib/llt/review/treebank/postag.rb, line 46 def datapoints POSTAG_SCHEMA.size end
new_postag(postag)
click to toggle source
# File lib/llt/review/treebank/postag.rb, line 62 def new_postag(postag) if !postag || postag.empty? || postag == '-' '-' * POSTAG_SCHEMA.length else postag end end
report()
click to toggle source
A little violating… move this to Datapoints
# File lib/llt/review/treebank/postag.rb, line 16 def report @report ||= begin # Questionable what the total numbers of datapoints should be. data = Report::Datapoints.new(@postag.size) add_datapoints_container(data) data.each_with_index do |(_, container), i| rtr = container.reports_to_request val = @postag[i] container.add(Report::Postag::Datapoint.new(rtr, val)) container.increment end data end end
to_s()
click to toggle source
# File lib/llt/review/treebank/postag.rb, line 11 def to_s @postag end