Commit
·
d64d0a2
1
Parent(s):
210d258
Update README.md
Browse files
README.md
CHANGED
@@ -1,7 +1,34 @@
|
|
1 |
# Transformation spoken text to written text
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
![Model](https://raw.githubusercontent.com/nguyenvulebinh/spoken-norm/main/spoken_norm_model.svg)
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
```python
|
6 |
import torch
|
7 |
import model_handling
|
@@ -11,7 +38,7 @@ import os
|
|
11 |
os.environ["CUDA_VISIBLE_DEVICES"] = ""
|
12 |
```
|
13 |
|
14 |
-
|
15 |
|
16 |
|
17 |
```python
|
@@ -20,7 +47,7 @@ model = EncoderDecoderSpokenNorm.from_pretrained('nguyenvulebinh/spoken-norm', c
|
|
20 |
data_collator = DataCollatorForNormSeq2Seq(tokenizer)
|
21 |
```
|
22 |
|
23 |
-
|
24 |
|
25 |
|
26 |
```python
|
@@ -82,9 +109,8 @@ for output in outputs.cpu().detach().numpy().tolist():
|
|
82 |
28/4 cô vít bùng phát ở sờ cốt lờn chiếm 80 % là biến chủng đen ta và bê ta
|
83 |
|
84 |
|
85 |
-
##
|
|
|
|
|
86 |
|
87 |
-
|
88 |
-
[![Follow](https://img.shields.io/twitter/follow/nguyenvulebinh?style=social)](https://twitter.com/intent/follow?screen_name=nguyenvulebinh)
|
89 |
-
For more details, visit the project repository.
|
90 |
-
[![GitHub stars](https://img.shields.io/github/stars/nguyenvulebinh/spoken-norm?style=social)](https://github.com/nguyenvulebinh/spoken-norm)
|
|
|
1 |
# Transformation spoken text to written text
|
2 |
|
3 |
+
This model is used for formatting raw asr text output from spoken text to written text (Eg. date, number, id, ...). It also supports formatting "out of vocab" by using external vocabulary.
|
4 |
+
|
5 |
+
Some of examples:
|
6 |
+
```text
|
7 |
+
input : tám giờ chín phút ngày mười tám tháng năm năm hai nghìn không trăm hai mươi hai
|
8 |
+
output : 8h9 18/5/2022
|
9 |
+
|
10 |
+
input : mã số quy đê tê tê đê hai tám chéo hai không không ba
|
11 |
+
output : mã số qdttd28/2003
|
12 |
+
|
13 |
+
input : thể tích tám mét khối trọng lượng năm mươi ki lô gam
|
14 |
+
output : thể tích 8 m3 trọng lượng 50 kg
|
15 |
+
|
16 |
+
input : ngày hai tám tháng tư cô vít bùng phát ở sờ cốt lờn chiếm tám mươi phần trăm là biến chủng đen ta và bê ta
|
17 |
+
ex_vocab : ['scotland', 'covid', 'delta', 'beta']
|
18 |
+
output : 28/4 covid bùng phát ở scotland chiếm 80 % là biến chủng delta và beta
|
19 |
+
|
20 |
+
```
|
21 |
+
|
22 |
+
|
23 |
+
## Model architecture
|
24 |
+
|
25 |
![Model](https://raw.githubusercontent.com/nguyenvulebinh/spoken-norm/main/spoken_norm_model.svg)
|
26 |
|
27 |
+
# Infer model
|
28 |
+
|
29 |
+
- Play around at [Huggingface Space](https://huggingface.co/spaces/nguyenvulebinh/spoken-norm)
|
30 |
+
|
31 |
+
|
32 |
```python
|
33 |
import torch
|
34 |
import model_handling
|
|
|
38 |
os.environ["CUDA_VISIBLE_DEVICES"] = ""
|
39 |
```
|
40 |
|
41 |
+
## Init tokenizer and model
|
42 |
|
43 |
|
44 |
```python
|
|
|
47 |
data_collator = DataCollatorForNormSeq2Seq(tokenizer)
|
48 |
```
|
49 |
|
50 |
+
## Infer sample
|
51 |
|
52 |
|
53 |
```python
|
|
|
109 |
28/4 cô vít bùng phát ở sờ cốt lờn chiếm 80 % là biến chủng đen ta và bê ta
|
110 |
|
111 |
|
112 |
+
## Contact
|
113 |
+
|
114 | |
115 |
|
116 |
+
[![Follow](https://img.shields.io/twitter/follow/nguyenvulebinh?style=social)](https://twitter.com/intent/follow?screen_name=nguyenvulebinh)
|
|
|
|
|
|