diff options
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])) |