Grammalecte  Check-in [e0f39d31ba]

Overview
Comment:[build][core] tokens auto selection
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | build | rg
Files: files | file ages | folders
SHA3-256: e0f39d31ba5d3a7b2ab6c38d6e928d2419e83faa3777b9c051a4e41d3d307b48
User & Date: olr on 2018-06-06 16:55:35
Other Links: branch diff | manifest | tags
Context
2018-06-08
10:53
[core] default morphologies parameter for disambigator check-in: 799b4dd09a user: olr tags: core, rg
2018-06-06
16:55
[build][core] tokens auto selection check-in: e0f39d31ba user: olr tags: core, build, rg
15:24
[core] DARG: text processing check-in: 5fc6d41650 user: olr tags: core, rg
Changes

Modified compile_rules_graph.py from [184a3e89b8] to [5a88e8c71b].

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131




132
133
134
135
136
137
138
139
140
def changeReferenceToken (s, dPos):
    for i in range(len(dPos), 0, -1):
        s = s.replace("\\"+str(i), "\\"+str(dPos[i]))
    return s


def createAction (sIdAction, sAction, nPriority, nToken, dPos):
    m = re.search("([-~=])(\\d+|)(:\\d+|)>> ", sAction)
    if not m:
        print(" # Error. No action found at: ", sIdAction)
        print("   ==", sAction, "==")
        return None
    # Condition
    sCondition = sAction[:m.start()].strip()
    if sCondition:
        sCondition = prepareFunction(sCondition)
        sCondition = changeReferenceToken(sCondition, dPos)    
        lFUNCTIONS.append(("g_c_"+sIdAction, sCondition))
        sCondition = "g_c_"+sIdAction
    else:
        sCondition = ""
    # Action
    cAction = m.group(1)
    sAction = sAction[m.end():].strip()
    sAction = changeReferenceToken(sAction, dPos)




    iStartAction = int(m.group(2))  if m.group(2)  else 0
    iEndAction = int(m.group(3)[1:])  if m.group(3)  else iStartAction
    if dPos:
        try:
            iStartAction = dPos[iStartAction]
            iEndAction = dPos[iEndAction]
        except:
            print("# Error. Wrong groups in: " + sIdAction)








|














|


>
>
>
>
|
|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
def changeReferenceToken (s, dPos):
    for i in range(len(dPos), 0, -1):
        s = s.replace("\\"+str(i), "\\"+str(dPos[i]))
    return s


def createAction (sIdAction, sAction, nPriority, nToken, dPos):
    m = re.search("(?P<action>[-~=])(?P<start>\\d+|)(?P<end>:\\d+|)>> ", sAction)
    if not m:
        print(" # Error. No action found at: ", sIdAction)
        print("   ==", sAction, "==")
        return None
    # Condition
    sCondition = sAction[:m.start()].strip()
    if sCondition:
        sCondition = prepareFunction(sCondition)
        sCondition = changeReferenceToken(sCondition, dPos)    
        lFUNCTIONS.append(("g_c_"+sIdAction, sCondition))
        sCondition = "g_c_"+sIdAction
    else:
        sCondition = ""
    # Action
    cAction = m.group("action")
    sAction = sAction[m.end():].strip()
    sAction = changeReferenceToken(sAction, dPos)
    if not m.group("start"):
        iStartAction = 1
        iEndAction = nToken
    else:
        iStartAction = int(m.group("start"))
        iEndAction = int(m.group("end")[1:])  if m.group("end")  else iStartAction
    if dPos:
        try:
            iStartAction = dPos[iStartAction]
            iEndAction = dPos[iEndAction]
        except:
            print("# Error. Wrong groups in: " + sIdAction)

Modified gc_lang/fr/rules_graph.grx from [747aec6cb3] to [8ea04e8e94].

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

# ERREURS COURANTES
# http://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Fautes_d%27orthographe/Courantes


__pp__
    >avoir  marre  [d’|des|du|de]
        <<- ~1:3>> *

TEST: J’en ai marre de ces gens-là.


__pp2__
    il ne pense qu’ à sa gueule
        <<- ~4:7>> que|Z|a|perdu







|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

# ERREURS COURANTES
# http://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Fautes_d%27orthographe/Courantes


__pp__
    >avoir  marre  [d’|des|du|de]
        <<- ~>> *

TEST: J’en ai marre de ces gens-là.


__pp2__
    il ne pense qu’ à sa gueule
        <<- ~4:7>> que|Z|a|perdu