Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
getting close to done with persona crap
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Feb 2, 2020
1 parent 5a510e1 commit d0e01cb
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/andromeda/araserver/persona/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Main {
val pairs =
ArrayList(listOf(*mainVal.split("&").toTypedArray()))
term = pairs[0].replace("dial ", "")
val topics = graph?.let { SortWords(keyWord, term).getTopics(it) }
val topics = graph?.let { SortWords(keyWord, term).getNN(it) }
println(topics)
return ""
}
Expand Down
39 changes: 39 additions & 0 deletions src/main/java/com/andromeda/araserver/util/SortWords.kt
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ class SortWords(keyWord: KeyWord, mainVal: String) {
}
return toReturn
}
private fun sortForNN(graph: Parse): ArrayList<WordGraph> {
var toReturn = ArrayList<WordGraph>()
for (i in graph.children!!) {
if (i.type == "NN" ) {
toReturn.add(WordGraph(i.coveredText, "NN"))
}
if (i.childCount > 0) toReturn.addAll(sortForNN(i))
}
return toReturn
}
private fun sorter(graph: Parse, type:String): Boolean {
var toReturn = false
for (i in graph.children){
Expand All @@ -212,5 +222,34 @@ class SortWords(keyWord: KeyWord, mainVal: String) {
return toReturn
}

fun getNN(parse: Parser): ArrayList<WordGraph> {
val toReturn = ArrayList<WordGraph>()

var graph = key.getKeyWords(mainText,parse)?.get(0)


var working = true
if (graph != null) {
while (working) {
graph?.show()
when (graph?.childCount) {
1 -> graph = graph.children?.get(0)
0 -> working = false
else -> {
if (graph != null) {
val toTest = sortForNN(graph)
toReturn.addAll(toTest)
}
working = false
}
}
}
} else {
print("null")
println("fail")
}
return toReturn
}


}

0 comments on commit d0e01cb

Please sign in to comment.