bionomia / dwc_agent

Ruby gem to cleanse Darwin Core terms containing people names prior to passing to its dependent parser. Comes with a command-line utility.
MIT License
5 stars 1 forks source link

Expand family name when implicit in list #6

Closed dshorthouse closed 3 years ago

dshorthouse commented 5 years ago

Example: "M.R. and J.D. Shorthouse"

Currently parses as [#<Name given="M.R.">, #<Name family="Shorthouse" given="J.D.">] whereas it should be [#<Name family="Shorthouse" given="M.R.">, #<Name family="Shorthouse" given="J.D.">]

dshorthouse commented 4 years ago

From @mjy on Twitter

2.5.1 :016 > a = 'M.R. and J.D. Smith' => "M.R. and J.D. Smith" 2.5.1 :017 > b = a.gsub( /([A-Z].[A-Z].) (and) ([A-Z].[A-Z].) (.*)/ , "#{$1} #{$4} and #{$3} #{$4}") => "M.R. Smith and J.D. Smith"