Sha256: a552606ff617b820cd8018a2c9e9d2c66ccb65d01d6cc70e9e0a3834efda7c1f

Contents?: true

Size: 1.84 KB

Versions: 23

Compression:

Stored size: 1.84 KB

Contents

# encoding: UTF-8
grammar ScientificNameCanonical
  include ScientificNameDirty

  rule root
    multinomial_with_garbage {
      def hybrid
        false
      end

      def details
        [super]
      end

      def parser_run
        3
      end
    }
    /
    uninomial_with_garbage {
      def hybrid
        false
      end
      
      def details
        [super]
      end

      def parser_run
        3
      end
    }
  end
  
  rule multinomial_with_garbage
  
    a:genus space b:infragenus space c:species garbage {
      def value
        a.value + " " + b.value + " " + c.value
      end
      
      def canonical
        a.canonical + " " + c.canonical
      end
      
      def pos
        a.pos.merge(b.pos).merge(c.pos)
      end
      
      def details
        a.details.merge(b.details).merge(c.details)
      end
    }
    /
    a:genus space b:infragenus garbage {
      def value
        a.value + " " + b.value
      end
      
      def canonical
        a.canonical
      end
      
      def pos
        a.pos.merge(b.pos)
      end
      
      def details
        a.details.merge(b.details)
      end
    }
    /
    a:genus space b:species garbage {
      def value
        a.value + " " + b.value
      end
      
      def canonical
        a.canonical + " " + b.canonical
      end
      
      def pos
        a.pos.merge(b.pos)
      end
      
      def details
        a.details.merge(b.details)
      end
    }
  end
  
  rule uninomial_with_garbage
    a:uninomial_string b:garbage {
      def value
        a.value
      end
      
      def canonical
        a.canonical
      end
      
      def pos
        a.pos
      end
      
      def details
        {:uninomial => a.details[:uninomial]}
      end
    }
  end
  
  rule garbage
    space "$$g@rbg3$$"
    /
    space (["',.]) space [^щ]*
    /
    space_hard [^ш]+
  end

end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
biodiversity19-3.1.5 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.5 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-3.1.4 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.4 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-3.1.3 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.3 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-3.1.2 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.2 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-3.1.1 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.1 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-3.1.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-3.0.1 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.0.1 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-3.0.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.0.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-2.1.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-2.0.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.2.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.1.3 lib/biodiversity/parser/scientific_name_canonical.treetop