Grammalecte  Check-in [1768a9e3e4]

Overview
Comment:[fr] conversion: regex rules -> graph rules
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fr | rg
Files: files | file ages | folders
SHA3-256: 1768a9e3e419872e12bcd98b6441514786610a605a951099d9433f6ab722adb2
User & Date: olr on 2018-07-17 11:41:38
Other Links: branch diff | manifest | tags
Context
2018-07-19
05:45
[fr] conversion: regex rules -> graph rules check-in: 24988d689e user: olr tags: fr, rg
2018-07-17
11:41
[fr] conversion: regex rules -> graph rules check-in: 1768a9e3e4 user: olr tags: fr, rg
11:40
[fr][core] date verification: switch back to previous behavior check-in: b0e46a6636 user: olr tags: fr, core, rg
Changes

Modified gc_lang/fr/rules.grx from [56ea3fd00d] to [00e5bc27ed].

1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
__[s]/num(num_lettre_O_zéro1)__  [\dO]+[O][\dO]+ <<- not option("ocr") ->> =\0.replace("O", "0")    # S’il s’agit d’un nombre, utilisez le chiffre « 0 » plutôt que la lettre « O ».
__[s]/num(num_lettre_O_zéro2)__  [1-9]O <<- not option("ocr") ->> =\0.replace("O", "0")             # S’il s’agit d’un nombre, utilisez le chiffre « 0 » plutôt que la lettre « O ».

TEST: année {{2O11}}                                                      ->> 2011
TEST: {{3O}} (chiffre avec un O).                                         ->> 30


# Nombres ordinaux
__[s]/typo(typo_ordinaux_premier)__
    1 ?(?:ier|i?ère)s?
    <<- ->> =\0.replace(" ", "").replace("è", "").replace("i", "").replace("e", "ᵉ").replace("r", "ʳ").replace("s", "ˢ")
    # Nombre ordinal. Premier : 1ᵉʳ. Première : 1ʳᵉ. Premiers : 1ᵉʳˢ. Premières : 1ʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271
__[s]/typo(typo_ordinaux_deuxième)__
    2 ?nde?s?
    <<- ->> =\0.replace(" ", "").replace("n", "").replace("d", "ᵈ").replace("e", "ᵉ").replace("s", "ˢ")
    # Nombre ordinal. Second : 2ᵈ. Seconde : 2ᵈᵉ. Seconds : 2ᵈˢ. Secondes : 2ᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271
__[s]/typo(typo_ordinaux_nième)__
    ([0-9]+) ?(?:è|i?[èe]me)s?  @@0
    <<- \0.endswith("s") ->> \1ᵉˢ                                                                   # Nombre ordinal pluriel. Exemples : 2ᵉˢ, 3ᵉˢ, 4ᵉˢ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271
    <<- __else__ ->> \1ᵉ                                                                            # Nombre ordinal singulier. Exemples : 2ᵉ, 3ᵉ, 4ᵉ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271
__[s]/typo(typo_ordinaux_romain_premier)__
    I ?(?:ier|i?ère)s?
    <<- ->> =\0.replace(" ", "").replace("è", "").replace("i", "").replace("e", "ᵉ").replace("r", "ʳ").replace("s", "ˢ")
    # Nombre ordinal romain. Premier : 1ᵉʳ. Première : Iʳᵉ. Premiers : Iᵉʳˢ. Premières : Iʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271
__[s]/typo(typo_ordinaux_romain_deuxième)__
    II ?nde?s?
    <<- ->> =\0.replace(" ", "").replace("n", "").replace("d", "ᵈ").replace("e", "ᵉ").replace("s", "ˢ")
    # Nombre ordinal romain. Second : IIᵈ. Seconde : IIᵈᵉ. Seconds : IIᵈˢ. Secondes : IIᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271
__[s]/typo(typo_ordinaux_romains_nième)__
    ([IVXLCM]{1,3}) ?(?:è|i?[èe]me)s?  @@0
    <<- not morph(\0, ":G", False) >>>
    <<- \0.endswith("s") ->> \1ᵉˢ                                                                   # Nombre ordinal romain singulier. Exemples : IIᵉ, IIIᵉ, IVᵉ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271
    <<- __else__ ->> \1ᵉ                                                                            # Nombre ordinal romain pluriel. Exemples : IIᵉˢ, IIIᵉˢ, IVᵉˢ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

