85 lines
2 KiB
Markdown
85 lines
2 KiB
Markdown
# Buhong
|
||
a Taigi processing tool
|
||
|
||
## Requirements
|
||
- libssl-dev: 3.0.13
|
||
- rust: 1.99.1
|
||
- cargo: 1.99.1
|
||
- wasm-pack: 0.15.1
|
||
- only if you want to compile it to browser-runnable WASM code. It's recommended to install with
|
||
`cargo install wasm-pack`
|
||
|
||
## How to build the wasm version
|
||
|
||
- To build the browser-runnable version, run `wasm-pack build --target web` inside the project directory.
|
||
- to use in the `.html` file, insert the code:
|
||
```
|
||
<script type="module">
|
||
import init, { f } from "./pkg/buhong.js"; // f is just an example
|
||
|
||
await init();
|
||
f(x, y);
|
||
</script>
|
||
```
|
||
|
||
## Other documents
|
||
|
||
- For the implement details of the tool, see `./docs`.
|
||
|
||
## 了後ê做法
|
||
- 將台文語料轉作數字台羅需要函數
|
||
- 小寫化臺語文、數字加escape字元(1 => \1),koh "\" => "\\"
|
||
- 切臺語ê句變做音節
|
||
- 若準講判定是臺語音節,轉做數字音節
|
||
- 就變成按呢
|
||
```
|
||
我共你講 gua2 ka7 li2 kong2
|
||
代誌 tai7-tsi3
|
||
|
||
|
||
```
|
||
|
||
- 了後處理做:
|
||
|
||
```
|
||
s_arrayized_series = []
|
||
for s in 句ê集:
|
||
s_arrayized = arrayize(s);
|
||
s_arrayized = ["HEAD"].append(s_arrayized)
|
||
s_arrayized_series.push(s_arrayized)
|
||
|
||
```
|
||
tshiau揣:,代先按呢切:
|
||
|
||
```
|
||
阮老師欲來。 == n字
|
||
"gun2" " " "lau7" "-" "su1" " " "beh4" " " "lai5" "." 2n-1字
|
||
```
|
||
|
||
先檢查「羅字數量 == 漢字數量*2 - 1」,無就修正語料
|
||
|
||
```
|
||
for j in range(1,len(sentencePair[i].漢)):
|
||
漢 = sentencePair[i].漢[j]
|
||
頂字 = sentencePair[i].漢[j-1]
|
||
羅字 = sentencePair[i].羅[2*j-1]
|
||
羅字頂符 = sentencePair[i].羅[2*j-2]
|
||
if 羅字頂符 in ["-", "--"]": // 空白不算
|
||
頭前敢欲連字 = true
|
||
else:
|
||
false
|
||
HASHMAPHEAD = 漢 + 羅 + 頂字 + 頭前敢欲連字.as_str()
|
||
if not HASHMAPHEAD in freq_dict.keys()
|
||
freq_dict(HASHMAPHEAD) = [漢,羅,頂字,頭前敢欲連字,1]
|
||
else
|
||
freq_dict(HASHMAPHEAD) = [漢,羅,頂字,頭前敢欲連字,freq_dict["HASHMAPHEAD"]["freq"]+1]
|
||
```
|
||
|
||
```
|
||
漢,羅,頂字,頭前敢欲連字,出現改數
|
||
扁,pinn2,水,false,2
|
||
```
|
||
|
||
|
||
|
||
```
|