|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| TL/ | | 06-May-2025 | - | 1,546 | 1,484 |
| collaboration/ | | 06-May-2025 | - | 256,189 | 252,293 |
| data/language-codes/ | | 06-May-2025 | - | 67,341 | 65,848 |
| docs/ | | 06-May-2025 | - | 1,795 | 1,532 |
| encodings/ | | 06-May-2025 | - | 24,084 | 23,911 |
| hyph-utf8/ | | 06-May-2025 | - | 1,176,343 | 1,174,260 |
| lib/tex/ | | 06-May-2025 | - | | |
| misc/ | | 06-May-2025 | - | 17,254 | 17,249 |
| ohos/ | | 06-May-2025 | - | 2,269 | 1,879 |
| old/ | | 06-May-2025 | - | 154,717 | 154,047 |
| source/ | | 06-May-2025 | - | 187,367 | 186,622 |
| tests/ | | 06-May-2025 | - | 19,589 | 17,960 |
| tools/ | | 06-May-2025 | - | 802 | 682 |
| webpage/ | | 06-May-2025 | - | 7,227 | 5,912 |
| .gitignore | D | 06-May-2025 | 25 | 4 | 3 |
| .rspec | D | 06-May-2025 | 55 | 2 | 1 |
| .travis.yml | D | 06-May-2025 | 30 | 4 | 3 |
| BUILD.gn | D | 06-May-2025 | 2 KiB | 62 | 54 |
| CONTRIBUTING.md | D | 06-May-2025 | 674 | 11 | 8 |
| Gemfile | D | 06-May-2025 | 207 | 12 | 11 |
| LICENSE | D | 06-May-2025 | 5 KiB | 119 | 88 |
| LICENSE-BSD3 | D | 06-May-2025 | 1.5 KiB | 29 | 23 |
| LICENSE-GPL | D | 06-May-2025 | 12.2 KiB | 248 | 200 |
| LICENSE-GPL2 | D | 06-May-2025 | 17.7 KiB | 340 | 281 |
| LICENSE-LGPL2.1 | D | 06-May-2025 | 25.8 KiB | 501 | 417 |
| LICENSE-LGPL3 | D | 06-May-2025 | 7.5 KiB | 165 | 128 |
| LICENSE-LPPL | D | 06-May-2025 | 8.9 KiB | 211 | 161 |
| LICENSE-LPPL1.2 | D | 06-May-2025 | 14.1 KiB | 315 | 245 |
| LICENSE-LPPL1.3 | D | 06-May-2025 | 18.6 KiB | 415 | 329 |
| LICENSE-MIT | D | 06-May-2025 | 1.1 KiB | 21 | 17 |
| LICENSE-MPL1.1 | D | 06-May-2025 | 25.2 KiB | 469 | 396 |
| OAT.xml | D | 06-May-2025 | 7.3 KiB | 103 | 55 |
| README | D | 06-May-2025 | 222 | 11 | 8 |
| README.Norwegian | D | 06-May-2025 | 1.7 KiB | 35 | 28 |
| README.OpenSource | D | 06-May-2025 | 508 | 11 | 11 |
| README.md | D | 06-May-2025 | 1.3 KiB | 25 | 20 |
| README_en.md | D | 06-May-2025 | 8.5 KiB | 246 | 223 |
| README_zh.md | D | 06-May-2025 | 8.6 KiB | 252 | 228 |
| ROADMAP | D | 06-May-2025 | 9.7 KiB | 563 | 435 |
| Rakefile | D | 06-May-2025 | 855 | 26 | 22 |
| TODO | D | 06-May-2025 | 11.2 KiB | 274 | 222 |
| bundle.json | D | 06-May-2025 | 763 | 38 | 38 |
| tex-hyphen-language.gem | D | 06-May-2025 | 1.2 MiB | | |
| tex-hyphen-language.gemspec | D | 06-May-2025 | 715 | 16 | 15 |
| tex-hyphen.gni | D | 06-May-2025 | 5.6 KiB | 248 | 245 |
README
1CTAN
2 (I don't like the name)
3 the files with patterns as authors should submit it
4source
5 sources of pattern files, like programs to generate them or word lists
6 please contribute!
7TL
8 files that should go to TeX Live?
9
10
11
README.Norwegian
1*NOTES ABOUT NORWEGIAN*
2
3The Norwegian language has two written forms, called bokmål and nynorsk, whose
4history dates back to the 19th century during the Danish occupation. The most
5widely used one of them is bokmål, but nynorsk is used as well, and they are
6both official languages of Norway. The ISO 639-1 code are ‘nb’ for bokmål and
7‘nn’ for nynorsk. There is also a ISO 639-1 code for “Norwegian”, ‘no’.
8
9 Traditionally, LaTeX has been supporting Norwegian under the common name
10“norsk”, with “norwegian” as an alias in language.dat. The captions in Babel's
11norsk.ldf are in bokmål. Since a few months, there are two additional pattern
12files available on CTAN labelled as bokmål and nynorsk, which correct
13hyphenations for a small number of words – two words for each language,
14actually: in bokmål, attende and betre are hyphenated at-ten-de and be-tre,
15whereas in nynorsk it's att-en-de and bet-re. With the current patterns for
16“Norwegian” (nohyphbx.tex), though, they are hyphenated atten-de and betre,
17which is correct in neither language. The new pattern files provide therefore
18provide tiny improvements.
19
20 Since the Babel's current support is suitable for bokmål, and the bokmål
21patterns are only slightly different from the current ones, we can use them as
22the successor to the norsk patterns, and ship the nynorsk patterns in addition
23to this. We thus can use the following definitions in language.no.dat:
24
25 norsk loadhyph-nb.tex
26 =norwegian
27 =bokmal
28 nynorsk loadhyph-nn.tex
29
30 Of course, the nynorsk patterns still can't be used directly as long as there
31is no Babel support, but we hope that support will be added on the future, and
32the patterns will already be there.
33
34 Arthur, 2008-06-11
35
README.OpenSource
1[
2 {
3 "Name": "TEX hyphenation patterns",
4 "License": "MIT;GPL;GPL-2;LGPL-2.1;LGPL-3;LPPL-1;LPPL-1.2;LPPL-1.3;MPL-1.1",
5 "License File": "LICENSE-MIT;LICENSE-GPL;LICENSE-GPL2;LICENSE-LGPL2.1;LICENSE-LGPL3;LICENSE-LPPL;LICENSE-LPPL1.2;LICENSE-LPPL1.3;LICENSE-MPL1.1",
6 "Version Number": "CTAN-2021.03.21",
7 "Owner": "wangxiaokai@huawei.com",
8 "Upstream URL": "https://github.com/hyphenation/tex-hyphen",
9 "Description": "This is the central repository for all hyphenation patterns"
10 }
11]
README.md
1[](https://travis-ci.com/hyphenation/tex-hyphen)
2
3This is the central repository for all hyphenation patterns (that we know of).
4These patterns are encoded in UTF-8, but can also be used with 8-bit TeX
5engines such as pdfTeX with the help of mechanisms provided with the package.
6It is meant to be a low-level package and is integrated with all major TeX
7distributions (TeX Live, MiKTeX, W32TeX); most TeX users should thus not
8concern themselves with this package, unless of course they’re working on the
9hyphenation patterns themselves.
10
11We upload the package to CTAN regularly and use git tags to identify versions;
12a CTAN upload has a version date in the form `yyyy-mm-dd`, corresponding to tag
13`CTAN-yyyy.mm.dd` in this git repository. Because the package contains
14contributions from many different sources that are not updated at the same
15time, we felt this was this best choice for version identifiers.
16
17If you are an author of hyphenation patterns and want to add or update them,
18please contact the maintainers through the mailing list: tex-hyphen@tug.org
19You can also visit the [TeX hyphenation page](http://www.hyphenation.org/tex) for more
20information and technical details.
21
22# Running
23`bundle` (or `bundle install`)
24`bundle exec rake` runs the default task in the Rakefile.
25
README_en.md
1# tex-hyphen
2## Introduction
3tex-hyphen is a hyphenation pattern library for the TeX system. It can correctly hyphenate words in multiple languages to improve typesetting quality.
4
5Source: tex-hyphen
6URL: https://github.com/hyphenation/tex-hyphen
7Version: CTAN-2021.03.21
8License: Various combinations
9
10## Background
11In multilingual document processing and typesetting, correct hyphenation is crucial. tex-hyphen provides a comprehensive set of hyphenation patterns that support multiple languages, ensuring high-quality typesetting. Introducing tex-hyphen into OpenHarmony can significantly enhance the typesetting quality of multilingual documents.
12
13## Language Classification
14The tex directory contains multiple hyphenation patterns from TeX hyphenation patterns, each using different open-source licenses. The classification is as follows:
15* MIT License
16* GPL, GPL 2
17* LGPL 1, LGPL 2.1
18* LPPL 1, LPPL 1.2, LPPL 1.3
19* MPL 1.1
20* BSD 3
21
22Languages used in OHOS,the following languages all use a user-friendly open-source license.:
23* be - Belarusian
24* cs - Czech
25* cy - Welsh
26* da - Danish
27* de-1901 - German (1901 orthography)
28* de-ch-1901 - Swiss German (1901 orthography)
29* el-monoton - Modern Greek (monotonic)
30* el-polyton - Modern Greek (polytonic)
31* en-gb - British English
32* en-us - American English
33* es - Spanish
34* et - Estonian
35* fr - French
36* ga - Irish
37* gl - Galician
38* hr - Croatian
39* hu - Hungarian
40* hy - Armenian
41* id - Indonesian
42* is - Icelandic
43* it - Italian
44* ka - Georgian
45* lt - Lithuanian
46* lv - Latvian
47* mk - Macedonian
48* mn-cyrl - Mongolian (Cyrillic script)
49* nl - Dutch
50* pt - Portuguese
51* ru - Russian
52* sh-cyrl - Serbo-Croatian (Cyrillic script)
53* sh-latn - Serbo-Croatian (Latin script)
54* sk - Slovak
55* sl - Slovenian
56* sr-cyrl - Serbian (Cyrillic script)
57* sv - Swedish
58* th - Thai
59* tk - Turkmen
60* tr - Turkish
61* uk - Ukrainian
62* zh-latn-pinyin - Chinese (Pinyin)
63
64## Directory Structure
65```
66third_party_tex-hyphen
67├── collaboration
68│ ├── original
69│ ├── repository
70│ └── source
71├── data/language-codes
72├── docs
73│ └── languages
74├── encoding
75│ └── data
76├── hyph-utf8
77│ ├── doc
78│ ├── source
79│ └── tex
80├── misc
81├── ohos
82│ ├── src
83│ └── hpb-binary
84├── old
85├── source
86├── tests
87├── TL
88├── tools
89└── webpage
90```
91collaboration/ JavaScript dependencies and XML configuration files required by the tex-hyphen official website
92ohos/ OpenHarmony compilation files and hpb binary files
93data/ Language library
94docs/ Documentation related to hyphenation
95encoding/ Contains files related to character set encodings, handling different character sets.
96hyph-utf8/ Hyphenation pattern package for TeX, providing hyphenation patterns encoded in UTF-8
97misc/ An example of a hyphenation file for the en-gb language.
98old/ Contains older hyphenation pattern files that may have been updated or replaced.
99source/ Contains source code files used to generate and process hyphenation patterns.
100TL/ tlpsrc resource files, which are package source files in the TeX Live system, used to describe metadata of TeX Live packages
101tools/ Contains utility scripts to assist in processing hyphenation pattern files.
102webpage/ tex-hyphen official homepage, providing detailed information and resources about the hyph-utf8 package
103
104
105## Value Brought to OpenHarmony
106**1. Improved Typesetting Quality:** By introducing tex-hyphen, OpenHarmony can achieve more accurate hyphenation, improving the readability and aesthetics of documents.
107**2. Enhanced Small Screen Experience:** Using hyphenation patterns on small screen devices can display more content in the same area, enhancing the reading experience.
108
109## How to Use tex-hyphen in OpenHarmony
110### 1. Compile the HPB Binary
111#### Compilation Steps
112Open the terminal (or command prompt), navigate to the directory containing the [hyphen_pattern_processor.cpp](ohos%2Fsrc%2Fhyphen-build%2Fhyphen_pattern_processor.cpp) file, and run the following command to compile the code:
113
114```
115cd ohos/src/hyphen-build/
116g++ -g -Wall hyphen_pattern_processor.cpp -o transform
117```
118
119Explanation of the command:
120- g++: Invoke the GCC compiler.
121- -g: Add debugging information.
122- -Wall: Enable all warnings.
123- hyphen_pattern_processor.cpp: Source code file.
124- -o transform: Specify the output executable file name as transform.
125
126#### Execution Steps
127After compilation, you can run the generated executable file and process the specified .tex file using the following command:
128
129```
130./transform hyph-en-us.tex ./out/
131```
132
133Explanation of the command:
134- ./transform: Run the generated transform executable file.
135- hyph-en-us.tex: Input file (the .tex file to be processed).
136- ./out/: Output directory (the processed files will be stored in this directory).
137
138After successful execution, the processed files will be stored in the ./out/ directory.
139
140#### Batch Compilation
141- Dependencies:
142```
143jq:JSON file parsing tool
144```
145- Configure the files to be compiled using the JSON configuration file [build-tex.json](ohos%2Fbuild%2Fbuild-tex.json):
146```
147[
148 {
149 "filename": "example1.tex"
150 },
151 {
152 "filename": "example2.tex"
153 }
154]
155```
156filename: Specifies the name of the TeX file to be compiled. The file must be located in the [tex](hyph-utf8%2Ftex%2Fgeneric%2Fhyph-utf8%2Fpatterns%2Ftex) directory.
157
158The build-tex.json file defines all supported languages, and the script will compile all of them by default. Developers can control the addition or removal of languages by modifying build-tex.json.
159For example:
160To remove the example2 language, modify the file as follows:
161```
162[
163 {
164 "filename": "example1.tex"
165 }
166]
167```
168To add the example3 language, modify the file as follows:
169```
170[
171 {
172 "filename": "example1.tex"
173 },
174 {
175 "filename": "example2.tex"
176 },
177 {
178 "filename": "example3.tex"
179 }
180]
181```
182
183- Open a terminal (or command prompt), navigate to the directory containing the [build.sh](ohos%2Fbuild%2Fbuild.sh) file, and run the following commands to compile the code:
184```
185chmod +x build.sh
186./build.sh
187```
188After successful compilation, the compiled output will be placed in the ./out_hpb directory.
189### 2. Parse Word Hyphenation Positions Using HPB
190#### compilation Steps
191Open a terminal (or command prompt), navigate to the directory containing the [hyphen_pattern_reader.cpp](ohos%2Fsrc%2Fhyphen-build%2Fhyphen_pattern_reader.cpp) file, and run the following command to compile the code:
192
193```
194cd ohos/src/hyphen-build/
195g++ -g -Wall hyphen_pattern_reader.cpp -o reader
196```
197Explanation of the command:
198- g++: Calls the GCC compiler.
199- -g: Adds debugging information.
200- -Wall: Enables all warnings.
201- hyphen_pattern_reader.cpp: The source code file.
202- -o reader: Specifies the output executable file name as reader.
203
204#### Running Steps
205After compilation, you can parse the hyphenation positions of words in the specified language using the following command:
206
207```
208./reader hyph-en-us.hpb helloworld
209```
210Explanation of the command:
211- ./reader: Runs the generated reader executable.
212- hyph-en-us.hpb: The input file (the binary file to be parsed).
213- helloworld: The word to be parsed.
214
215After successful execution, the log will output the hyphenation information of the parsed word.
216
217### 3. Batch Verification
218You can use the [generate_report.py](ohos%2Ftest%2Fgenerate_report.py) Python script to read the [report_config.json](ohos%2Ftest%2Freport_config.json) configuration file and perform batch verification to check the validity of the generated binary files.
219#### Preparation
220- Python 3.x
221- transform and reader executables, placed in the same directory as the script.
222- report_config.json configuration file
223
224#### Usage
2251. Prepare the Configuration File First, create a JSON configuration file named report_config.json with the following content:
226```
227{
228 "file_path": "path/to/tex/files",
229 "tex_files": [
230 {
231 "filename": "example.tex",
232 "words": ["word1", "word2", "word3", "word4", "word5", "word6", "word7", "word8", "word9", "word10"]
233 },
234 ...
235 ]
236}
237```
2382. Run the Script Run the following command in the terminal:
239```
240python generate_report.py report_config.json
241```
2423. Log Files The script will generate a timestamped subdirectory under the report directory, containing the following log files:
243```
244match.log: Records successful matches.
245unmatch.log: Records unsuccessful matches.
246```
README_zh.md
1# 三方开源软件tex-hyphen
2
3## tex-hyphen简介
4tex-hyphen是一个用于TeX系统的断字模式库,它能够在多种语言中正确地将单词断行,以改善排版效果。
5
6来源:tex-hyphen
7URL:https://github.com/hyphenation/tex-hyphen
8版本:CTAN-2021.03.21
9License:多种组合
10
11## 引入背景陈述
12在多语言文档处理和排版中,正确的断字处理是至关重要的。tex-hyphen 提供了一套通用的断字模式,支持多种语言,为高质量的排版提供了基础保障。在OpenHarmony中,引入tex-hyphen可以显著提升多语言文档的排版质量。
13
14## 语种归类
15tex目录下包含了多个来自TeX hyphenations patterns的连字符规则,不同语种使用的开源许可证各不相同,整理归类:
16* MIT License
17* GPL,GPL 2
18* LGPL 1,LGPL 2.1
19* LPPL 1,LPPL 1.2,LPPL 1.3
20* MPL 1.1
21* BSD 3
22
23OHOS中使用以下语种资源,以下语种均使用友好型开源协议:
24* be - 白俄罗斯语(Belarusian)
25* cs - 捷克语(Czech)
26* cy - 威尔士语(Welsh)
27* da - 丹麦语(Danish)
28* de-1901 - 德语(German,1901orthography)
29* de-ch-1901 - 瑞士德语(SwissGerman,1901orthography)
30* el-monoton - 现代希腊语(ModernGreek,monotonic)
31* el-polyton - 现代希腊语(ModernGreek,polytonic)
32* en-gb - 英式英语(BritishEnglish)
33* en-us - 美式英语(AmericanEnglish)
34* es - 西班牙语(Spanish)
35* et - 爱沙尼亚语(Estonian)
36* fr - 法语(French)
37* ga - 爱尔兰语(Irish)
38* gl - 加利西亚语(Galician)
39* hr - 克罗地亚语(Croatian)
40* hu - 匈牙利语(Hungarian)
41* hy - 亚美尼亚语(Armenian)
42* id - 印度尼西亚语(Indonesian)
43* is - 冰岛语(Icelandic)
44* it - 意大利语(Italian)
45* ka - 格鲁吉亚语(Georgian)
46* lt - 立陶宛语(Lithuanian)
47* lv - 拉脱维亚语(Latvian)
48* mk - 马其顿语(Macedonian)
49* mn-cyrl - 蒙古语(Mongolian,Cyrillicscript)
50* nl - 荷兰语(Dutch)
51* pt - 葡萄牙语(Portuguese)
52* ru - 俄语(Russian)
53* sh-cyrl - 塞尔维亚-克罗地亚语(Serbo-Croatian,Cyrillicscript)
54* sh-latn - 塞尔维亚-克罗地亚语(Serbo-Croatian,Latinscript)
55* sk - 斯洛伐克语(Slovak)
56* sl - 斯洛文尼亚语(Slovenian)
57* sr-cyrl - 塞尔维亚语(Serbian,Cyrillicscript)
58* sv - 瑞典语(Swedish)
59* th - 泰语(Thai)
60* tk - 土库曼语(Turkmen)
61* tr - 土耳其语(Turkish)
62* uk - 乌克兰语(Ukrainian)
63* zh-latn-pinyin - 汉语拼音(Chinese,Pinyin)
64
65## 目录结构
66
67```
68third_party_tex-hyphen
69├── collaboration
70│ ├── original
71│ ├── repository
72│ └── source
73├── data/language-codes
74├── docs
75│ └── languages
76├── encoding
77│ └── data
78├── hyph-utf8
79│ ├── doc
80│ ├── source
81│ └── tex
82├── misc
83├── ohos
84│ ├── src
85│ └── hpb-binary
86├── old
87├── source
88├── tests
89├── TL
90├── tools
91└── webpage
92
93collaboration/ tex-hyphen官网依赖的js脚本、xml配置文件
94ohos/ OpenHarmony编译文件和hpb二进制文件
95data/ 语种库
96docs/ 项目的文档资料
97encoding/ 包含编码相关的文件,用于处理不同字符集的编码问题。
98hyph-utf8/ TeX 的断字模式包,提供了以 UTF-8 编码的断字模式
99misc/ en-gb语种断词文件案例
100old/ 包含一些旧的断词模式文件,这些文件可能已经被更新或替换。
101source/ 包含源代码文件,用于生成和处理断词模式。
102TL/ tlpsrc资源文件,tlpsrc文件是TeX Live系统中的一个包源文件,用于描述TeX Live包的元数据
103tools/ 包含一些工具脚本,用于辅助处理断词模式文件。
104webpage/ tex-hyphen官网主页,提供了关于 hyph-utf8 包的详细信息和资源
105```
106
107## 为 OpenHarmony 带来的价值
108
109**1.提高排版质量:** 通过引入 tex-hyphen,OpenHarmony 可以实现更为精准的断字处理,提高文档的可读性和美观度。
110**2.提升小屏设备体验:** 在小屏设备中使用断词模式,能够在相同区域内显示更多内容,提升阅读体验。
111
112## OpenHarmony中如何使用tex-hyphen
113
114### 1、编译hpb二进制
115#### 编译步骤
116打开终端(或命令提示符),导航到包含 [hyphen_pattern_processor.cpp](ohos%2Fsrc%2Fhyphen-build%2Fhyphen_pattern_processor.cpp) 文件的目录,并运行以下命令来编译代码:
117
118```
119cd ohos/src/hyphen-build/
120g++ -g -Wall hyphen_pattern_processor.cpp -o transform
121```
122上述命令说明:
123- g++: 调用 GCC 编译器。
124- -g: 添加调试信息。
125- -Wall: 启用所有警告。
126- hyphen_pattern_processor.cpp: 源代码文件。
127- -o transform: 指定输出的可执行文件名为 transform。
128
129#### 运行步骤
130编译完成后,可以使用以下命令来运行生成的可执行文件,并处理指定的 .tex 文件:
131```
132./transform hyph-en-us.tex ./out/
133```
134上述命令说明:
135- ./transform: 运行生成的 transform 可执行文件。
136- hyph-en-us.tex: 输入文件(待处理的 .tex 文件)。
137- ./out/: 输出目录(处理后的文件将存储在此目录中)。
138
139运行成功后,处理后的.hpb二进制文件将存储在 ./out/ 目录中。
140
141#### 批量编译
142- 依赖:
143```
144jq:json文件解析工具
145```
146
147- 通过json配置文件[build-tex.json](ohos%2Fbuild%2Fbuild-tex.json),配置需要编译的文件。
148```
149[
150 {
151 "filename": "example1.tex"
152 },
153 {
154 "filename": "example2.tex"
155 }
156]
157```
158**filename** :指定需要编译的tex文件名,文件须在 [tex](hyph-utf8%2Ftex%2Fgeneric%2Fhyph-utf8%2Fpatterns%2Ftex) 目录下
159
160build-tex.json文件中定义了全量支持语种,脚本会默认全量编译。开发者可通过修改build-tex.json来控制新增或者删除语种。
161例如:
162需要移除example2语种,修改结果如下:
163```
164[
165 {
166 "filename": "example1.tex"
167 }
168]
169```
170需要新增example3语种,修改结果如下:
171```
172[
173 {
174 "filename": "example1.tex"
175 },
176 {
177 "filename": "example2.tex"
178 },
179 {
180 "filename": "example3.tex"
181 }
182]
183```
184
185- 打开终端(或命令提示符),导航到包含 [build.sh](ohos%2Fbuild%2Fbuild.sh) 文件的目录,并运行以下命令来编译代码
186```
187chmod +x build.sh
188./build.sh
189```
190编译成功后,编译产物将会放置在./out_hpb目录下
191
192### 2、通过hpb解析单词断词位置
193#### 编译步骤
194打开终端(或命令提示符),导航到包含 [hyphen_pattern_reader.cpp](ohos%2Fsrc%2Fhyphen-build%2Fhyphen_pattern_reader.cpp) 文件的目录,并运行以下命令来编译代码:
195
196```
197cd ohos/src/hyphen-build/
198g++ -g -Wall hyphen_pattern_reader.cpp -o reader
199```
200上述命令说明:
201- g++: 调用 GCC 编译器。
202- -g: 添加调试信息。
203- -Wall: 启用所有警告。
204- hyphen_pattern_reader.cpp: 源代码文件。
205- -o reader: 指定输出的可执行文件名为 reader。
206
207#### 运行步骤
208编译完成后,可以使用以下命令来解析对应语种的单词:
209```
210./reader hyph-en-us.hpb helloworld
211```
212上述命令说明:
213- ./reader: 运行生成的 reader 可执行文件。
214- hyph-en-us.hpb: 输入文件(待解析的二进制文件)。
215- helloworld: 待解析的单词。
216
217运行成功后,日志中将会输出本次解析的单词断词信息。
218
219### 3、自动化验证
220通过[generate_report.py](ohos%2Ftest%2Fgenerate_report.py) Python脚本读取[report_config.json](ohos%2Ftest%2Freport_config.json)配置文件,可实现批量校验生成的二进制文件是否有效
221#### 准备
222- Python 3.x
223- transform和reader可执行文件,并将可执行文件放在脚本同一级目录
224- report_config.json配置文件
225#### 使用方法
2261. 准备配置文件
227首先,创建一个JSON格式的配置文件report_config.json,包含以下内容:
228```
229 {
230 "file_path": "path/to/tex/files",
231 "tex_files": [
232 {
233 "filename": "example.tex",
234 "words": ["word1", "word2", "word3", "word4", "word5", "word6", "word7", "word8", "word9", "word10"]
235 },
236 ...
237 ]
238 }
239```
240- file_path:TeX文件所在的目录路径。
241- tex_files:包含多个TeX文件及其对应的单词列表。
2422. 运行脚本
243在终端中运行以下命令:
244```
245python generate_report.py report_config.json
246```
2473. 日志文件
248脚本会在 report 目录下生成一个带有时间戳的子目录,包含以下日志文件:
249```
250match.log:记录匹配成功的结果。
251unmatch.log:记录匹配失败的结果。
252```