1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
"""
Masculins, féminins, singuliers et pluriels
"""
from .mfsp_data import lTagMiscPlur as _lTagMiscPlur
from .mfsp_data import lTagMasForm as _lTagMasForm
from .mfsp_data import dMiscPlur as _dMiscPlur
from .mfsp_data import dMasForm as _dMasForm
def isFemForm (sWord):
"returns True if sWord exists in _dMasForm"
return sWord in _dMasForm
def getMasForm (sWord, bPlur):
"returns masculine form with feminine form"
if sWord in _dMasForm:
return [ _modifyStringWithSuffixCode(sWord, sTag) for sTag in _whatSuffixCodes(sWord, bPlur) ]
return []
def hasMiscPlural (sWord):
"returns True if sWord exists in dPlurMisc"
return sWord in _dMiscPlur
def getMiscPlural (sWord):
"returns plural form with singular form"
if sWord in _dMiscPlur:
return [ _modifyStringWithSuffixCode(sWord, sTag) for sTag in _lTagMiscPlur[_dMiscPlur[sWord]].split("|") ]
return []
def _whatSuffixCodes (sWord, bPlur):
"necessary only for dMasFrom"
sSfx = _lTagMasForm[_dMasForm[sWord]]
if "/" in sSfx:
if bPlur:
return sSfx[sSfx.find("/")+1:].split("|")
return sSfx[:sSfx.find("/")].split("|")
return sSfx.split("|")
def _modifyStringWithSuffixCode (sWord, sSfx):
"returns sWord modified by sSfx"
if not sSfx:
return ""
if sSfx == "0":
return sWord
|
|
|
>
|
|
>
>
>
|
<
|
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
"""
Masculins, féminins, singuliers et pluriels
"""
from .mfsp_data import lTagMiscPlur as _lTagMiscPlur
from .mfsp_data import lTagFemForm as _lTagFemForm
from .mfsp_data import dMiscPlur as _dMiscPlur
from .mfsp_data import dMasForm as _dMasForm
def isMasForm (sWord):
"returns True if sWord exists in _dMasForm"
return sWord in _dMasForm
def getFemForm (sWord, bPlur):
"returns feminine forms with masculine form"
if sWord in _dMasForm:
return [ _modifyStringWithSuffixCode(sWord, sTag) for sTag in _whatSuffixCodes(sWord, bPlur) ]
return []
def hasMiscPlural (sWord):
"returns True if sWord exists in dPlurMisc"
return sWord in _dMiscPlur
def getMiscPlural (sWord):
"returns plural form with singular form"
if sWord in _dMiscPlur:
return [ _modifyStringWithSuffixCode(sWord, sTag) for sTag in _lTagMiscPlur[_dMiscPlur[sWord]].split("|") ]
return []
def _whatSuffixCodes (sWord, bPlur):
"necessary only for dMasFrom"
sSfx = _lTagFemForm[_dMasForm[sWord]]
if bPlur:
return sSfx[sSfx.find("/")+1:].split("|")
return sSfx[:sSfx.find("/")].split("|")
def _modifyStringWithSuffixCode (sWord, sSfx):
"returns sWord modified by sSfx"
if not sSfx:
return ""
if sSfx == "0":
return sWord
|