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

Commit

Permalink
added day of the week detection
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Nov 30, 2019
1 parent 1d77d2a commit d88d614
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Binary file modified bin/jar/Ara-Server.jar
Binary file not shown.
9 changes: 8 additions & 1 deletion src/main/java/com/andromeda/araserver/skills/Weather.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ class Weather {
var time = ""
dateArray.add("tomorrow")
dateArray.add("monday")
dateArray.add("sunday")
dateArray.add("tuesday")
dateArray.add("saturday")
dateArray.add("wednesday")
dateArray.add("thursday")
dateArray.add("friday")
//work on this
for (i in dateArray) {
for (i2 in toSort) {
Expand Down Expand Up @@ -133,6 +139,7 @@ class Weather {
if (timeWord == "" && timeWord != "tomorrow") phrase.addAll(SortWords(key, mainVal).getComplexDate(parse))
else if (timeWord == "tomorrow") returnVal = 1
else returnVal = timeMap(timeWord)?.let { getTime(dayOfWeek, it) }!!
println("num is $returnVal")

return returnVal
}
Expand All @@ -151,7 +158,7 @@ class Weather {

}
private fun getTime(currentTime:Int, nextTime:Int): Int {
val firstResult = currentTime - nextTime
val firstResult = nextTime - currentTime
return if (firstResult <= 0) firstResult + 7
else firstResult
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/com/andromeda/araserver/util/SortWords.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,8 @@ class SortWords(keyWord: KeyWord, mainVal: String) {
}

fun sortForTopics(graph: Parse): ArrayList<WordGraph> {
println("start")
var toReturn = ArrayList<WordGraph>()
for (i in graph.children!!) {
print(i.coveredText+ " " + i.type)
if (i.type == "NP" && i.parent.type == "PP" ) {
toReturn.add(WordGraph(i.coveredText, i.type))
}
Expand Down Expand Up @@ -192,7 +190,6 @@ class SortWords(keyWord: KeyWord, mainVal: String) {
private fun sortForComplexDate(graph: Parse): ArrayList<WordGraph> {
var toReturn = ArrayList<WordGraph>()
for (i in graph.children!!) {
println(i.coveredText+ " " + i.type)
if (i.type == "NP" && i.parent.type == "PP" && sorter(i, "CD")) {
toReturn.addAll(sortForAll(i))
}
Expand Down

0 comments on commit d88d614

Please sign in to comment.