Skip to content

Commit 227c742

Browse files
lwolfsonkincopybara-github
authored andcommitted
Further simplify nisaba_compile_multi_grm_py in BUILD file
PiperOrigin-RevId: 358451267
1 parent bc4ba9b commit 227c742

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
@@ -64,10 +64,6 @@ nisaba_grm_regression_test(
6464

6565
nisaba_compile_multi_grm_py(
6666
name = "fixed",
67-
outs = {
68-
"byte": "fixed.far",
69-
"utf8": "fixed_utf8.far",
70-
},
7167
data = [":sigma_utf8.far"] + [
7268
"//nisaba/brahmic/data/script/{}:fixed.tsv".format(script)
7369
for script in FIXED_RULE_SCRIPTS
@@ -90,10 +86,6 @@ nisaba_grm_regression_test(
9086

9187
nisaba_compile_multi_grm_py(
9288
name = "nfc",
93-
outs = {
94-
"byte": "nfc.far",
95-
"utf8": "nfc_utf8.far",
96-
},
9789
data = [
9890
":sigma_utf8.far",
9991
] + ["//nisaba/brahmic/data/script/{}:nfc.tsv".format(script) for script in SCRIPTS],
@@ -235,10 +227,6 @@ py_test(
235227

236228
nisaba_compile_multi_grm_py(
237229
name = "visual_norm",
238-
outs = {
239-
"byte": "visual_norm.far",
240-
"utf8": "visual_norm_utf8.far",
241-
},
242230
data = [
243231
":nfc.far",
244232
":nfc_utf8.far",
@@ -288,10 +276,6 @@ nisaba_grm_regression_test(
288276

289277
nisaba_compile_multi_grm_py(
290278
name = "wellformed",
291-
outs = {
292-
"byte": "wellformed.far",
293-
"utf8": "wellformed_utf8.far",
294-
},
295279
data = [
296280
"//nisaba/brahmic/data/script/{}:{}.tsv".format(script, file_name)
297281
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)