Overview
Comment: | [build][fr] fix dictionary build if corpus data is empty |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | trunk | fr | build |
Files: | files | file ages | folders |
SHA3-256: |
fd0b49ddad0bc90acd7bca5dfb3fbd34 |
User & Date: | olr on 2025-06-23 09:09:56 |
Other Links: | manifest | tags |
Context
2025-06-23
| ||
09:09 | [build][fr] fix dictionary build if corpus data is empty Leaf check-in: fd0b49ddad user: olr tags: trunk, fr, build | |
2024-06-16
| ||
06:29 | [server] update bottle.py from 0.13-dev to 0.12.25 check-in: ae748416ff user: olr tags: trunk, server | |
Changes
Modified gc_lang/fr/dictionnaire/genfrdic.py from [417d2bdb9e] to [2c15ac24c5].
︙ | ︙ | |||
442 443 444 445 446 447 448 | d = {} for oFlex in self.lFlexions: for c in oFlex.sFlexion: d[c] = d.get(c, 0) + oFlex.nOccur nTot = 0 for k in d: nTot += d[k] | > | | | | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | d = {} for oFlex in self.lFlexions: for c in oFlex.sFlexion: d[c] = d.get(c, 0) + oFlex.nOccur nTot = 0 for k in d: nTot += d[k] if nTot: hDst.write("\n\nOccurrences des lettres dans le corpus :\n") for sKey, nVal in sorted(d.items(), key = lambda x: (x[1], x[0]), reverse=True): hDst.write(" {} : {:>16,.0f} / {:.8f} %\n".format(sKey, nVal, nVal*100/nTot)) # Mots par nombre de lettres echo(" Nombre de lettres dans les mots...") if not self.aFlexions: self.aFlexions = set([e.sFlexion for e in self.lFlexions]) d = {} for sFlex in self.aFlexions: |
︙ | ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | for oFlexM in oEntry.lFlexions: if oFlex.sFlexion == oFlexM.sFlexion: nNewOccur = math.ceil((nFlexOccur * (oEntry.nAKO / nTotAKO)) / oFlexM.nDup) if nTotAKO else 0 hDst.write(sBlank + "{2:<30} {0.sMorph:<30} {0.nOccur:>10} %> {1:>10}\n".format(oFlexM, nNewOccur, oEntry.getShortDescr())) oFlexM.setOccurAndBlock(nNewOccur) def calcFreq (self, nTot): | | | 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 | for oFlexM in oEntry.lFlexions: if oFlex.sFlexion == oFlexM.sFlexion: nNewOccur = math.ceil((nFlexOccur * (oEntry.nAKO / nTotAKO)) / oFlexM.nDup) if nTotAKO else 0 hDst.write(sBlank + "{2:<30} {0.sMorph:<30} {0.nOccur:>10} %> {1:>10}\n".format(oFlexM, nNewOccur, oEntry.getShortDescr())) oFlexM.setOccurAndBlock(nNewOccur) def calcFreq (self, nTot): self.fFreq = (self.nOccur * 100) / nTot if nTot else 0 self.oldFq = self.fq self.fq = getIfq(self.fFreq) class Flexion: def __init__ (self, oEntry, sFlex='', sMorph='', cDic='', nFlexId=0): |
︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 | self.nOccur = n self.bBlocked = True def calcOccur (self): self.nOccur = math.ceil((self.nOccur / (self.nMulti+1)) / self.nDup) def calcFreq (self, nTot): | | | 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | self.nOccur = n self.bBlocked = True def calcOccur (self): self.nOccur = math.ceil((self.nOccur / (self.nMulti+1)) / self.nDup) def calcFreq (self, nTot): self.fFreq = (self.nOccur * 100) / nTot if nTot else 0 self.cFq = getIfq(self.fFreq) def calcMetagraphe (self): t = metagraphe.getMetagraphe(self.sFlexion, self.sMorph) self.metagfx = t[0] if not t[1] else t[0]+"/"+t[1] def calcMetaphone2 (self): |
︙ | ︙ |