Skip to content

Commit 2e4bb46

Browse files
nciricgrhoten
andauthored
Adding support for sr-SR (#40)
Adding a new language, similar to Russian in grammar, pronouns etc. A good PR to base your new language addition on. Ignore files outside the inflection/inflection folder. --------- Co-authored-by: George Rhoten <[email protected]>
1 parent 163c001 commit 2e4bb46

File tree

24 files changed

+3011
-46
lines changed

24 files changed

+3011
-46
lines changed

data/sr/exceptions.tsv

Lines changed: 394 additions & 2 deletions
Large diffs are not rendered by default.

data/sr/lexicon_data.json

Lines changed: 152 additions & 0 deletions
Large diffs are not rendered by default.

fst/inflection_sr.py

Lines changed: 231 additions & 43 deletions
Large diffs are not rendered by default.

inflection/resources/org/unicode/inflection/dictionary/dictionary_sr.lst

Lines changed: 1039 additions & 0 deletions
Large diffs are not rendered by default.

inflection/resources/org/unicode/inflection/dictionary/inflectional_sr.xml

Lines changed: 803 additions & 0 deletions
Large diffs are not rendered by default.

inflection/resources/org/unicode/inflection/features/grammar.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,6 +2315,51 @@
23152315
</category>
23162316
</grammar>
23172317
</language>
2318+
<language id="sr">
2319+
<grammar>
2320+
<category name="case">
2321+
<restrictions>
2322+
<restriction name="pos" value="noun"/>
2323+
<restriction name="pos" value="proper-noun"/>
2324+
</restrictions>
2325+
<grammeme name="nominative"/>
2326+
<grammeme name="genitive"/>
2327+
<grammeme name="dative"/>
2328+
<grammeme name="accusative"/>
2329+
<grammeme name="vocative"/>
2330+
<grammeme name="locative"/>
2331+
<grammeme name="instrumental"/>
2332+
</category>
2333+
<category name="number">
2334+
<grammeme name="singular"/>
2335+
<grammeme name="plural"/>
2336+
</category>
2337+
<category name="emphasis">
2338+
<restrictions>
2339+
<restriction name="pos" value="pronoun"/>
2340+
</restrictions>
2341+
<grammeme name="stressed"/>
2342+
<grammeme name="unstressed"/>
2343+
</category>
2344+
<category name="gender">
2345+
<grammeme name="masculine"/>
2346+
<grammeme name="feminine"/>
2347+
<grammeme name="neuter"/>
2348+
</category>
2349+
<category name="person">
2350+
<grammeme name="first"/>
2351+
<grammeme name="second"/>
2352+
<grammeme name="third"/>
2353+
</category>
2354+
<category name="pronounType">
2355+
<restrictions>
2356+
<restriction name="pos" value="pronoun"/>
2357+
</restrictions>
2358+
<grammeme name="personal"/>
2359+
<grammeme name="reflexive"/>
2360+
</category>
2361+
</grammar>
2362+
</language>
23182363
<language id="sv">
23192364
<grammar>
23202365
<category name="case">
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
оно,third,singular,nominative,neuter
2+
он,third,singular,nominative,masculine
3+
она,third,singular,nominative,feminine
4+
она,third,plural,nominative,neuter
5+
они,third,plural,nominative,masculine
6+
оне,third,plural,nominative,feminine
7+
ти,second,singular,nominative
8+
ви,second,plural,nominative
9+
ја,first,singular,nominative
10+
ми,first,plural,nominative
11+
њега,third,singular,accusative,neuter,stressed
12+
га,third,singular,accusative,neuter,unstressed
13+
њега,third,singular,accusative,masculine,stressed
14+
га,third,singular,accusative,masculine,unstressed
15+
њу,third,singular,accusative,feminine,stressed
16+
ју,third,singular,accusative,feminine,unstressed
17+
њих,third,plural,accusative,gender,stressed
18+
их,third,plural,accusative,gender,unstressed
19+
тебе,second,singular,accusative,stressed
20+
те,second,singular,accusative,unstressed
21+
вас,second,plural,accusative
22+
мене,first,singular,accusative,stressed
23+
ме,first,singular,accusative,unstressed
24+
нас,first,plural,accusative
25+
њему,third,singular,dative,neuter,stressed
26+
му,third,singular,dative,neuter,unstressed
27+
њему,third,singular,dative,masculine,stressed
28+
му,third,singular,dative,masculine,unstressed
29+
њој,third,singular,dative,feminine,stressed
30+
јој,third,singular,dative,feminine,unstressed
31+
њима,third,plural,dative,gender,stressed
32+
им,third,plural,dative,gender,unstressed
33+
теби,second,singular,dative,stressed
34+
ти,second,singular,dative,unstressed
35+
вама,second,plural,dative,stressed
36+
вам,second,plural,dative,unstressed
37+
мени,first,singular,dative,stressed
38+
ми,first,singular,dative,unstressed
39+
нама,first,plural,dative,stressed
40+
нам,first,plural,dative,unstressed
41+
њему,third,singular,locative,neuter
42+
њему,third,singular,locative,masculine
43+
њој,third,singular,locative,feminine
44+
њима,third,plural,locative,gender
45+
теби,second,singular,locative
46+
вама,second,plural,locative
47+
мени,first,singular,locative
48+
нама,first,plural,locative
49+
њим,third,singular,instrumental,neuter
50+
њим,third,singular,instrumental,masculine
51+
њом,third,singular,instrumental,feminine
52+
њима,third,plural,instrumental,gender
53+
тобом,second,singular,instrumental
54+
вама,second,plural,instrumental
55+
мном,first,singular,instrumental
56+
нама,first,plural,instrumental
57+
њега,third,singular,genitive,neuter,stressed
58+
га,third,singular,genitive,neuter,unstressed
59+
њега,third,singular,genitive,masculine,stressed
60+
га,third,singular,genitive,masculine,unstressed
61+
ње,third,singular,genitive,feminine,stressed
62+
је,third,singular,genitive,feminine,unstressed
63+
њих,third,plural,genitive,gender,stressed
64+
их,third,plural,genitive,gender,unstressed
65+
тебе,second,singular,genitive,stressed
66+
те,second,singular,genitive,unstressed
67+
вас,second,plural,genitive
68+
мене,first,singular,genitive,stressed
69+
ме,first,singular,genitive,unstressed
70+
нас,first,plural,genitive
71+
себе,person,number,gender,accusative,reflexive,stressed
72+
се,person,number,gender,accusative,reflexive,unstressed
73+
себи,person,number,gender,dative,reflexive,stressed
74+
си,person,number,gender,dative,reflexive,unstressed
75+
себе,person,number,gender,locative,reflexive
76+
собом,person,number,gender,instrumental,reflexive
77+
себи,person,number,gender,genitive,reflexive,stressed
78+
се,person,number,gender,genitive,reflexive,unstressed

inflection/resources/org/unicode/inflection/locale/supported-locales.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Copyright 2024-2024 Apple Inc. All rights reserved.
33
#
44
# The first in each group is the primary language and is loaded first.
5-
# These are languages that are advertised. Don't list a language if you want it to be a secret.
65
locale.group.ar=ar_SA
76
locale.group.da=da_DK
87
locale.group.de=de_DE,de_AT,de_CH
@@ -20,6 +19,7 @@ locale.group.nb=nb_NO
2019
locale.group.nl=nl_NL,nl_BE
2120
locale.group.pt=pt_BR,pt_PT
2221
locale.group.ru=ru_RU
22+
locale.group.sr=sr_RS
2323
locale.group.sv=sv_SE
2424
locale.group.th=th_TH
2525
locale.group.tr=tr_TR
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Copyright 2024 and later: Unicode, Inc. and others.
3+
# License & terms of use: http://www.unicode.org/copyright.html
4+
#
5+
tokenizer.implementation.class=DefaultTokenizer

inflection/src/inflection/dialog/LocalizedCommonConceptFactoryProvider.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <inflection/dialog/language/NlCommonConceptFactory.hpp>
2121
#include <inflection/dialog/language/PtCommonConceptFactory.hpp>
2222
#include <inflection/dialog/language/RuCommonConceptFactory.hpp>
23+
#include <inflection/dialog/language/SrCommonConceptFactory.hpp>
2324
#include <inflection/dialog/language/SvCommonConceptFactory.hpp>
2425
#include <inflection/dialog/language/ThCommonConceptFactory.hpp>
2526
#include <inflection/dialog/language/TrCommonConceptFactory.hpp>
@@ -81,6 +82,7 @@ static CommonConceptFactory* constructCommonConceptFactory(const ::inflection::u
8182
{"nl", &constructor<language::NlCommonConceptFactory>},
8283
{"pt", &constructor<language::PtCommonConceptFactory>},
8384
{"ru", &constructor<language::RuCommonConceptFactory>},
85+
{"sr", &constructor<language::SrCommonConceptFactory>},
8486
{"sv", &constructor<language::SvCommonConceptFactory>},
8587
{"th", &constructor<language::ThCommonConceptFactory>},
8688
{"tr", &constructor<language::TrCommonConceptFactory>},

0 commit comments

Comments
 (0)