Skip to content

Commit

Permalink
[ci skip] removes non shared options
Browse files Browse the repository at this point in the history
  • Loading branch information
Jemoka committed Sep 2, 2024
1 parent a0160e4 commit 03ebb1f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
31 changes: 18 additions & 13 deletions batchalign/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,7 @@ def common_options(f):
click.argument("in_dir",
type=click.Path(exists=True, file_okay=False)),
click.argument("out_dir",
type=click.Path(exists=True, file_okay=False)),
click.option("--lang",
help="sample language in three-letter ISO 3166-1 alpha-3 code",
show_default=True,
default="eng",
type=str),
click.option("-n", "--num_speakers", type=int,
help="number of speakers in the language sample", default=2),

type=click.Path(exists=True, file_okay=False))
]

options.reverse()
Expand Down Expand Up @@ -115,16 +107,17 @@ def batchalign(ctx, verbose):
@common_options
@click.option("--whisper/--rev",
default=False, help="For utterance timing recovery, OpenAI Whisper (ASR) instead of Rev.AI (default).")

@click.pass_context
def align(ctx, in_dir, out_dir, lang, num_speakers, whisper, **kwargs):
def align(ctx, in_dir, out_dir, whisper, **kwargs):
"""Align transcripts against corresponding media files."""
def loader(file):
return CHATFile(path=os.path.abspath(file)).doc

def writer(doc, output):
CHATFile(doc=doc).write(output)

_dispatch("align", lang, num_speakers,
_dispatch("align", "eng", 1,
["cha"], ctx,
in_dir, out_dir,
loader, writer, C,
Expand All @@ -143,6 +136,12 @@ def writer(doc, output):
default=False, help="Perform speaker diarization (this flag is ignored with Rev.AI)")
@click.option("--wor/--nowor",
default=False, help="Should we write word level alignment line? Default to no.")
@click.option("--lang",
help="sample language in three-letter ISO 3166-1 alpha-3 code",
show_default=True,
default="eng",
type=str)
@click.option("-n", "--num_speakers", type=int, help="number of speakers in the language sample", default=2)
@click.pass_context
def transcribe(ctx, in_dir, out_dir, lang, num_speakers, **kwargs):
"""Create a transcript from audio files."""
Expand Down Expand Up @@ -189,7 +188,7 @@ def writer(doc, output):
file_okay=True, dir_okay=False),
help="Comma seperated manual lexicon override")
@click.pass_context
def morphotag(ctx, in_dir, out_dir, lang, num_speakers, **kwargs):
def morphotag(ctx, in_dir, out_dir, **kwargs):
"""Perform morphosyntactic analysis on transcripts."""

def loader(file):
Expand All @@ -213,7 +212,7 @@ def loader(file):
def writer(doc, output):
CHATFile(doc=doc, special_mor_=doc.ba_special_.get("special_mor_notation", False)).write(output)

_dispatch("morphotag", lang, num_speakers, ["cha"], ctx,
_dispatch("morphotag", "eng", 1, ["cha"], ctx,
in_dir, out_dir,
loader, writer, C)

Expand All @@ -222,6 +221,12 @@ def writer(doc, output):

@batchalign.command()
@common_options
@click.option("--lang",
help="sample language in three-letter ISO 3166-1 alpha-3 code",
show_default=True,
default="eng",
type=str)
@click.option("-n", "--num_speakers", type=int, help="number of speakers in the language sample", default=2)
@click.pass_context
def utseg(ctx, in_dir, out_dir, lang, num_speakers, **kwargs):
"""Perform morphosyntactic analysis on transcripts."""
Expand Down
6 changes: 3 additions & 3 deletions batchalign/version
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
0.7.4
September 2nd, 2024
Bumping BA Major + Python
0.7.5-alpha.1
September 3nd, 2024
Removes unneeded options

0 comments on commit 03ebb1f

Please sign in to comment.