TEST: la {{1ière}} fois, c’est la plus dure     ->> 1ʳᵉ
TEST: le {{1ier}} de chaque semaine             ->> 1ᵉʳ
TEST: le {{2nd}} du mois                        ->> 2ᵈ
TEST: les {{3ièmes}} années                     ->> 3ᵉˢ
TEST: C’est la {{3ème}} fois…                   ->> 3ᵉ
TEST: Non, la {{2è}} fois.                      ->> 2ᵉ
TEST: François {{Iier}}                         ->> Iᵉʳ
TEST: le {{IInd}} siècle                        ->> IIᵈ
TEST: le {{VIième}} siècle                      ->> VIᵉ
TEST: Le {{XXIème}} siècle.                     ->> XXIᵉ
TEST: le {{XXè}} siècle.                        ->> XXᵉ



!!!! Écritures épicènes invariables                                                               !!

__[i](d_typo_écriture_épicène_pluriel)__
    ({w_1}[éuitsrn])_(?:[nt]|)e_s  @@0
    <<- morphex(\1, ":[NAQ]", ":G") =>> define(\1, [":N:A:Q:e:p"])







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1997
1998
1999
2000
2001
2002
2003







































2004
2005
2006
2007
2008
2009
2010
__[s]/num(num_lettre_O_zéro1)__  [\dO]+[O][\dO]+ <<- not option("ocr") ->> =\0.replace("O", "0")    # S’il s’agit d’un nombre, utilisez le chiffre « 0 » plutôt que la lettre « O ».
__[s]/num(num_lettre_O_zéro2)__  [1-9]O <<- not option("ocr") ->> =\0.replace("O", "0")             # S’il s’agit d’un nombre, utilisez le chiffre « 0 » plutôt que la lettre « O ».

TEST: année {{2O11}}                                                      ->> 2011
TEST: {{3O}} (chiffre avec un O).                                         ->> 30











































!!!! Écritures épicènes invariables                                                               !!

__[i](d_typo_écriture_épicène_pluriel)__
    ({w_1}[éuitsrn])_(?:[nt]|)e_s  @@0
    <<- morphex(\1, ":[NAQ]", ":G") =>> define(\1, [":N:A:Q:e:p"])
2177
2178
2179
2180
2181
2182
2183





























































































































2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
@@@@
@@@@GRAPH: graphe1                                                                                 _
@@@@
@@@@
@@@@
@@@@































































































































!!!! Dates                                                                                        !!

__date_jour_mois_année__
    31 [avril|juin|septembre|novembre]
        <<- /date/ space_after(\1, 1, 1) ->> 30 \2                                                  # Cette date est invalide. Il n’y a que 30 jours en \2.

    [30|31] février
        <<- /date/ space_after(\1, 1, 1) ->> 28 février|29 février                                  # Cette date est invalide. Il n’y a que 28 ou 29 jours en février.

    ~^\d\d?  [janvier|février|mars|avril|mai|juin|juillet|aout|août|septembre|octobre|novembre|décembre]  ~\d{2,5}$
        <<- /date/ not checkDateWithString(\1, \2, \3) ->> _                                        # Cette date est invalide.

TEST: le {{31 avril}}
TEST: le {{30 février}}
TEST: {{29 février 2011}}


__date_journée_jour_mois_année__
    ([lundi|mardi|mercredi|jeudi|vendredi|samedi|dimanche])  ?,¿  ?le¿  (~^\d\d?-\d\d?-\d{2,5}$)
        <<- /date/ not after(r"^ +av(?:ant|) +J(?:C|ésus-Christ)") and not checkDay(\1, \2)
        -1>> =getDay(\2)                                                                            # Le jour de la date suivante est incorrect.

    ([lundi|mardi|mercredi|jeudi|vendredi|samedi|dimanche])  ?,¿  ?le¿  (~^\d\d?$)  ([janvier|février|mars|avril|mai|juin|juillet|aout|août|septembre|octobre|novembre|décembre])  (~\d{2,5}$)
        <<- /date/ not after(r"^ +av(?:ant|) +J(?:C|ésus-Christ)") and not checkDayWithString(\1, \2, \3, \4)
        -1>> =getDayWithString(\2, \3, \4)                                                          # Le jour de la date suivante est incorrect.

TEST: {{samedi}}, le 10-06-2014                                           ->> mardi
TEST: {{mercredi}}, le 10 juin 2014                                       ->> mardi







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










|








|
|
|







2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
@@@@
@@@@GRAPH: graphe1                                                                                 _
@@@@
@@@@
@@@@
@@@@


!!!! Nombres ordinaux                                                                             !!

