Skip to content

Commit 39c6d86

Browse files
Nisaba Authorscopybara-github
Nisaba Authors
authored andcommitted
Further simplify nisaba_compile_multi_grm_py in BUILD file
PiperOrigin-RevId: 358451267
1 parent 90db8f1 commit 39c6d86

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

Diff for: nisaba/brahmic/BUILD.bazel

-16
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ nisaba_grm_regression_test(
8282

8383
nisaba_compile_multi_grm_py(
8484
name = "fixed",
85-
outs = {
86-
"byte": "fixed.far",
87-
"utf8": "fixed_utf8.far",
88-
},
8985
data = [":sigma_utf8.far"] + [
9086
"//nisaba/brahmic/data/script/{}:fixed.tsv".format(script)
9187
for script in FIXED_RULE_SCRIPTS
@@ -108,10 +104,6 @@ nisaba_grm_regression_test(
108104

109105
nisaba_compile_multi_grm_py(
110106
name = "nfc",
111-
outs = {
112-
"byte": "nfc.far",
113-
"utf8": "nfc_utf8.far",
114-
},
115107
data = [
116108
":sigma_utf8.far",
117109
] + ["//nisaba/brahmic/data/script/{}:nfc.tsv".format(script) for script in SCRIPTS],
@@ -262,10 +254,6 @@ py_test(
262254

263255
nisaba_compile_multi_grm_py(
264256
name = "visual_norm",
265-
outs = {
266-
"byte": "visual_norm.far",
267-
"utf8": "visual_norm_utf8.far",
268-
},
269257
data = [
270258
":nfc.far",
271259
":nfc_utf8.far",
@@ -313,10 +301,6 @@ nisaba_grm_regression_test(
313301

314302
nisaba_compile_multi_grm_py(
315303
name = "wellformed",
316-
outs = {
317-
"byte": "wellformed.far",
318-
"utf8": "wellformed_utf8.far",
319-
},
320304
data = [
321305
"//nisaba/brahmic/data/script/{}:{}.tsv".format(script, file_name)
322306
for script in SCRIPTS

Diff for: nisaba/utils/grammars.bzl

+4-5
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,26 @@ def nisaba_compile_grm_py(
5555

5656
def nisaba_compile_multi_grm_py(
5757
name,
58-
outs,
5958
deps = None,
6059
data = None,
6160
**kwds):
6261
"""Provides a target to convert a Pynini file into multiple (portable) FAR files.
6362
6463
Turns a Pynini file into a FAR file with the specified FAR and FST types.
6564
65+
Assumes that there are exactly two output files, and that they are "byte"
66+
and "utf8" mode versions of the created FSTs.
67+
6668
Args:
6769
name: The BUILD rule name and the file prefix for the generated output.
68-
outs: A dictionary mapping designators to files, where designator
69-
is the designating name used in the Pynini file to refer to the
70-
corresponding file. The designated files must have extension ".far".
7170
deps: A list of other compile_grm rules that we'll need for this grammar.
7271
data: Extra data dependencies used in the Pynini file.
7372
**kwds: Attributes common to all BUILD rules, e.g., testonly, visibility.
7473
"""
7574
compile_multi_grm_py(
7675
name = name,
7776
fst_type = _FST_TYPE,
78-
outs = outs,
77+
outs = {"byte": name + ".far", "utf8": name + "_utf8.far"},
7978
data = data,
8079
deps = deps + [
8180
],

0 commit comments

Comments
 (0)