Sha256: 5866efe56eb782974c3eec5aabc2b728ee348a33c0d278770878cba5df334219

Contents?: true

Size: 1.85 KB

Versions: 50

Compression:

Stored size: 1.85 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 + " " + b.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 + " " + b.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 (["',.]) space [^щ]*
    /
    space_hard [^ш]+
  end

end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
biodiversity19-1.0.21 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.20 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.19 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.18 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.17 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.16 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.15 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.14 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.13 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.12 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.11 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-1.0.10 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.10 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-1.0.9 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.9 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-1.0.8 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.8 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.7 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity19-1.0.6 lib/biodiversity/parser/scientific_name_canonical.treetop
biodiversity-1.0.5 lib/biodiversity/parser/scientific_name_canonical.treetop