__typo_ordinaux_chiffres__
    1 ier
    1ier
        <<- /typo/ ->> 1ᵉʳ          # Nombre ordinal. Premier : 1ᵉʳ. Première : 1ʳᵉ. Premiers : 1ᵉʳˢ. Premières : 1ʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    1 iers
    1iers
        <<- /typo/ ->> 1ᵉʳˢ         # Nombre ordinal. Premier : 1ᵉʳ. Première : 1ʳᵉ. Premiers : 1ᵉʳˢ. Premières : 1ʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    1 ière
    1ière
        <<- /typo/ ->> 1ʳᵉ          # Nombre ordinal. Premier : 1ᵉʳ. Première : 1ʳᵉ. Premiers : 1ᵉʳˢ. Premières : 1ʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    1 ières
    1ières
        <<- /typo/ ->> 1ʳᵉˢ         # Nombre ordinal. Premier : 1ᵉʳ. Première : 1ʳᵉ. Premiers : 1ᵉʳˢ. Premières : 1ʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    2 nd
    2nd
        <<- /typo/ ->> 2ᵈ           # Nombre ordinal. Second : 2ᵈ. Seconde : 2ᵈᵉ. Seconds : 2ᵈˢ. Secondes : 2ᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    2 nds
    2nds
        <<- /typo/ ->> 2ᵈˢ          # Nombre ordinal. Second : 2ᵈ. Seconde : 2ᵈᵉ. Seconds : 2ᵈˢ. Secondes : 2ᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    2 nde
    2nde
        <<- /typo/ ->> 2ᵈᵉ          # Nombre ordinal. Second : 2ᵈ. Seconde : 2ᵈᵉ. Seconds : 2ᵈˢ. Secondes : 2ᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    2 ndes
    2ndes
        <<- /typo/ ->> 2ᵈᵉˢ         # Nombre ordinal. Second : 2ᵈ. Seconde : 2ᵈᵉ. Seconds : 2ᵈˢ. Secondes : 2ᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    ~^\d+$  è
    ~^\d+$  ième
    ~^\d+$  ieme
    ~^\d+$  ème
    ~^\d+$  eme
        <<- /typo/ ->> \1ᵉ          # Nombre ordinal singulier. Exemples : 2ᵉ, 3ᵉ, 4ᵉ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    ~^\d+$  ès
    ~^\d+$  ièmes
    ~^\d+$  iemes
    ~^\d+$  èmes
    ~^\d+$  emes
        <<- /typo/ ->> \1ᵉˢ         # Nombre ordinal pluriel. Exemples : 2ᵉˢ, 3ᵉˢ, 4ᵉˢ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    ~^\d+(?:è|i?[èe]me)s?$
        <<- /typo/ \0.endswith("s")
        ->> =\1.replace("mes", "").replace("è", "").replace("e", "").replace("i", "") + "ᵉˢ"    # Nombre ordinal pluriel. Exemples : 2ᵉˢ, 3ᵉˢ, 4ᵉˢ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271
        <<- /typo/ __else__
        ->> =\1.replace("me", "").replace("è", "").replace("e", "").replace("i", "") + "ᵉ"      # Nombre ordinal singulier. Exemples : 2ᵉ, 3ᵉ, 4ᵉ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

TEST: la {{1ière}} fois, c’est la plus dure     ->> 1ʳᵉ
TEST: le {{1ier}} de chaque semaine             ->> 1ᵉʳ
TEST: le {{2nd}} du mois                        ->> 2ᵈ
TEST: les {{3ièmes}} années                     ->> 3ᵉˢ
TEST: C’est la {{3ème}} fois…                   ->> 3ᵉ
TEST: Non, la {{2è}} fois.                      ->> 2ᵉ


