configurable output dir
This commit is contained in:
@ -51,6 +51,9 @@ when isMainModule:
|
||||
paramStr(1)
|
||||
else:
|
||||
r"../BNC/2554/download/Texts/"
|
||||
|
||||
if not dirExists(basePath):
|
||||
quit("Could not locate datafiles: directory " & basePath & " does not exist.")
|
||||
|
||||
var paths: seq[string]
|
||||
for path in walkDirRec(basePath):
|
||||
@ -76,6 +79,15 @@ when isMainModule:
|
||||
counts.inc(word, count)
|
||||
|
||||
counts.sort()
|
||||
save(counts, "dictionary.txt", "counts.txt")
|
||||
let outPath =
|
||||
if paramCount() > 1:
|
||||
paramStr(2)
|
||||
else:
|
||||
"."
|
||||
|
||||
let
|
||||
dPath = joinPath(outPath, "dictionary.txt")
|
||||
cPath = joinPath(outPath, "counts.txt")
|
||||
save(counts, dPath, cPath)
|
||||
|
||||
echo "Done. Finished in ", (getMonoTime() - start).inMilliseconds.float / 1000, " seconds."
|
||||
|
Reference in New Issue
Block a user