Grammalecte  Check-in [a4464491a9]

Overview
Comment:[build][core] handle regex tokens
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | build | rg
Files: files | file ages | folders
SHA3-256: a4464491a9899fd0cbdbcf752497738ff8dc2a9ffd49eabe169d3d971244f5b9
User & Date: olr on 2018-05-17 08:55:12
Other Links: branch diff | manifest | tags
Context
2018-05-17
09:09
[build][core] use 1 instead of empty string for specific tags check-in: 1895dda13e user: olr tags: core, build, rg
08:55
[build][core] handle regex tokens check-in: a4464491a9 user: olr tags: core, build, rg
2018-05-16
16:14
[build][core] rules graph: first draft check-in: 061252f41e user: olr tags: core, build, rg
Changes

Modified datg.py from [de8212efb3] to [0ecbd40da7].

163
164
165
166
167
168
169
170

171



172


173
174
175
176
177
    def __eq__ (self, other):
        # Used as a key in a python dictionary.
        # Nodes are equivalent if they have identical arcs, and each identical arc leads to identical states.
        return self.__str__() == other.__str__()        

    def getNodeAsDict (self):
        "returns the node as a dictionary structure"
        dNode = { }

        for arc, oNode in self.dArcs.items():



            dNode[arc] = oNode.__hash__()


        if self.bFinal:
            dNode["<final>"] = ""
        if self.bInfo:
            dNode["<info>"] = ""
        return dNode







|
>

>
>
>
|
>
>





163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
    def __eq__ (self, other):
        # Used as a key in a python dictionary.
        # Nodes are equivalent if they have identical arcs, and each identical arc leads to identical states.
        return self.__str__() == other.__str__()        

    def getNodeAsDict (self):
        "returns the node as a dictionary structure"
        dNode = {}
        dRegex = {}
        for arc, oNode in self.dArcs.items():
            if type(arc) == str and arc.startswith("~"):
                dRegex[arc[1:]] = oNode.__hash__()
            else:
                dNode[arc] = oNode.__hash__()
        if dRegex:
            dNode["<regex>"] = dRegex
        if self.bFinal:
            dNode["<final>"] = ""
        if self.bInfo:
            dNode["<info>"] = ""
        return dNode

Modified gc_lang/fr/rules_graph.grx from [cea9bb83a0] to [0c5fd71826].

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Fin d’interprétation du fichier avec une ligne commençant par #END

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


__rule1__
    les  :N:m:s
    des  :N:m:s
    ces  :N:m:s
        <<-  -1>> acquit                        # Message0|http://test.grammalecte.net

__rule2__
    ci important que soi
    ci vraiment il y a
    ci pour ça
        <<- morph(\2, ":[WAR]", False) -1>> si   # Message1|http://test.grammalecte.net







|
|
|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Fin d’interprétation du fichier avec une ligne commençant par #END

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


__rule1__
    les  ~:N:.:s
    des  ~:N:.:s
    ces  ~:N:.:s
        <<-  -1>> acquit                        # Message0|http://test.grammalecte.net

__rule2__
    ci important que soi
    ci vraiment il y a
    ci pour ça
        <<- morph(\2, ":[WAR]", False) -1>> si   # Message1|http://test.grammalecte.net