Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further simplify nisaba_compile_multi_grm_py in BUILD file #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
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