Skip to content

Commit fcbc36b

Browse files
cibucopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 955071677
1 parent fe8f9cb commit fcbc36b

96 files changed

Lines changed: 426 additions & 224 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

nisaba/interim/grm2/rewrite/base_rule_cascade.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ bool BaseRuleCascade<Arc>::TopRewrite(absl::string_view input,
234234
debug->clear();
235235
std::vector<Label> labels;
236236
if (!TopRewrite(input, &labels)) return false;
237-
if (!::fst::LabelsToString(labels, output, token_type_)) return false;
237+
if (!::fst::LabelsToString<Label>(labels, output, token_type_)) return false;
238238
LabelsToDebugString(*output, labels, debug);
239239
return true;
240240
}
@@ -281,7 +281,7 @@ bool BaseRuleCascade<Arc>::OneTopRewrite(absl::string_view input,
281281
debug->clear();
282282
std::vector<Label> labels;
283283
if (!OneTopRewrite(input, &labels)) return false;
284-
if (!::fst::LabelsToString(labels, output, token_type_)) return false;
284+
if (!::fst::LabelsToString<Label>(labels, output, token_type_)) return false;
285285
LabelsToDebugString(*output, labels, debug);
286286
return true;
287287
}
@@ -332,7 +332,7 @@ bool BaseRuleCascade<Arc>::TopRewrites(absl::string_view input,
332332
for (const auto &labels : labelss) {
333333
output->emplace_back();
334334
debug->emplace_back();
335-
if (!::fst::LabelsToString(labels, &output->back(), token_type_)) {
335+
if (!::fst::LabelsToString<Label>(labels, &output->back(), token_type_)) {
336336
return false;
337337
}
338338
LabelsToDebugString(output->back(), labels, &debug->back());
@@ -394,7 +394,7 @@ bool BaseRuleCascade<Arc>::TopRewrites(absl::string_view input,
394394
for (const auto &labels : labelss) {
395395
output->emplace_back();
396396
debug->emplace_back();
397-
if (!::fst::LabelsToString(labels, &output->back(), token_type_)) {
397+
if (!::fst::LabelsToString<Label>(labels, &output->back(), token_type_)) {
398398
return false;
399399
}
400400
LabelsToDebugString(output->back(), labels, &debug->back());
@@ -455,7 +455,7 @@ bool BaseRuleCascade<Arc>::Rewrites(absl::string_view input,
455455
for (const auto &labels : labelss) {
456456
output->emplace_back();
457457
debug->emplace_back();
458-
if (!::fst::LabelsToString(labels, &output->back(), token_type_)) {
458+
if (!::fst::LabelsToString<Label>(labels, &output->back(), token_type_)) {
459459
return false;
460460
}
461461
LabelsToDebugString(output->back(), labels, &debug->back());

nisaba/interim/grm2/thrax/rewrite-tester.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ bool RewriteTester::AppendLabel(Label label, std::string *path) const {
261261
std::string utf8_string;
262262
std::vector<Label> labels;
263263
labels.push_back(label);
264-
if (!LabelsToUTF8String(labels, &utf8_string)) {
264+
if (!LabelsToUTF8String<Label>(labels, &utf8_string)) {
265265
LOG(ERROR) << "LabelsToUTF8String: Bad code point: " << label;
266266
return false;
267267
}

nisaba/interim/grm2/thrax/walker/util/function/symbols.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <vector>
2222

2323
#include "absl/synchronization/mutex.h"
24+
#include "fst/icu.h"
2425
#include "fst/string.h"
2526

2627
namespace thrax {
@@ -194,7 +195,7 @@ void SymbolTableBuilder::GenerateUtf8SymbolTable() {
194195
std::vector<int> labels;
195196
labels.push_back(c);
196197
std::string utf8_label;
197-
if (::fst::LabelsToUTF8String(labels, &utf8_label)) {
198+
if (::fst::LabelsToUTF8String<int>(labels, &utf8_label)) {
198199
if (IsUnicodeSpaceOrControl(c)) {
199200
char c_str[7];
200201
snprintf(c_str, sizeof(c_str), "0x%04x", c);

nisaba/scripts/abjad_alphabet/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import string
2424

2525
import pynini
26+
2627
from nisaba.scripts.abjad_alphabet import util as u
2728
from nisaba.scripts.utils import far
2829
from nisaba.scripts.utils import rewrite

nisaba/scripts/abjad_alphabet/fst_properties_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import itertools
1818

1919
import pynini
20+
2021
from absl.testing import absltest
2122
from absl.testing import parameterized
2223
from nisaba.scripts.abjad_alphabet import util as u

nisaba/scripts/abjad_alphabet/nfc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
To try for Urdu:
1818
1919
```sh
20-
bazel build -c opt nlp/grm2/thrax:rewrite-tester \
20+
bazel build -c opt third_party/opengrm/thrax:rewrite-tester \
2121
nisaba/scripts/abjad_alphabet:nfc
2222
2323
bazel-bin/nisaba/interim/grm2/thrax/rewrite-tester \
@@ -28,7 +28,7 @@
2828
"""
2929

3030
import pynini
31-
from pynini.export import multi_grm
31+
from opengrm.pynini.export import multi_grm
3232
from nisaba.scripts.abjad_alphabet import util as u
3333
from nisaba.scripts.utils import rule
3434

nisaba/scripts/abjad_alphabet/reading_norm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
To try for Urdu:
1818
1919
```sh
20-
bazel build -c opt nlp/grm2/thrax:rewrite-tester \
20+
bazel build -c opt third_party/opengrm/thrax:rewrite-tester \
2121
nisaba/scripts/abjad_alphabet:reading_norm
2222
2323
bazel-bin/nisaba/interim/grm2/thrax/rewrite-tester \
@@ -29,9 +29,8 @@
2929
"""
3030

3131
from absl import flags
32-
3332
import pynini
34-
from pynini.export import grm
33+
from opengrm.pynini.export import grm
3534
import nisaba.scripts.abjad_alphabet.util as u
3635
from nisaba.scripts.utils import rule
3736

nisaba/scripts/abjad_alphabet/reading_norm_utf8.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
To try for Urdu:
1818
1919
```sh
20-
bazel build -c opt nlp/grm2/thrax:rewrite-tester \
20+
bazel build -c opt third_party/opengrm/thrax:rewrite-tester \
2121
nisaba/scripts/abjad_alphabet:reading_norm
2222
2323
bazel-bin/nisaba/interim/grm2/thrax/rewrite-tester \
@@ -28,7 +28,7 @@
2828
```
2929
"""
3030

31-
from pynini.export import grm
31+
from opengrm.pynini.export import grm
3232
from nisaba.scripts.abjad_alphabet import reading_norm
3333

3434

nisaba/scripts/abjad_alphabet/reversible_roman.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
1919
```shell
2020
ABJAD_ALPHABET_DIR=nisaba/scripts/abjad_alphabet
21-
bazel build -c opt nlp/grm2/thrax:rewrite-tester \
21+
bazel build -c opt third_party/opengrm/thrax:rewrite-tester \
2222
${ABJAD_ALPHABET_DIR}:reversible_roman
2323
2424
bazel-bin/nisaba/interim/grm2/thrax/rewrite-tester \
@@ -29,7 +29,7 @@
2929
"""
3030

3131
import pynini
32-
from pynini.export import multi_grm
32+
from opengrm.pynini.export import multi_grm
3333
from nisaba.scripts.abjad_alphabet import util
3434
from nisaba.scripts.utils import file
3535
from nisaba.scripts.utils import rewrite

nisaba/scripts/abjad_alphabet/testdata/reading_norm.textproto

Lines changed: 1 addition & 1 deletion
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-
# proto-file: testing/testdata.proto
15+
# proto-file: third_party/opengrm/testing/testdata.proto
1616
# proto-message: Rewrites
1717

1818
# Reading normalization test data.

0 commit comments

Comments
 (0)