Commit f78d0f9a authored by Jonathan Poalses's avatar Jonathan Poalses

cleanup

parent 392704d1
...@@ -70,11 +70,21 @@ ...@@ -70,11 +70,21 @@
(defn detect-sentence-dialect [sentence] (defn detect-sentence-dialect [sentence]
(let [token-text (dl/text (dl/tokens sentence)) (let [token-text (dl/text (dl/tokens sentence))
dialects1 (if (some australian-words token-text) :australian (when ((apply some-fn australian-predicates) sentence) :australian)) dialects1 (if (some australian-words token-text)
dialects2 (if (some scottish-words token-text) :scottish (when ((apply some-fn scottish-predicates) sentence) :scottish)) :australian
dialects3 (if (some american-words token-text) :american (when ((apply some-fn american-predicates) sentence) :american)) (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])] dialects (remove nil? [dialects1 dialects2 dialects3])]
(if (empty? dialects) [:standard] dialects))) (if (empty? dialects)
[:standard]
dialects)))
(cond)
;; Take a text sample and separate it into its sentences, then for each sentence find its dialects, and return the most common dialect ;; Take a text sample and separate it into its sentences, then for each sentence find its dialects, and return the most common dialect
......
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