INNER CODE UNIT · Ruby
regex
grobidOrg/grobid · grobid-home/sentence-segmentation/pragmatic_segmenter/abbreviation_replacer.rb:84
regex = /(U∯S|U\.S|U∯K|E∯U|E\.U|U∯S∯A|U\.S\.A|I|i.v|I.V)∯(?=\s#{escaped}\s)/
txt.gsub!(regex, '\1.')
end
txt
end
def replace_multi_period_abbreviations(txt)
mpa = txt.scan(@language::MULTI_PERIOD_ABBREVIATION_REGEX)
return txt if mpa.empty?
mpa.each do |r|
txt.gsub!(/#{Regexp.escape(r)}/, "#{r.gsub!('.', '∯')}")
end
txt
end
def replace_pre_number_abbr(txt, abbr)
txt.gsub!(/(?<=\s#{abbr.strip})\.(?=\s\d)|(?<=^#{abbr.strip})\.(?=\s\d)/, '∯')
txt.gsub!(/(?<=\s#{abbr.strip})\.(?=\s+\()|(?<=^#{abbr.strip})\.(?=\s+\()/, '∯')