diff options
author | Morgan Astra <m@morganastra.me> | 2016-08-09 21:05:50 -0700 |
---|---|---|
committer | Morgan Astra <m@morganastra.me> | 2016-08-09 21:05:50 -0700 |
commit | e3c5f5d366af76cb39f2716455cb220abdc0bfae (patch) | |
tree | f384b07b11a1f70a7d9f6621ab4a5cb3379e4296 /src/pronouns/util.clj | |
parent | cd832bcd7049e9d4ce80ef2907e084edc5813319 (diff) |
get rid of useless config var and use dynamic var for *pronouns-table*, clean up project.clj
Diffstat (limited to 'src/pronouns/util.clj')
-rw-r--r-- | src/pronouns/util.clj | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/pronouns/util.clj b/src/pronouns/util.clj index 3a4bf10..ef353a8 100644 --- a/src/pronouns/util.clj +++ b/src/pronouns/util.clj @@ -16,19 +16,20 @@ (table-lookup query-key (slurp-tabfile tabfile))) (defn minimum-unambiguous-path - ([pronouns-table sections] (minimum-unambiguous-path pronouns-table sections 1)) - ([pronouns-table sections number-of-sections] + ([table sections] (minimum-unambiguous-path table sections 1)) + ([table sections number-of-sections] (let [sections-subset (take number-of-sections sections) - results (filter #(= (take number-of-sections %) sections-subset) pronouns-table)] + results (filter #(= (take number-of-sections %) sections-subset) + table)] (case (count results) 0 nil 1 (clojure.string/join "/" sections-subset) - (recur pronouns-table sections (+ number-of-sections 1)))))) + (recur table sections (+ number-of-sections 1)))))) (defn abbreviate "given a list of pronoun rows, return a list of minimum unabiguous paths" - [pronouns-table] - (map (partial minimum-unambiguous-path pronouns-table) pronouns-table)) + [table] + (map (partial minimum-unambiguous-path table) table)) (defn vec-coerce [x] (if (vector? x) x [x])) |