Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nemo_text_processing/text_normalization/ja/taggers/word.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from pynini.lib import pynutil

from nemo_text_processing.text_normalization.ja.graph_utils import NEMO_NOT_SPACE, GraphFst
from nemo_text_processing.text_normalization.ja.graph_utils import NEMO_NOT_QUOTE, GraphFst


class WordFst(GraphFst):
Expand All @@ -26,5 +26,5 @@ class WordFst(GraphFst):

def __init__(self, deterministic: bool = True):
super().__init__(name="word", kind="classify", deterministic=deterministic)
word = pynutil.insert("name: \"") + NEMO_NOT_SPACE + pynutil.insert("\"")
self.fst = word.optimize()
word = pynutil.insert("name: \"") + NEMO_NOT_QUOTE + pynutil.insert("\"")
self.fst = word.optimize()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
彼は“Hello World”というプログラムを実行した。~彼は“Hello World”というプログラムを実行した。
32 changes: 32 additions & 0 deletions tests/nemo_text_processing/ja/test_word.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


import pytest
from parameterized import parameterized

from nemo_text_processing.text_normalization.normalize import Normalizer

from ..utils import CACHE_DIR, parse_test_case_file


class TestWord:
normalizer_ja = Normalizer(lang='ja', cache_dir=CACHE_DIR, overwrite_cache=False, input_case='cased')

@parameterized.expand(parse_test_case_file('ja/data_text_normalization/test_cases_word.txt'))
@pytest.mark.run_only_on('CPU')
@pytest.mark.unit
def test_norm_word(self, test_input, expected):
preds = self.normalizer_ja.normalize(test_input)
assert expected == preds