Sha256: 0dff6d7169fe37e44b8c6f643cc77f16b31267445f30227c50b5ab19e0903c53

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

grammar ScientificNameDirty
  include ScientificNameClean
 
  rule composite_scientific_name
    super
  end
  
# rule original_authors_names_full
# super
# end
#
# rule incorrect_original_authors_names
# "[" space a:authors_names_full space "]" {
# def value
# "(" + a.value + ")"
# end
# def details
# {:orig_authors => a.details[:authors]}
# end
# }
# end
  
  rule year
    a:[\d]+ space b:approximate_year {
      def value
        a.text_value + " " + b.text_value
      end
      def pos
        {a.interval.begin => ['year', a.interval.end]}.merge(b.pos)
      end
      def details
        {:ambiguous_year => value}
      end
    }
    /
    a:[\d]+ page_number
    {
      def value
        a.text_value
      end
      
      def pos
        {a.interval.begin => ['year', a.interval.end]}
      end
      
      def details
        {:year => value}
      end
    }
    /
    double_year
    /
    approximate_year
    /
    super
  end
  
  rule approximate_year
    "[" space a:([\d] [\d] [\d] [\d\?]+) space "]"+ {
      def value
       "(" + a.text_value + ")"
      end
      
      def pos
        {a.interval.begin => ['year', a.interval.end]}
      end
      
      def details
        {:approximate_year => value}
      end
    }
  end
  
  rule double_year
    [0-9] [0-9A-Za-z\?\-]+ {
      def value
        text_value
      end
      
      def pos
        {interval.begin => ['year', interval.end]}
      end
      
      def details
        {:year => value}
      end
    }
  end
  
  rule page_number
    ":" space [\d]+
    {
      def value
      end
    }
  end
   
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dimus-biodiversity-0.0.15 lib/biodiversity/parser/scientific_name_dirty.treetop
dimus-biodiversity-0.0.16 lib/biodiversity/parser/scientific_name_dirty.treetop
dimus-biodiversity-0.0.18 lib/biodiversity/parser/scientific_name_dirty.treetop