Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tatar.rb #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions lib/pragmatic_segmenter/languages/tatar.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# frozen_string_literal: true

module PragmaticSegmenter
module Languages
module Tatar
include Languages::Common

module Abbreviation
ABBREVIATIONS = Set.new(["биекл", "биол", "б.э", "б.э.к", "геогр", "геол", "е", "елл", "к", "кг", "км", "км²", "км³", "лат", "м", "м²", "м³", "мәс", "млн", "млрд", "мм", "обл", "окр", "пед", "см", "т", "тех", "тирәнл", "трлн", "һ.б", "хим", "экон", "эл"]).freeze
PREPOSITIVE_ABBREVIATIONS = [].freeze
NUMBER_ABBREVIATIONS = [].freeze
end

# This handles the case where a dot is used to denote and ordinal (5. Juni)
module Numbers
NumberPeriodSpaceRule = Rule.new(/(?<=\s[0-9]|\s([1-9][0-9]))\.(?=\s)/, '∯')

All = [
Common::Numbers::All,
NumberPeriodSpaceRule
]
end

class AbbreviationReplacer < AbbreviationReplacer
SENTENCE_STARTERS = [].freeze

private

def replace_period_of_abbr(txt, abbr)
txt.gsub!(/(?<=\s#{abbr.strip})\./, '∯')
txt.gsub!(/(?<=\A#{abbr.strip})\./, '∯')
txt.gsub!(/(?<=^#{abbr.strip})\./, '∯')
txt
end
end
end
end
end