Remove Spanish-specific TSV tooling
This commit is contained in:
+9
-47
@@ -15,7 +15,7 @@ from .importer import (
|
||||
supported_tts_backends,
|
||||
synthesize_tts_sample,
|
||||
)
|
||||
from .words import compare_word_files, compare_word_lists, extract_words, extract_words_from_file, lint_anki_cards_main
|
||||
from .words import compare_word_files, compare_word_lists, extract_words, extract_words_from_file
|
||||
from .youtube import run_youtube
|
||||
|
||||
|
||||
@@ -98,12 +98,13 @@ def build_parser(config: Config | None = None) -> argparse.ArgumentParser:
|
||||
words.add_argument("--out", "--output", dest="out")
|
||||
words.add_argument("--full-field", action="store_true")
|
||||
words.add_argument("--spacy-model")
|
||||
words.add_argument("--include-proper-nouns", action="store_true", help="Include proper nouns (PROPN).")
|
||||
words.add_argument("--function-words", action="store_true", help="Extract function words separately.")
|
||||
words.add_argument("--debug", help="Path for debug TSV output.")
|
||||
words.add_argument("--lemma-corrections", help="Path to bad<TAB>good TSV of lemma corrections.")
|
||||
words.add_argument("--bad-lemma-file", help="Path to file listing lemmas to skip.")
|
||||
words.add_argument("--include-tags", action="store_true", help="Include tags column in parsing.")
|
||||
words.add_argument(
|
||||
"--field-section",
|
||||
choices=["all", "first"],
|
||||
default="all",
|
||||
help="Which blank-line-separated TSV field section to mine.",
|
||||
)
|
||||
words.add_argument("--debug-min-freq", type=int, default=0,
|
||||
help="Minimum frequency for debug output (default: all).")
|
||||
words.add_argument("--no-clean", action="store_true",
|
||||
@@ -121,12 +122,6 @@ def build_parser(config: Config | None = None) -> argparse.ArgumentParser:
|
||||
compare_new.add_argument("--min-frequency", type=int, default=0,
|
||||
help="Minimum frequency for deck words to count.")
|
||||
|
||||
lint_es = sub.add_parser("lint-anki-es", help="Check Spanish Anki cards for suspicious patterns.")
|
||||
lint_es.add_argument("--input", required=True, help="Anki TSV export file.")
|
||||
lint_es.add_argument("--field", type=int, default=2, help="1-based column index (default 2).")
|
||||
lint_es.add_argument("--output", default="suspicious_cards_es.tsv", help="Output TSV path.")
|
||||
lint_es.add_argument("--verbose", action="store_true", help="Output all cards, not just suspicious ones.")
|
||||
|
||||
youtube = sub.add_parser("youtube", help="Mine a YouTube transcript.")
|
||||
youtube.add_argument("lang", choices=choices)
|
||||
youtube.add_argument("video")
|
||||
@@ -195,12 +190,6 @@ def main(argv: list[str] | None = None) -> int:
|
||||
if args.command == "words":
|
||||
if args.input:
|
||||
# File-based extraction
|
||||
if config.language_name(args.lang) != "spanish":
|
||||
print(
|
||||
"Error: TSV file-based word extraction is currently Spanish-only.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return 1
|
||||
if args.field and not args.field.isdigit():
|
||||
print(
|
||||
f"Error: --field must be a 1-based column index (integer) "
|
||||
@@ -221,25 +210,16 @@ def main(argv: list[str] | None = None) -> int:
|
||||
min_freq=args.min_freq,
|
||||
outdir=args.outdir,
|
||||
out=args.out,
|
||||
include_proper_nouns=args.include_proper_nouns,
|
||||
function_words=args.function_words,
|
||||
debug=args.debug,
|
||||
lemma_corrections=args.lemma_corrections,
|
||||
bad_lemma_file=args.bad_lemma_file,
|
||||
spacy_model=args.spacy_model,
|
||||
include_tags=args.include_tags,
|
||||
debug_min_freq=args.debug_min_freq,
|
||||
no_clean=args.no_clean,
|
||||
field_section=args.field_section,
|
||||
)
|
||||
print(f"Parsed {result['records']} records")
|
||||
print(f"Wrote {result['written']} content entries to: {result['out']}")
|
||||
print(f"Wrote {result['written']} entries to: {result['out']}")
|
||||
if result.get("debug"):
|
||||
print(f"Debug output: {result['debug']}")
|
||||
if result.get("proper_nouns"):
|
||||
print(f"Proper nouns: {result['proper_nouns']}")
|
||||
if result.get("function_words"):
|
||||
print(f"Function words: {result['function_words']}")
|
||||
print(f"Suspicious tokens: {result.get('suspicious', '')}")
|
||||
else:
|
||||
result = extract_words(
|
||||
config, args.lang, args.query, args.deck, args.field, args.min_freq,
|
||||
@@ -279,24 +259,6 @@ def main(argv: list[str] | None = None) -> int:
|
||||
print(f"Seen words written to: {args.seen_output}")
|
||||
return 0
|
||||
|
||||
if args.command == "lint-anki-es":
|
||||
if args.field < 1:
|
||||
print(
|
||||
f"Error: --field must be a 1-based column index >= 1, got: {args.field}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return 1
|
||||
result = lint_anki_cards_main(
|
||||
args.input,
|
||||
field_index=args.field,
|
||||
output_path=args.output,
|
||||
verbose=args.verbose,
|
||||
)
|
||||
print(f"Checked {result['records']} cards")
|
||||
print(f"Found {result['issues']} suspicious card(s)")
|
||||
print(f"Report written to: {result['path']}")
|
||||
return 0
|
||||
|
||||
if args.command == "youtube":
|
||||
result = run_youtube(
|
||||
config, args.lang, args.video, args.mode, args.top, args.no_stopwords,
|
||||
|
||||
Reference in New Issue
Block a user