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

Commit

Permalink
added some more needed classes
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Nov 16, 2019
1 parent a8e6f9c commit ce56785
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/main/java/com/andromeda/araserver/util/SortWords.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.andromeda.araserver.util

import opennlp.tools.parser.Parse
import java.util.ArrayList

class SortWords(keyWord: KeyWord, mainVal: String) {
val key = keyWord
val mainText = mainVal
fun getTopics() {
var toReturn = ArrayList<WordGraph>()

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

var working = true
Expand All @@ -14,15 +17,13 @@ class SortWords(keyWord: KeyWord, mainVal: String) {
while (working) {
when {
graph?.childCount == 1 -> {graph = graph.children?.get(0)
println("is 1")
print(graph?.type)}
graph?.childCount == 0 -> {
working = false
println("stop")
}
else -> {
if (graph != null) {
sort(graph)
sortNouns(graph)
}
working = false
}
Expand All @@ -35,13 +36,10 @@ class SortWords(keyWord: KeyWord, mainVal: String) {


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


if (i.childCount > 0) sortNouns(i)
}

}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/andromeda/araserver/util/WordGraph.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.andromeda.araserver.util

data class WordGraph(val word:String, val type:Int)

0 comments on commit ce56785

Please sign in to comment.