Grammalecte  Check-in [13772ea91b]

Overview
Comment:[fr][bug] phonet: hasSimil & getSimil
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr
Files: files | file ages | folders
SHA3-256: 13772ea91b3e1931f8068eb132278c793c22d944dae5d824aad7de3d211bf4ae
User & Date: olr on 2017-06-24 04:57:27
Other Links: manifest | tags
Context
2017-06-24
05:01
[fr] test modifié check-in: a1a7b35fac user: olr tags: trunk, fr
04:57
[fr][bug] phonet: hasSimil & getSimil check-in: 13772ea91b user: olr tags: trunk, fr
2017-06-23
23:33
[build][fr] fix tests check-in: 522a9321ac user: olr tags: trunk, build
Changes

Modified gc_lang/fr/modules-js/phonet.js from [1ddd439263] to [7cb5eceb49].

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
49
50
51
52
53
        if (sPattern) {
            return getSimil(sWord).some(sSimil => _dMorph._get(sSimil, []).some(sMorph => sMorph.search(sPattern) >= 0));
        }
        return true;
    }
    if (sWord.slice(0,1)._isUpperCase()) {
        sWord = sWord.toLowerCase();
    }

    if (sPattern) {
        return getSimil(sWord).some(sSimil => _dMorph._get(sSimil, []).some(sMorph => sMorph.search(sPattern) >= 0));
    }
    return _dWord.has(sWord);



}

function getSimil (sWord) {
    // return list of words phonetically similar to sWord
    if (!sWord) {
        return [];
    }
    if (_dWord.has(sWord)) {
        return _lSet[_dWord.get(sWord)];
    }
    if (sWord.slice(0,1)._isUpperCase()) {
        sWord = sWord.toLowerCase();
    }
    if (_dWord.has(sWord)) {
        return _lSet[_dWord.get(sWord)];

    }
    return [];
}

function selectSimil (sWord, sPattern) {
    // return list of words phonetically similar to sWord and whom POS is matching sPattern
    if (!sPattern) {







<
>
|
|
|
|
>
>
>












<
|
|
>







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
49
50
51
52
53
54
55
56
        if (sPattern) {
            return getSimil(sWord).some(sSimil => _dMorph._get(sSimil, []).some(sMorph => sMorph.search(sPattern) >= 0));
        }
        return true;
    }
    if (sWord.slice(0,1)._isUpperCase()) {
        sWord = sWord.toLowerCase();

        if (_dWord.has(sWord)) {
            if (sPattern) {
                return getSimil(sWord).some(sSimil => _dMorph._get(sSimil, []).some(sMorph => sMorph.search(sPattern) >= 0));
            }
            return true;
        }
    }
    return false;
}

function getSimil (sWord) {
    // return list of words phonetically similar to sWord
    if (!sWord) {
        return [];
    }
    if (_dWord.has(sWord)) {
        return _lSet[_dWord.get(sWord)];
    }
    if (sWord.slice(0,1)._isUpperCase()) {
        sWord = sWord.toLowerCase();

        if (_dWord.has(sWord)) {
            return _lSet[_dWord.get(sWord)];
        }
    }
    return [];
}

function selectSimil (sWord, sPattern) {
    // return list of words phonetically similar to sWord and whom POS is matching sPattern
    if (!sPattern) {

Modified gc_lang/fr/modules/phonet.py from [31589198ae] to [d03956eafb].

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
        return False
    if sWord in _dWord:
        if sPattern:
            return any(re.search(sPattern, sMorph)  for sSimil in getSimil(sWord)  for sMorph in _dMorph.get(sSimil, []))
        return True
    if sWord[0:1].isupper():
        sWord = sWord.lower()
    if sWord in _dWord:
        if sPattern:
            return any(re.search(sPattern, sMorph)  for sSimil in getSimil(sWord)  for sMorph in _dMorph.get(sSimil, []))
        return True
    return False


def getSimil (sWord):
    "return list of words phonetically similar to sWord"
    if not sWord:
        return []
    if sWord in _dWord:
        return _lSet[_dWord[sWord]]
    if sWord[0:1].isupper():
        sWord = sWord.lower()
    if sWord in _dWord:
        return _lSet[_dWord[sWord]]
    return []


def selectSimil (sWord, sPattern):
    "return list of words phonetically similar to sWord and whom POS is matching sPattern"
    if not sPattern:
        return set(getSimil(sWord))







|
|
|
|











|
|







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
        return False
    if sWord in _dWord:
        if sPattern:
            return any(re.search(sPattern, sMorph)  for sSimil in getSimil(sWord)  for sMorph in _dMorph.get(sSimil, []))
        return True
    if sWord[0:1].isupper():
        sWord = sWord.lower()
        if sWord in _dWord:
            if sPattern:
                return any(re.search(sPattern, sMorph)  for sSimil in getSimil(sWord)  for sMorph in _dMorph.get(sSimil, []))
            return True
    return False


def getSimil (sWord):
    "return list of words phonetically similar to sWord"
    if not sWord:
        return []
    if sWord in _dWord:
        return _lSet[_dWord[sWord]]
    if sWord[0:1].isupper():
        sWord = sWord.lower()
        if sWord in _dWord:
            return _lSet[_dWord[sWord]]
    return []


def selectSimil (sWord, sPattern):
    "return list of words phonetically similar to sWord and whom POS is matching sPattern"
    if not sPattern:
        return set(getSimil(sWord))