Overview
| Comment: | [build] add description parameter |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | build |
| Files: | files | file ages | folders |
| SHA3-256: |
7a0938237b38e55a2011b5d5b952d74c |
| User & Date: | olr on 2019-03-26 19:26:48 |
| Other Links: | manifest | tags |
Context
|
2019-03-26
| ||
| 19:28 | [fr] dictionary update: v6.4 check-in: 1fe8518419 user: olr tags: trunk, fr | |
| 19:26 | [build] add description parameter check-in: 7a0938237b user: olr tags: trunk, build | |
| 19:04 | [fr] faux positif check-in: a3136cf8c4 user: olr tags: trunk, fr | |
Changes
Modified lex_build.py from [346704203c] to [c16f0b3559].
1 2 3 4 5 6 7 8 9 10 11 | #!python3 # Lexicon builder import argparse from distutils import dir_util import graphspell.dawg as fsa from graphspell.ibdawg import IBDAWG | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 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 |
#!python3
# Lexicon builder
import argparse
from distutils import dir_util
import graphspell.dawg as fsa
from graphspell.ibdawg import IBDAWG
def build (spfSrc, sLangCode, sLangName, sfDict, bJSON=False, sDicName="", sDescription="", sFilter="", cStemmingMethod="S", nCompressMethod=1):
"transform a text lexicon as a binary indexable dictionary"
oDAWG = fsa.DAWG(spfSrc, cStemmingMethod, sLangCode, sLangName, sDicName, sDescription, sFilter)
dir_util.mkpath("graphspell/_dictionaries")
oDAWG.writeInfo("graphspell/_dictionaries/" + sfDict + ".info.txt")
oDAWG.writeBinary("graphspell/_dictionaries/" + sfDict + ".bdic", int(nCompressMethod))
if bJSON:
dir_util.mkpath("graphspell-js/_dictionaries")
oDic = IBDAWG(sfDict + ".bdic")
oDic.writeAsJSObject("graphspell-js/_dictionaries/" + sfDict + ".json", bBinaryDictAsHexString=True)
def main ():
xParser = argparse.ArgumentParser()
xParser.add_argument("src_lexicon", type=str, help="path and file name of the source lexicon")
xParser.add_argument("lang_code", type=str, help="language code")
xParser.add_argument("lang_name", type=str, help="language name")
xParser.add_argument("dic_filename", type=str, help="dictionary file name (without extension)")
xParser.add_argument("-js", "--json", help="Build dictionary in JSON", action="store_true")
xParser.add_argument("-s", "--stemming", help="stemming method: S=suffixes, A=affixes, N=no stemming", type=str, choices=["S", "A", "N"], default="S")
xParser.add_argument("-c", "--compress", help="compression method: 1, 2 (beta), 3, (beta)", type=int, choices=[1, 2, 3], default=1)
xArgs = xParser.parse_args()
build(xArgs.src_lexicon, xArgs.lang_code, xArgs.lang_name, xArgs.dic_filename, "", xArgs.json)
if __name__ == '__main__':
main()
|
Modified make.py from [38cc0aad8b] to [50643cf0e8].
| ︙ | ︙ | |||
348 349 350 351 352 353 354 |
"build binary dictionary for Graphspell from lexicons"
if sType == "main":
spfLexSrc = dVars['lexicon_src']
lSfDictDst = dVars['dic_filenames'].split(",")
lDicName = dVars['dic_name'].split(",")
lFilter = dVars['dic_filter'].split(",")
for sfDictDst, sDicName, sFilter in zip(lSfDictDst, lDicName, lFilter):
| | | | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
"build binary dictionary for Graphspell from lexicons"
if sType == "main":
spfLexSrc = dVars['lexicon_src']
lSfDictDst = dVars['dic_filenames'].split(",")
lDicName = dVars['dic_name'].split(",")
lFilter = dVars['dic_filter'].split(",")
for sfDictDst, sDicName, sFilter in zip(lSfDictDst, lDicName, lFilter):
lex_build.build(spfLexSrc, dVars['lang'], dVars['lang_name'], sfDictDst, bJavaScript, sDicName, "", sFilter, dVars['stemming_method'], int(dVars['fsa_method']))
else:
if sType == "extended":
spfLexSrc = dVars['lexicon_extended_src']
sfDictDst = dVars['dic_extended_filename']
sDicName = dVars['dic_extended_name']
elif sType == "community":
spfLexSrc = dVars['lexicon_community_src']
sfDictDst = dVars['dic_community_filename']
sDicName = dVars['dic_community_name']
elif sType == "personal":
spfLexSrc = dVars['lexicon_personal_src']
sfDictDst = dVars['dic_personal_filename']
sDicName = dVars['dic_personal_name']
lex_build.build(spfLexSrc, dVars['lang'], dVars['lang_name'], sfDictDst, bJavaScript, sDicName, "", "", dVars['stemming_method'], int(dVars['fsa_method']))
def main ():
"build Grammalecte with requested options"
print("Python: " + sys.version)
xParser = argparse.ArgumentParser()
|
| ︙ | ︙ |