support for several Indic languages

This commit is contained in:
Barry Haddow 2019-11-08 14:56:58 +00:00
parent b1163966b1
commit 1037070026
14 changed files with 946 additions and 287 deletions

View File

@ -124,8 +124,15 @@ sub preprocess {
# Sentences can start with upper-case, numnbers, or Indic characters
my $sentence_start = "\\p{IsUpper}0-9";
$sentence_start .= "\\p{Block: Devanagari}\\p{Block: Devanagari_Extended}" if $language eq "hi";
$sentence_start .= "\\p{Block: Devanagari}\\p{Block: Devanagari_Extended}" if ($language eq "hi" || $language eq "mr");
$sentence_start .= "\\p{Block: Gujarati}" if $language eq "gu";
$sentence_start .= "\\p{Block: Bengali}" if ($language eq "asm" || $language eq "bn" || $language eq "mni");
$sentence_start .= "\\p{Block: Kannada}" if $language eq "kn";
$sentence_start .= "\\p{Block: Malayalam}" if $language eq "ml";
$sentence_start .= "\\p{Block: Oriya}" if $language eq "ory";
$sentence_start .= "\\p{Block: Gurmukhi}" if $language eq "pa";
$sentence_start .= "\\p{Block: Tamil}" if $language eq "ta";
$sentence_start .= "\\p{Block: Telugu}" if $language eq "te";
# we include danda and double danda (U+0964 and U+0965) as sentence split characters
@ -171,21 +178,6 @@ sub preprocess {
#$text =~ s/ +/ /g;
}
# Indic languages dealt with using regular rules above
# Hindi and Gujarati do not capitalise beginning of sentence characters.
# Also Hindi traditionally uses a danda as a sentence separator (U+0964)
#if ($language eq 'hi' || $language eq 'gu') {
# $text =~ s{
# ( (?: [\.\?!\x{0964}\x{0965}] | \.\.+ )
# [\'\"\x{201e}\x{bb}\(\[\¿\¡\p{IsPf}]*
# )
# \s+
# ( [\'\"\x{201e}\x{bb}\(\[\¿\¡\p{IsPi}]*
# [\p{Block: Devanagari_Extended}\p{Block: Gujarati}]
# )
# }{$1\n$2}gx;
#}
# Urdu support
# https://en.wikipedia.org/wiki/Urdu_alphabet#Encoding_Urdu_in_Unicode
if ($language eq 'ur') {

View File

@ -0,0 +1,65 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Dr
#others
#phonetics
# A
# B
ি
# C
ি
# D
ি
# E
# F
# G
ি
# H
# I
# J
# K
# L
# M
# N
# O
# P
ি
# Q
ি
# R
# S
# T
ি
# U
# V
ি
# W
# X
# Y
# Z
#consonants

View File

@ -0,0 +1,65 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Dr
#others
#phonetics
# A
# B
বি
# C
সি
# D
ডি
# E
# F
এফ
# G
জি
# H
এইচ
# I
আম
# J
জে
# K
কে
# L
এল
# M
এম
# N
এন
# O
হে
# P
পি
# Q
কিউ
# R
আর
# S
এস
# T
টি
# U
ইউ
# V
ভি
# W
ডব্লু
# X
এক্স
# Y
ওয়াই
# Z
জেড
#consonants

View File

@ -0,0 +1 @@
nonbreaking_prefix.fi

View File

@ -0,0 +1,105 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Rs
રૂ
# Dr
ડો
# Dr
ડૉ
# Mr
શ્રી
#others
#phonetics
# A
# B
બી
# C
સી
# D
ડી
# E
# F
એફ
# G
જી
# H
એચ
# I
આઈ
# J
જે
# K
કે
# L
એલ
# M
એમ
# N
એન
# O
# P
પી
# Q
ક્યૂ
# R
આર
# S
એસ
# T
ટી
# U
યુ
# V
વી
# W
ડબલ્યુ
# X
એક્સ
# Y
વાય
# Z
ઝેડ
#consonants

View File

@ -1,17 +1,22 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Dr
डॉ
# Rs
रु
# Dr
डॉ
# Dr
डा
# Mr
श्री
#others
टी.वी
टीवी
#phonetics
# A
# B
बी
# C
@ -22,9 +27,11 @@
# F
ऐफ
एफ
# G
जी
# H
ऐच
एच
# I
आइ
@ -34,10 +41,13 @@
के
# L
ऐल
एल
# M
ऐम
एम
# N
ऐन
एन
# O
# P
@ -47,6 +57,7 @@
# R
आर
# S
ऐस
एस
# T
टी
@ -58,8 +69,45 @@
डब्ल्यू
# X
ऐक्स
एक्स
# Y
वाय
वाई
# Z
ज़ैड
#consonants

View File

@ -0,0 +1,70 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Rs
ರೂ
# Dr
ಡಾ
# Mr
ಶ್ರೀ
#others
#phonetics
# A
# B
ಬಿ
# C
ಸಿ
# D
ಡಿ
# E
# F
ಎಫ್
# G
ಜಿ
# H
ಹೆಚ್
ಎಚ್‌
# I
# J
ಜೆ
# K
ಕೆ
# L
ಎಲ್
# M
ಎಂ
# N
ಎನ್
# O
# P
ಪಿ
# Q
ಕ್ಯೂ
# R
ಆರ್
# S
ಎಸ್
# T
ಟಿ
# U
ಯು
# V
ವಿ
# W
ಡಬ್ಲ್ಯೂ
# X
ಎಕ್ಸ್
# Y
ವೈ
# Z
ಜೆಡ್
#consonants

View File

@ -0,0 +1,67 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Dr
# Mr
ശ്ര
#others
#phonetics
# A
# B
ി
# C
ി
# D
ി
# E
# F
എഫ്
# G
ി
# H
എച്ച്
# I
# J
# K
# L
എൽ
# M
# N
എൻ
# O
# P
ി
# Q
ക്യൂ
# R
ആർ
# S
എസ്
# T
ി
# U
യു
# V
ി
# W
ഡബ്ല്യു
# X
എക്സ്
# Y
# Z
ഡ്
#consonants

View File

@ -0,0 +1,65 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Dr
দা
#others
#phonetics
# A
# B
বি
# C
সি
# D
ডি
# E
# F
এফ
# G
জি
# H
এইচ
# I
আম
# J
জে
# K
কে
# L
এল
# M
এম
# N
এন
# O
হে
# P
পি
# Q
কিউ
# R
আর
# S
এস
# T
টি
# U
ইউ
# V
ভি
# W
ডব্লু
# X
এক্স
# Y
ওয়াই
# Z
জেড
#consonants

View File

@ -0,0 +1,113 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Rs
रु
# Dr
डॉ
# Dr
डा
# Mr
श्री
#others
#phonetics
# A
# B
बी
# C
सी
# D
डी
# E
# F
ऐफ
एफ
# G
जी
# H
ऐच
एच
# I
आइ
# J
जे
# K
के
# L
ऐल
एल
# M
ऐम
एम
# N
ऐन
एन
# O
# P
पी
# Q
क्यू
# R
आर
# S
ऐस
एस
# T
टी
# U
यू
# V
वी
# W
डब्ल्यू
# X
ऐक्स
एक्स
# Y
वाय
वाई
# Z
ज़ैड
#consonants

View File

@ -0,0 +1,101 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Mr
ରୀ
#others
#phonetics
# A
# B
# C
# D
# E
# F
# G
# H
# I
# J
# K
# L
# M
# N
# O
# P
# Q
# R
# S
# T
# U
# V
# W
# X
# Y
# Z
#consonants

View File

@ -0,0 +1,102 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Dr
ਡਾ
# Dr
ਪ੍ਰੋ
# Mr
ਸ੍ਰੀ
#others
#phonetics
# A
# B
ਬੀ
# C
ਸੀ
# D
ਡੀ
# E
# F
ਐੱਫ
# G
ਜੀ
# H
ਐਚ
# I
ਆਈ
# J
ਜੇ
# K
ਕੇ
# L
ਐਲ
# M
ਐੱਮ
# N
ਐੱਨ
# O
# P
ਪੀ
# Q
ਕੀਓ
# R
ਆਰ
# S
ਐੱਸ
# T
ਟੀ
# U
ਯੂ
# V
ਵੀ
# W
ਡਬਲਿਊ
# X
ਐਕ੍ਸ
# Y
ਵਾਈ
# Z
ਜ਼ੈਡ
#consonants

View File

@ -1,276 +1,71 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#Special cases are included for prefixes that ONLY appear before 0-9 numbers.
#any single upper case letter followed by a period is not a sentence ender (excluding I occasionally, but we leave it in)
#usually upper case letters are initials in a name
கா
கி
கீ
கு
கூ
கெ
கே
கை
கொ
கோ
கௌ
க்
சா
சி
சீ
சு
சூ
செ
சே
சை
சொ
சோ
சௌ
ச்
டா
டி
டீ
டு
டூ
டெ
டே
டை
டொ
டோ
டௌ
ட்
தா
தி
தீ
து
தூ
தெ
தே
தை
தொ
தோ
தௌ
த்
பா
பி
பீ
பு
பூ
பெ
பே
பை
பொ
போ
பௌ
ப்
றா
றி
றீ
று
றூ
றெ
றே
றை
றொ
றோ
றௌ
ற்
யா
யி
யீ
யு
யூ
யெ
யே
யை
யொ
யோ
யௌ
ய்
#common exceptions
# Rs
ரா
ரி
ரீ
ரு
ரூ
ரெ
ரே
ரை
ரொ
ரோ
ரௌ
ர்
லா
லி
லீ
லு
லூ
லெ
லே
லை
லொ
லோ
லௌ
ல்
வா
வி
வீ
வு
வூ
வெ
வே
வை
வொ
வோ
வௌ
வ்
ளா
ளி
ளீ
ளு
ளூ
ளெ
ளே
ளை
ளொ
ளோ
ளௌ
ள்
ழா
ழி
ழீ
ழு
ழூ
ழெ
ழே
ழை
ழொ
ழோ
ழௌ
ழ்
ஙா
ஙி
ஙீ
ஙு
ஙூ
ஙெ
ஙே
ஙை
ஙொ
ஙோ
ஙௌ
ங்
ஞா
ஞி
ஞீ
ஞு
ஞூ
ஞெ
ஞே
ஞை
ஞொ
ஞோ
ஞௌ
ஞ்
ணா
ணி
ணீ
ணு
ணூ
ணெ
ணே
ணை
ணொ
ணோ
ணௌ
ண்
நா
நி
நீ
நு
நூ
நெ
நே
நை
நொ
நோ
நௌ
ந்
மா
மி
மீ
மு
மூ
மெ
மே
மை
மொ
மோ
மௌ
ம்
னா
னி
னீ
னு
னூ
னெ
னே
னை
னொ
னோ
னௌ
ன்
#List of titles. These are often followed by upper-case names, but do not indicate sentence breaks
# Rs
# Mr
திரு
திருமதி
வண
கௌரவ
#others
#misc - odd period-ending items that NEVER indicate breaks (p.m. does NOT fall into this category - it sometimes ends a sentence)
உ.ம்
#கா.ம்
#எ.ம்
#phonetics
# A
# B
பீ
# C
சீ
# D
டீ
# E
# F
எஃப்
# G
ஜீ
# H
எச்
ஹெச்
# I
# J
ஜே
ஜை
# K
கே
# L
எல்
# M
எம்
# N
என்
# O
# P
ப்பீ
# Q
கியூ
# R
ஆர்
# S
எஸ்
# T
ட்டீ
# U
யூ
# V
வீ
# W
டபிள்-யூ
# X
எக்ஸ்
# Y
வை
# Z
செட்
#consonants
#Numbers only. These should only induce breaks when followed by a numeric sequence
# add NUMERIC_ONLY after the word for this function
#This case is mostly for the english "No." which can either be a sentence of its own, or
#if followed by a number, a non-breaking prefix
No #NUMERIC_ONLY#
Nos
Art #NUMERIC_ONLY#
Nr
pp #NUMERIC_ONLY#

View File

@ -0,0 +1,70 @@
#Anything in this file, followed by a period (and an upper-case word), does NOT indicate an end-of-sentence marker.
#common exceptions
# Rs
# Rs
# Mr
శ్రీ
#others
#phonetics
# A
# B
బి
# C
సి
# D
డి
# E
# F
ఎఫ్
# G
జి
# H
హెచ్‌
# I
# J
జె
# K
కె
# L
ఎల్
# M
ఎం
ఎమ్
# N
ఎన్
# O
# P
పి
# Q
క్యూ
# R
ఆర్
# S
ఎస్
# T
టి
# U
యు
# V
వి
# W
డబ్ల్యూ
# X
ఎక్స్
# Y
వై
# Z
జెడ్
#consonants