Commit 392704d1 authored by Jonathan Poalses's avatar Jonathan Poalses

changed tokens to token-text as I just extracted the text from the tokens anyway

parent 578ed012
......@@ -69,10 +69,10 @@
;; Take a sentence and figure out its dialect
(defn detect-sentence-dialect [sentence]
(let [tokens (dl/tokens sentence)
dialects1 (if (some australian-words (dl/text tokens)) :australian (when ((apply some-fn australian-predicates) sentence) :australian))
dialects2 (if (some scottish-words (dl/text tokens)) :scottish (when ((apply some-fn scottish-predicates) sentence) :scottish))
dialects3 (if (some american-words (dl/text tokens)) :american (when ((apply some-fn american-predicates) sentence) :american))
(let [token-text (dl/text (dl/tokens sentence))
dialects1 (if (some australian-words token-text) :australian (when ((apply some-fn australian-predicates) sentence) :australian))
dialects2 (if (some scottish-words token-text) :scottish (when ((apply some-fn scottish-predicates) sentence) :scottish))
dialects3 (if (some american-words token-text) :american (when ((apply some-fn american-predicates) sentence) :american))
dialects (remove nil? [dialects1 dialects2 dialects3])]
(if (empty? dialects) [:standard] dialects)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment