From 87573b0908a3bb3e625c12b336559d283716637e Mon Sep 17 00:00:00 2001 From: kirk gardner Date: Tue, 3 Apr 2018 02:23:22 -0400 Subject: [PATCH] more --- test.sh | 11 +++++++---- wff_dict.jl | 5 +++-- wff_dict_verbose.jl | 14 ++++++++++---- wff_mod.jl | 4 +++- wff_type.jl | 3 ++- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/test.sh b/test.sh index 5a1df38..e7a3a06 100755 --- a/test.sh +++ b/test.sh @@ -1,10 +1,13 @@ #!/bin/bash echo -echo "testing wff_dict.jl" -./wff_dict.jl tests/* +echo "testing wff_mod.jl" +./wff_mod.jl tests/* echo echo "testing wff_type.jl" ./wff_type.jl tests/* echo -echo "testing wff_mod.jl" -./wff_mod.jl tests/* +echo "testing wff_dict.jl" +./wff_dict.jl tests/* +echo +echo "testing wff_dict_verbose.jl" +./wff_dict_verbose.jl tests/* diff --git a/wff_dict.jl b/wff_dict.jl index fc9e68a..f2d83a3 100755 --- a/wff_dict.jl +++ b/wff_dict.jl @@ -1,7 +1,8 @@ #!/usr/local/bin/julia -files = length(ARGS) == 0 ? (println("please provide at least one file name!"); exit()) : ARGS -delims = [' ','\n','\t','.',',','(',')','?','/'] # single quotes: character literal +const DEF = "tests/one.txt" +const files = length(ARGS) == 0 ? (println("please provide at least one file name!\n > RUNNING $DEF"); [DEF]) : ARGS +const delims = [' ','\n','\t','.',',','(',')','?','/'] # single quotes: character literal addword!(d,word) = haskey(d, word) ? d[word] += 1 : d[word] = 1 diff --git a/wff_dict_verbose.jl b/wff_dict_verbose.jl index 889c097..a40ff75 100755 --- a/wff_dict_verbose.jl +++ b/wff_dict_verbose.jl @@ -7,12 +7,15 @@ # julia -i wff1.jl # the -i denotes "interactive mode" similar to the cli in python. # to just execute the code omit -i +5 +const DEF = "tests/one.txt" if length(ARGS) > 0 # ARGS is an array of command line arguments as strings (separated by spaces) files = ARGS[1:end] # indexing starts at 1! else println("please provide at least one file name!") - exit() # ... exit interpreter + println("RUNNING $DEF") + files = [DEF] end # instantiate a dictionary of dictionaries @@ -42,7 +45,10 @@ for file in files end end -println("\nyou're now in interactive mode!") -println("type word_dicts in the command line to view your dictionary") +println("\n --------------------------------------------------------------------") +println("\nyou are now in interactive mode!") +println("enter `word_dicts` in the command line to view your dictionary in REPL") println("\tlooking up key values is the same syntax as indexing") -println("\te.x. word_dicts[\"$(files[1])\"] would give you the dictionary of word frequencies for $(files[1])") +println(" e.g. `word_dicts[\"$(files[1])\"]` is the dictionary of word frequencies for `$(files[1])`") +println("\n --------------------------------------------------------------------\n") +println("enter `exit()` to ESCAPE\n") diff --git a/wff_mod.jl b/wff_mod.jl index 67010c6..1e51218 100755 --- a/wff_mod.jl +++ b/wff_mod.jl @@ -1,6 +1,8 @@ #!/usr/local/bin/julia -const files = length(ARGS) == 0 ? (println("please provide at least one file name!"); exit()) : ARGS +const DEF = "tests/one.txt" +const files = length(ARGS) == 0 ? (println("please provide at least one file name!\n > RUNNING $DEF"); [DEF]) : ARGS + include("modules/wff.jl") using WFF diff --git a/wff_type.jl b/wff_type.jl index ca86830..ac35f6f 100755 --- a/wff_type.jl +++ b/wff_type.jl @@ -1,6 +1,7 @@ #!/usr/local/bin/julia -const files = length(ARGS) == 0 ? (println("please provide at least one file name!"); exit()) : ARGS +const DEF = "tests/one.txt" +const files = length(ARGS) == 0 ? (println("please provide at least one file name!\n > RUNNING $DEF"); [DEF]) : ARGS const delims = [' ','\n','\t','.',',','(',')','?','/'] # single quotes: character literal function getstr(file)