You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the input is a directory (rather than a single file as is currently the case) ldmlnormalize would iterate the directory (using iterate_files).
add something like
if os.path.isdir(args.input): infiles = iterate_files(args.input) else: infiles = [args.infile]
for f in infiles:
ldml = Ldml(f)
ldml.normalise()
if args.outfile: ldml.saveas(args.outfile) else ldml.saveas(f)
hmm that last line needs more careful thought
likewise args.input -> args.infile
how about:
if args.outfile is None: def outfile(f) return f elif os.path.isdir(args.outfile): def outfile(f) return os.path.join(args.outfile, os.path.basename(f)) else: def outfile(f) return args.outfile
then in the loop
ldml.saveas(outfile(f))
The text was updated successfully, but these errors were encountered:
Based on a slack conversation with MH:
If the input is a directory (rather than a single file as is currently the case) ldmlnormalize would iterate the directory (using iterate_files).
add something like
if os.path.isdir(args.input): infiles = iterate_files(args.input) else: infiles = [args.infile]
for f in infiles:
ldml = Ldml(f)
ldml.normalise()
if args.outfile: ldml.saveas(args.outfile) else ldml.saveas(f)
hmm that last line needs more careful thought
likewise args.input -> args.infile
how about:
if args.outfile is None: def outfile(f) return f elif os.path.isdir(args.outfile): def outfile(f) return os.path.join(args.outfile, os.path.basename(f)) else: def outfile(f) return args.outfile
then in the loop
ldml.saveas(outfile(f))
The text was updated successfully, but these errors were encountered: