INNER CODE UNIT · Ruby
scan_for_replacements
grobidOrg/grobid · grobid-home/sentence-segmentation/pragmatic_segmenter/abbreviation_replacer.rb:48
def scan_for_replacements(txt, am, index, character_array)
character = character_array[index]
prepositive = @language::Abbreviation::PREPOSITIVE_ABBREVIATIONS
number_abbr = @language::Abbreviation::NUMBER_ABBREVIATIONS
upper = /[[:upper:]]/.match(character.to_s)
if upper.nil? || prepositive.include?(Unicode::downcase(am.strip))
if prepositive.include?(Unicode::downcase(am.strip))
txt = replace_prepositive_abbr(txt, am)
elsif number_abbr.include?(Unicode::downcase(am.strip))
txt = replace_pre_number_abbr(txt, am)
else
txt = replace_period_of_abbr(txt, am)
end
end
txt
end
def replace_abbreviation_as_sentence_boundary(txt)