Skip to content

Commit 2b04bc3

Browse files
authored
[tn] delete prefix space (#262)
1 parent 91e51ca commit 2b04bc3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tn/english/normalizer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ def build_tagger(self):
7373
| rang
7474
| punct
7575
).optimize() + (punct.plus | self.DELETE_SPACE)
76-
# delete the last space
77-
self.tagger = tagger.star @ self.build_rule(delete(' '), r='[EOS]')
76+
# delete the first and last space
77+
self.tagger = (delete(' ').star + tagger.star) @ self.build_rule(
78+
delete(' '), r='[EOS]')
7879

7980
def build_verbalizer(self):
8081
cardinal = Cardinal().verbalizer

tn/english/test/data/normalizer.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ The museum is open Mon.-Sun. children of 3-4 years 123 The plan will help you lo
55
Try searching for 'Toyota' or 'Investment' => Try searching for 'Toyota' or 'Investment'
66
"" => ""
77
The HTML tag <p> defines a paragraph. => The HTML tag <p> defines a paragraph.
8+
hello world => hello world

0 commit comments

Comments
 (0)