-
-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathcleaning.py
More file actions
24 lines (19 loc) · 596 Bytes
/
cleaning.py
File metadata and controls
24 lines (19 loc) · 596 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from nemo_text_processing.text_normalization.normalize import Normalizer
import sys
def normalize_text(input_text, language='de'):
normalizer = Normalizer(
lang=language,
input_case='cased',
)
normalized = normalizer.normalize(
text=input_text,
punct_post_process=True,
verbose=False
)
return normalized
for line in sys.stdin:
input_text_stdin = str(line)
output_text = normalize_text(input_text=input_text_stdin,language='en')
#print("INPUT: " + input_text_stdin)
#print("OUTPUT: " + output_text)
sys.stdout.write(output_text)