lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.7.4 vs lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.7.5

- old
+ new

@@ -30,18 +30,23 @@ @extensions = @dwc.extensions.map { |e| [e, get_fields(e)] } @normalized_data = {} @synonyms = {} @parser = ParsleyStore.new(1,2) @name_strings = {} + @vernacular_name_strings = {} @error_names = [] @tree = {} end def add_name_string(name_string) @name_strings[name_string] = 1 unless @name_strings[name_string] end + def add_vernacular_name_string(name_string) + @vernacular_name_strings[name_string] = 1 unless @vernacular_name_strings[name_string] + end + def name_strings @name_strings.keys end def normalize(opts = {:with_canoical_names => true}) @@ -111,12 +116,10 @@ authorship = row[fields[:scientificnameauthorship]].to_s.strip end !(authorship.empty? || row[fields[:scientificname]].index(authorship)) end - - def ingest_core @normalized_data = {} raise RuntimeError, "Darwin Core core fields must contain taxon id and scientific name" unless (@core_fields[:id] && @core_fields[:scientificname]) @dwc.core.read do |rows| rows[1].each do |error| @@ -256,10 +259,10 @@ vernacular = VernacularNormalized.new( r[fields[:vernacularname]], language, locality) @normalized_data[r[fields[:id]]].vernacular_names << vernacular - add_name_string(vernacular.name) + add_vernacular_name_string(vernacular.name) end end end end