Skip to content

Commit a500894

Browse files
committed
feat(analyser): add --zpipe arg to give specific zpipe file
1 parent 95c21c6 commit a500894

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

corpustools/analyser.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ def parse_options():
189189
help="When this argument is used files will be analysed one by one. "
190190
"Using --serial takes priority over --ncpus",
191191
)
192+
parser.add_argument(
193+
"--zpipe",
194+
help="Use this specific .zpipe file",
195+
)
192196
parser.add_argument(
193197
"converted_entities",
194198
nargs="+",
@@ -214,7 +218,13 @@ def main():
214218
sys.exit("No files to analyse")
215219

216220
lang = analysable_paths[0].lang
217-
analyser_path = find_analyser_zpipe(lang)
221+
if args.zpipe is not None:
222+
analyser_path = args.zpipe
223+
if not Path(analyser_path).exists():
224+
sys.exit(f"Given --zpipe path ({analyser_path}) does not exist")
225+
else:
226+
analyser_path = find_analyser_zpipe(lang)
227+
218228
if analyser_path is None:
219229
search_paths = ", ".join(str(p) for p in lang_resource_dirs(lang))
220230
archive_name = f"{LANGUAGES.get(lang, lang)}.zpipe"

0 commit comments

Comments
 (0)