lib/biodiversity/parser/scientific_name_clean.treetop in dimus-biodiversity-0.5.2 vs lib/biodiversity/parser/scientific_name_clean.treetop in dimus-biodiversity-0.5.3

- old
+ new

@@ -13,12 +13,16 @@ def pos a.pos end + def hybrid + a.hybrid + end + def details - a.details + a.details.class == Array ? a.details : [a.details] end } end rule scientific_name_5 @@ -32,11 +36,15 @@ end def pos a.pos.merge(c.pos) end - + + def hybrid + a.hybrid + end + def details a.details.merge(b.details(c)) end } / @@ -55,12 +63,16 @@ def pos a.pos.merge(b.pos) end + def hybrid + true + end + def details - {:hybridFormula => [a.details, b.details]} + [a.details, b.details] end } / a:scientific_name_1 space hybrid_character space [\?]? { def value @@ -73,12 +85,16 @@ def pos a.pos end + def hybrid + true + end + def details - {:hybridFormula => [a.details, "?"]} + [a.details, "?"] end } / scientific_name_3 end @@ -95,12 +111,16 @@ def pos b.pos end + def hybrid + true + end + def details - {:namedHybrid => b.details} + b.details end } / scientific_name_2 end @@ -117,10 +137,14 @@ def pos a.pos end + def hybrid + a.hybrid rescue false + end + def details a.details.merge(b.details) end } / @@ -172,10 +196,14 @@ end def pos a.pos.merge(b.pos).merge(c.pos).merge(d.pos) end + + def hybrid + c.hybrid rescue false + end def details a.details.merge(b.details).merge(c.details).merge(d.details) end } @@ -191,10 +219,14 @@ def pos a.pos.merge(b.pos).merge(c.pos) end + def hybrid + c.hybrid rescue false + end + def details a.details.merge(b.details).merge(c.details) end } / @@ -208,10 +240,14 @@ end def pos a.pos.merge(b.pos).merge(c.pos) end + + def hybrid + b.hybrid rescue false + end def details a.details.merge(b.details).merge(c.details) end } @@ -227,10 +263,14 @@ def pos a.pos.merge(b.pos) end + def hybrid + b.hybrid rescue false + end + def details a.details.merge(b.details) end } end @@ -254,11 +294,15 @@ b_array = b.details[:infraspecies].class == Array ? b.details[:infraspecies] : [b.details[:infraspecies]] a.details.merge({:infraspecies => a_array + b_array}) end } / - infraspecies + infraspecies { + def details + {:infraspecies => [super[:infraspecies]]} + end + } end rule infraspecies a:infraspecies_epitheton space b:authorship { def value @@ -382,10 +426,14 @@ def canonical a.canonical end + def hybrid + a.hybrid rescue false + end + def pos a.pos.merge(b.pos) end def details @@ -403,10 +451,14 @@ end def canonical a.value end + + def hybrid + a.hybrid rescue false + end def pos {a.interval.begin => ['species', a.interval.end]} end @@ -422,10 +474,14 @@ def pos {interval.begin => ['species', interval.end]} end + def hybrid + false + end + def details {:species => {:epitheton => value}} end } / @@ -484,10 +540,14 @@ def pos a.pos.merge(b.pos) end + def hybrid + false + end + def details {:uninomial => a.details[:uninomial].merge(b.details)} end } / @@ -502,10 +562,14 @@ def pos {interval.begin => ['uninomial', interval.end]} end + def hybrid + false + end + def details {:uninomial => {:epitheton => value}} end } end @@ -902,16 +966,20 @@ def canonical b.value end + def hybrid + true + end + def pos {b.interval.begin => ['species', b.interval.end]} end def details - {:species => {:epitheton => b.value, :namedHybrid => true}} + {:species => {:epitheton => b.value}} end } / a:"X" space b:species_word { def value @@ -920,16 +988,20 @@ def canonical b.value end + def hybrid + true + end + def pos {b.interval.begin => ['species', b.interval.end]} end def details - {:species => {:epitheton => b.value, :namedHybrid => true}} + {:species => {:epitheton => b.value}} end } / a:"x" space_hard b:species_word { def value @@ -938,15 +1010,19 @@ def canonical b.value end + def hybrid + true + end + def pos {b.interval.begin => ['species', b.interval.end]} end def details - {:species => {:epitheton => b.value, :namedHybrid => true}} + {:species => {:epitheton => b.value}} end } end rule species_prefix \ No newline at end of file