Sha256: b6185f5803c6e4bfd35806a998bc8fbf8ba0c20521b02721beef4d44fa5164c9

Contents?: true

Size: 884 Bytes

Versions: 2

Compression:

Stored size: 884 Bytes

Contents

# encoding: UTF-8
grammar ScientificNameCanonical
  include ScientificNameClean
  include ScientificNameDirty

  rule composite_scientific_name
    name_part_with_garbage
  end
    
  rule name_part_with_garbage
    a:species_name space b:[^ш]+ {
      def value 
        a.value
      end
      def canonical
        a.canonical
      end
      
      def pos
        a.pos
      end
      
      def details
        a.details.merge(:name_part_verbatim => a.text_value, :auth_part_verbatim => b.text_value)
      end
    }
    /
    a:name_part space b:[^ш]+ {
      def value 
        a.value
      end
      def canonical
        a.canonical
      end
      
      def pos
        a.pos
      end
      
      def details
        a.details.merge(:name_part_verbatim => a.text_value, :auth_part_verbatim => b.text_value)
      end
    }
  end
  
  rule garbage
    [.]*
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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