Skip to content

Commit

Permalink
Further simplify nisaba_compile_multi_grm_py in BUILD file
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 358451267
  • Loading branch information
lwolfsonkin authored and copybara-github committed Jun 30, 2021
1 parent bc4ba9b commit 227c742
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
16 changes: 0 additions & 16 deletions nisaba/brahmic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ nisaba_grm_regression_test(

nisaba_compile_multi_grm_py(
name = "fixed",
outs = {
"byte": "fixed.far",
"utf8": "fixed_utf8.far",
},
data = [":sigma_utf8.far"] + [
"//nisaba/brahmic/data/script/{}:fixed.tsv".format(script)
for script in FIXED_RULE_SCRIPTS
Expand All @@ -90,10 +86,6 @@ nisaba_grm_regression_test(

nisaba_compile_multi_grm_py(
name = "nfc",
outs = {
"byte": "nfc.far",
"utf8": "nfc_utf8.far",
},
data = [
":sigma_utf8.far",
] + ["//nisaba/brahmic/data/script/{}:nfc.tsv".format(script) for script in SCRIPTS],
Expand Down Expand Up @@ -235,10 +227,6 @@ py_test(

nisaba_compile_multi_grm_py(
name = "visual_norm",
outs = {
"byte": "visual_norm.far",
"utf8": "visual_norm_utf8.far",
},
data = [
":nfc.far",
":nfc_utf8.far",
Expand Down Expand Up @@ -288,10 +276,6 @@ nisaba_grm_regression_test(

nisaba_compile_multi_grm_py(
name = "wellformed",
outs = {
"byte": "wellformed.far",
"utf8": "wellformed_utf8.far",
},
data = [
"//nisaba/brahmic/data/script/{}:{}.tsv".format(script, file_name)
for script in SCRIPTS
Expand Down
9 changes: 4 additions & 5 deletions nisaba/utils/grammars.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,26 @@ def nisaba_compile_grm_py(

def nisaba_compile_multi_grm_py(
name,
outs,
deps = None,
data = None,
**kwds):
"""Provides a target to convert a Pynini file into multiple (portable) FAR files.
Turns a Pynini file into a FAR file with the specified FAR and FST types.
Assumes that there are exactly two output files, and that they are "byte"
and "utf8" mode versions of the created FSTs.
Args:
name: The BUILD rule name and the file prefix for the generated output.
outs: A dictionary mapping designators to files, where designator
is the designating name used in the Pynini file to refer to the
corresponding file. The designated files must have extension ".far".
deps: A list of other compile_grm rules that we'll need for this grammar.
data: Extra data dependencies used in the Pynini file.
**kwds: Attributes common to all BUILD rules, e.g., testonly, visibility.
"""
compile_multi_grm_py(
name = name,
fst_type = _FST_TYPE,
outs = outs,
outs = {"byte": name + ".far", "utf8": name + "_utf8.far"},
data = data,
deps = deps + [
],
Expand Down

0 comments on commit 227c742

Please sign in to comment.