Commit dc4e0da8 authored by Jonathan Poalses's avatar Jonathan Poalses

Added more testing stuff.

parent 4c476d0a
...@@ -44,11 +44,13 @@ ...@@ -44,11 +44,13 @@
;; Take a sentence and figure out its dialect ;; Take a sentence and figure out its dialect
(defn detect-sentence-dialect [sentence] (def bad-words #{"why" "cause"})
(if (some #(= "why" %) (dl/text (dl/tokens sentence))) :bad :good))
(defn detect-sentence-dialect [sentence]
(if (some bad-words (dl/text (dl/tokens sentence))) :bad :good))
(some bad-words '("why" "not-why"))
;; Take a text sample and separate it into it's sentences, then for each sentence find its dialect, and return the most common dialect ;; Take a text sample and separate it into its sentences, then for each sentence find its dialect, and return the most common dialect
(defn detect-sample-dialect [sample] (defn detect-sample-dialect [sample]
(first (last (sort-by val (frequencies (map detect-sentence-dialect (dl/sentences (nlp sample)))))))) (first (last (sort-by val (frequencies (map detect-sentence-dialect (dl/sentences (nlp sample))))))))
...@@ -142,6 +144,32 @@ ...@@ -142,6 +144,32 @@
;; This identifies "like" in this instance as being an interjection (filler word) ;; This identifies "like" in this instance as being an interjection (filler word)
(.tag (.getTarget (nth (nth (vals (datafy (dl/dependency-graph (nth sentences-five 1)))) 3) 2))) (.tag (.getTarget (nth (nth (vals (datafy (dl/dependency-graph (nth sentences-five 1)))) 3) 2)))
(.word (.getTarget (nth (nth (vals (datafy (dl/dependency-graph (nth sentences-five 1)))) 3) 2))) (.word (.getTarget (nth (nth (vals (datafy (dl/dependency-graph (nth sentences-five 1)))) 3) 2)))
(.getLongName (.getRelation (nth (nth (vals (datafy (dl/dependency-graph (nth sentences-five 1)))) 3) 2)))
(.getShortName (.getRelation (nth (nth (vals (datafy (dl/dependency-graph (nth sentences-five 1)))) 3) 2)))
(defn extract-relation [word sentences]
(for [sentence sentences]
(let [data-edges (vals (datafy (dl/dependency-graph sentence)))]
(for [edge data-edges]
(let [edge-bean (bean edge)]
edge-bean)))))
(extract-relation "like" sentences-six)
(for [sentence sentences-six]
(let [data-edges (vals (datafy (dl/dependency-graph sentence)))]
(for [edge data-edges]
(let [edge-bean (bean edge)]
edge-bean))))
(datafy (dl/dependency-graph (nth sentences-six 2)))
(datafy (first (keys (datafy (dl/dependency-graph (nth sentences-six 2))))))
(nav (datafy (dl/dependency-graph (nth sentences-six 2))))
(datafy (:governor (first (map datafy (nth (vals (datafy (dl/dependency-graph (nth sentences-six 0)))) 0)))))
(.word (.getSource (nth (nth (vals (datafy (dl/dependency-graph (nth sentences-five 1)))) 3) 2))) (.word (.getSource (nth (nth (vals (datafy (dl/dependency-graph (nth sentences-five 1)))) 3) 2)))
...@@ -189,8 +217,12 @@ ...@@ -189,8 +217,12 @@
(detect-sentence-dialect @sentences-two) (detect-sentence-dialect @sentences-two)
(detect-sample-dialect sentences-one) (detect-sample-dialect test-sentence-one)
(detect-sample-dialect @sentences-two) (detect-sample-dialect test-sentence-two)
(detect-sample-dialect sentences-two)
(detect-sample-dialect sentences-three) (detect-sample-dialect sentences-three)
(detect-sample-dialect sentences-four) (detect-sample-dialect sentences-four)
......
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