Skip to content

Commit 1d7b9ed

Browse files
committed
feat: word uses NOT_SPACE, add decades, 451/470 (96%)
1 parent d644ad9 commit 1d7b9ed

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

itn/english/rules/word.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from pynini import accep, closure
15+
from pynini import difference, union
1616
from pynini.lib.pynutil import insert
1717

1818
from tn.processor import Processor
@@ -26,8 +26,6 @@ def __init__(self):
2626
self.build_verbalizer()
2727

2828
def build_tagger(self):
29-
apostrophe = accep("'") | accep("’")
30-
word = self.ALPHA.plus + closure(apostrophe + self.ALPHA.plus, 0, 1)
31-
word |= self.ALPHA.plus + accep("!")
32-
tagger = insert('value: "') + word + insert('"')
29+
valid_char = difference(self.NOT_SPACE, union('"', "\\"))
30+
tagger = insert('value: "') + valid_char.plus + insert('"')
3331
self.tagger = self.add_tokens(tagger)

0 commit comments

Comments
 (0)