INNER CODE UNIT · Ruby
next_word_start
grobidOrg/grobid · grobid-home/sentence-segmentation/pragmatic_segmenter/abbreviation_replacer.rb:39
next_word_start = /(?<=#{Regexp.escape(stripped)} ).{1}/
character_array = @text.scan(next_word_start)
abbrev_match.each_with_index do |am, index|
txt = scan_for_replacements(txt, am, index, character_array)
end
end
txt
end
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))