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

Commit

Permalink
keywords almost done
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Nov 16, 2019
1 parent b74ed44 commit a8e6f9c
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/main/java/com/andromeda/araserver/util/SortWords.kt
Original file line number Diff line number Diff line change
@@ -1,36 +1,49 @@
package com.andromeda.araserver.util

import opennlp.tools.parser.Parse

class SortWords(keyWord: KeyWord, mainVal: String) {
val key = keyWord
val mainText = mainVal
fun getTopics() {
var graph = key.getKeyWords(mainText)?.get(0)

var working = true
if (graph != null) {

while (working) {
when {
graph?.childCount == 1 -> {graph = graph.children?.get(0)
println("is 1")
print(graph?.label)}
print(graph?.type)}
graph?.childCount == 0 -> {
working = false
println("stop")
}
else -> {
for (i in graph?.children!!) {
println("go 2")
println(i.label)
if (graph != null) {
sort(graph)
}
working = false
}
}

}
}
} else {
println("fail")
}


}
private fun sort(graph: Parse){
for (i in graph.children!!) {
//println("go 2")
println(i.type)
if (i.childCount > 0) sort(i)


}

}

fun getActions() {
Expand Down

0 comments on commit a8e6f9c

Please sign in to comment.