INNER CODE UNIT · Ruby
replace_prepositive_abbr
grobidOrg/grobid · grobid-home/sentence-segmentation/pragmatic_segmenter/abbreviation_replacer.rb:105
def replace_prepositive_abbr(txt, abbr)
txt.gsub!(/(?<=\s#{abbr.strip})\.(?=\s)|(?<=^#{abbr.strip})\.(?=\s)/, '∯')
txt.gsub!(/(?<=\s#{abbr.strip})\.(?=:\d+)|(?<=^#{abbr.strip})\.(?=:\d+)/, '∯')
txt
end
def replace_period_of_abbr(txt, abbr)
txt.gsub!(/(?<=\s#{abbr.strip})\.(?=((\.|\:|-|\?)|(\s([a-z]|I\s|I'm|I'll|\d|\())))|(?<=^#{abbr.strip})\.(?=((\.|\:|\?)|(\s([a-z]|I\s|I'm|I'll|\d))))/, '∯')
txt.gsub!(/(?<=\s#{abbr.strip})\.(?=,)|(?<=^#{abbr.strip})\.(?=,)/, '∯')
txt
end
def replace_possessive_abbreviations(txt)
txt.gsub!(@language::POSSESSIVE_ABBREVIATION_REGEX, '∯')
txt
end
end
end