Sha256: aaf0fe4d048a198a42fe41936d450c10914e9483146ce43483113ad81d5fa51e

Contents?: true

Size: 1.76 KB

Versions: 19

Compression:

Stored size: 1.76 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

19 entries across 19 versions & 2 rubygems

Version Path
biodiversity-3.5.1 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.5.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.4.6 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.4.5 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.4.4 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.4.3 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.4.2 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.4.1 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.4.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.3.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.2.1 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.2.0 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.10 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.9 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.8 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-3.1.7 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.7 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-3.1.6 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-3.1.6 lib/biodiversity/parser/scientific_name_canonical.treetop