38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
sWord = sWord.lower()
if sWord in _dWord:
return _lSet[_dWord[sWord]]
return []
def selectSimil (sWord, sPattern):
"return a set of words phonetically similar to <sWord> and whom POS is matching <sPattern>"
if not sPattern:
return set(getSimil(sWord))
aSelect = set()
for sSimil in getSimil(sWord):
for sMorph in _dMorph.get(sSimil, []):
if re.search(sPattern, sMorph):
aSelect.add(sSimil)
return aSelect
def _getSetNumber (sWord):
"return the set number where <sWord> belongs, else -1"
if sWord in _dWord:
return _dWord[sWord]
|
|
|
|
|
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
sWord = sWord.lower()
if sWord in _dWord:
return _lSet[_dWord[sWord]]
return []
def selectSimil (sWord, sPattern):
"return a list of words phonetically similar to <sWord> and whom POS is matching <sPattern>"
if not sPattern:
return getSimil(sWord)
aSelect = []
for sSimil in getSimil(sWord):
for sMorph in _dMorph.get(sSimil, []):
if re.search(sPattern, sMorph):
aSelect.append(sSimil)
return aSelect
def _getSetNumber (sWord):
"return the set number where <sWord> belongs, else -1"
if sWord in _dWord:
return _dWord[sWord]
|