bootstrap apertium语言模块和对
apertium-init的Python项目详细描述
Apertium Init(即Apertium Bootstrap)
使用apertium-init.py
引导apertium语言模块和对。
用法
首先,download the script
或者使用pip install apertium-init
从PyPi安装。
使用取决于所需的模块,如下所述。记住
在生成的模块中搜索TODO
以添加示例语句等。
单语lttoolbox模块
使用 lttoolbox形式主义,
$ python3 apertium-init.py foo
要同时引导和编译它,
$ python3 apertium-init.py foo &&(cd apertium-foo/ && ./autogen.sh && make )
单语hfst模块
使用 HFST形式主义,
$ python3 apertium-init.py foo --analyser=hfst
要同时引导和编译它,
$ python3 apertium-init.py foo --analyser=hfst &&(cd apertium-foo/ && ./autogen.sh && make )
要包含用于处理前缀的twoc文件,
$ python3 apertium-init.py foo --analyser=hfst --with-twoc
要包含一个spellrelax文件来处理排版差异,
$ python3 apertium-init.py foo --analyser=hfst --with-spellrelax
双语LTtoolbox模块
启动双语语言模块apertium-foo-bar
,其中
单语包apertium-foo
和apertium-bar
都使用
lttoolbox形式主义,
$ python3 apertium-init.py foo-bar
要同时引导和编译它,
$ python3 apertium-init.py foo-bar &&(cd apertium-foo-bar/ && ./autogen.sh && make test)
双语hfst/lttoolbox模块
启动双语语言模块apertium-foo-bar
,其中
单语包装apertium-foo
和apertium-bar
使用
HFST形式主义和/或
lttoolbox形式主义,
$ python3 apertium-init.py foo-bar --analysers=hfst # Both foo and bar use HFST $ python3 apertium-init.py foo-bar --analyser1=hfst # Only foo (first language) uses HFST $ python3 apertium-init.py foo-bar --analyser2=hfst # Only bar (second language) uses HFST
要同时引导和编译它,
$ python3 apertium-init.py foo-bar --analysers=hfst &&(cd apertium-foo-bar/ && ./autogen.sh && make test)# Both foo and bar use HFST $ python3 apertium-init.py foo-bar --analyser1=hfst &&(cd apertium-foo-bar/ && ./autogen.sh && make test)# Only foo (first language) uses HFST $ python3 apertium-init.py foo-bar --analyser2=hfst &&(cd apertium-foo-bar/ && ./autogen.sh && make test)# Only bar (second language) uses HFST
双语模块,用于不使用Apertium Tagger或CG的单语者
要在一个或两个单语模块不使用Apertium标记器时引导双语模块,
$ python3 apertium-init.py foo-bar --no-prob1 # Only foo doesn't have .prob $ python3 apertium-init.py foo-bar --no-prob2 # Only bar doesn't have .prop $ python3 apertium-init.py foo-bar --no-prob1 --no-prob2 # Neither foo nor bar have .prob
要在一个或两个单语模块不使用CG时引导双语模块,
$ python3 apertium-init.py foo-bar --no-rlx1 # Only foo doesn't have .rlx $ python3 apertium-init.py foo-bar --no-rlx2 # Only bar doesn't have .rlx $ python3 apertium-init.py foo-bar --no-rlx1 --no-rlx2 # Neither foo nor bar have .rlx
推送到github
要引导模块或对并将其添加到apertium incubator,
$ python3 apertium-init.py foo -p # Bootstrap module apertium-foo and push to Github $ python3 apertium-init.py foo-bar -p # Bootstrap pair apertium-foo-bar and push to Github
要指定推送的用户名(而不是依赖于git config
),
$ python3 apertium-init.py foo -p -u bar # Bootstrap module apertium-foo and push to Github under username bar
开发
更新vanilla文件后,运行./updateBootstraper.py
以更新
apertium-init.py
中的相关编码文件。或者,在根目录中运行make
更新所有编码文件。
您还可以执行sudo make install
来安装到/usr/local/bin/apertium-init
或者,例如PREFIX=$HOME/local make install
安装到$HOME/local/bin/apertium-init
。
使用pipenv install --dev
安装
开发,如绒布。
释放
按照上面的说明安装开发资源之后, 部署到pypi相对简单。
使用make dist
在dist
目录中创建可分发的源
可以通过pip
本地安装。
使用make test-release
和make release
部署到testing PyPi instance
分别是production PyPi instance。要么
步骤需要具有访问apertium init权限的pypi身份验证凭据
包裹。