Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more
  • Loading branch information
kirk gardner committed Apr 3, 2018
1 parent 89136f3 commit 87573b0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
11 changes: 7 additions & 4 deletions 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/*
5 changes: 3 additions & 2 deletions 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

Expand Down
14 changes: 10 additions & 4 deletions wff_dict_verbose.jl
Expand Up @@ -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
Expand Down Expand Up @@ -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")
4 changes: 3 additions & 1 deletion 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

Expand Down
3 changes: 2 additions & 1 deletion 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)
Expand Down

0 comments on commit 87573b0

Please sign in to comment.