__typo_ordinaux_chiffres_romains__
    I ier
    Iier
        <<- /typo/ ->> Iᵉʳ          # Nombre ordinal romain. Premier : Iᵉʳ. Première : Iʳᵉ. Premiers : Iᵉʳˢ. Premières : Iʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    I iers
    Iiers
        <<- /typo/ ->> Iᵉʳˢ         # Nombre ordinal romain. Premier : Iᵉʳ. Première : Iʳᵉ. Premiers : Iᵉʳˢ. Premières : Iʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    I ière
    Iière
        <<- /typo/ ->> Iʳᵉ          # Nombre ordinal romain. Premier : Iᵉʳ. Première : Iʳᵉ. Premiers : Iᵉʳˢ. Premières : Iʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    I ières
    Iières
        <<- /typo/ ->> Iʳᵉˢ         # Nombre ordinal romain. Premier : Iᵉʳ. Première : Iʳᵉ. Premiers : Iᵉʳˢ. Premières : Iʳᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    II nd
    IInd
        <<- /typo/ ->> IIᵈ          # Nombre ordinal romain. Second : IIᵈ. Seconde : IIᵈᵉ. Seconds : IIᵈˢ. Secondes : IIᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    II nds
    IInds
        <<- /typo/ ->> IIᵈˢ         # Nombre ordinal romain. Second : IIᵈ. Seconde : IIᵈᵉ. Seconds : IIᵈˢ. Secondes : IIᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    II nde
    IInde
        <<- /typo/ ->> IIᵈᵉ         # Nombre ordinal romain. Second : IIᵈ. Seconde : IIᵈᵉ. Seconds : IIᵈˢ. Secondes : IIᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    II ndes
    IIndes
        <<- /typo/ ->> IIᵈᵉˢ        # Nombre ordinal romain. Second : IIᵈ. Seconde : IIᵈᵉ. Seconds : IIᵈˢ. Secondes : IIᵈᵉˢ.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    ~^[IVXLCM]{1,10}$  è
    ~^[IVXLCM]{1,10}$  ième
    ~^[IVXLCM]{1,10}$  ieme
    ~^[IVXLCM]{1,10}$  ème
    ~^[IVXLCM]{1,10}$  eme
        <<- /typo/ ->> \1ᵉ          # Nombre ordinal romain singulier. Exemples : 2ᵉ, 3ᵉ, 4ᵉ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    ~^[IVXLCM]{1,10}$  ès
    ~^[IVXLCM]{1,10}$  ièmes
    ~^[IVXLCM]{1,10}$  iemes
    ~^[IVXLCM]{1,10}$  èmes
    ~^[IVXLCM]{1,10}$  emes
        <<- /typo/ ->> \1ᵉˢ         # Nombre ordinal romain pluriel. Exemples : 2ᵉˢ, 3ᵉˢ, 4ᵉˢ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

    ~^[IVXLCM]{1,10}(?:è|i?[èe]me)s?$
        <<- /typo/ not morph(\1, ":G") >>>
        <<- \0.endswith("s")
        ->> =\1.replace("mes", "").replace("è", "").replace("e", "").replace("i", "") + "ᵉˢ" # Nombre ordinal romain pluriel. Exemples : IIᵉˢ, IIIᵉˢ, IVᵉˢ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271
        <<- __else__
        ->> =\1.replace("me", "").replace("è", "").replace("e", "").replace("i", "") + "ᵉ"   # Nombre ordinal romain singulier. Exemples : IIᵉ, IIIᵉ, IVᵉ…|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=4271

TEST: François {{Iier}}                         ->> Iᵉʳ
TEST: le {{IInd}} siècle                        ->> IIᵈ
TEST: le {{VIième}} siècle                      ->> VIᵉ
TEST: Le {{XXIème}} siècle.                     ->> XXIᵉ
TEST: le {{XXè}} siècle.                        ->> XXᵉ



!!!! Dates                                                                                        !!

__date_jour_mois_année__
    31 [avril|juin|septembre|novembre]
        <<- /date/ space_after(\1, 1, 1) ->> 30 \2                                                  # Cette date est invalide. Il n’y a que 30 jours en \2.

    [30|31] février
        <<- /date/ space_after(\1, 1, 1) ->> 28 février|29 février                                  # Cette date est invalide. Il n’y a que 28 ou 29 jours en février.

    ~^\d\d?$  [janvier|février|mars|avril|mai|juin|juillet|aout|août|septembre|octobre|novembre|décembre]  ~\d{2,5}$
        <<- /date/ not checkDateWithString(\1, \2, \3) ->> _                                        # Cette date est invalide.

TEST: le {{31 avril}}
TEST: le {{30 février}}
TEST: {{29 février 2011}}


__date_journée_jour_mois_année__
    ([lundi|mardi|mercredi|jeudi|vendredi|samedi|dimanche])  ?,¿  ?le¿  (~^\d\d?$) - (~^\d\d?$) - (~^\d{2,5}$)
        <<- /date/ not after(r"^ +av(?:ant|) +J(?:C|ésus-Christ)") and not checkDay(\1, \2, \3, \4)
        -1>> =getDay(\2, \3, \4)                                                                            # Le jour de la date suivante est incorrect.

    ([lundi|mardi|mercredi|jeudi|vendredi|samedi|dimanche])  ?,¿  ?le¿  (~^\d\d?$)  ([janvier|février|mars|avril|mai|juin|juillet|aout|août|septembre|octobre|novembre|décembre])  (~\d{2,5}$)
        <<- /date/ not after(r"^ +av(?:ant|) +J(?:C|ésus-Christ)") and not checkDayWithString(\1, \2, \3, \4)
        -1>> =getDayWithString(\2, \3, \4)                                                          # Le jour de la date suivante est incorrect.

TEST: {{samedi}}, le 10-06-2014                                           ->> mardi
TEST: {{mercredi}}, le 10 juin 2014                                       ->> mardi