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

Commit

Permalink
added final vals
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Nov 28, 2019
1 parent 87f2509 commit 5d926f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Binary file modified bin/jar/Ara-Server.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/java/com/andromeda/araserver/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public NanoHTTPD.Response serve(NanoHTTPD.IHTTPSession session) {
//Start the Hello function
else if (sessionUri.startsWith("/hi")) main2 = new Hello().hello();
else if (sessionUri.startsWith("/yelpclient")) main2 = new Locdec().main(sessionUri, keyWord, parser);
else if (sessionUri.startsWith("/weath")) main2 = new Weather().getWeatherNow(sessionUri);
else if (sessionUri.startsWith("/weath")) main2 = new Weather().mainPart(sessionUri, keyWord, parser);
else if (sessionUri.startsWith("/search")) {
main2 = new GetInfo().main(sessionUri);
} else if (sessionUri.startsWith("/math")) main2 = new Equations().main(sessionUri);
Expand Down
21 changes: 11 additions & 10 deletions src/main/java/com/andromeda/araserver/skills/Weather.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Weather {


}
fun mainPart(url: String, key: KeyWord, parse: Parser){
fun mainPart(url: String, key: KeyWord, parse: Parser): String? {
val pairs =
ArrayList(listOf(*url.split("&".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()))
//Finish the job an get the raw values
Expand All @@ -53,35 +53,36 @@ class Weather {
}
}
val loc = term?.let { getLocAndTime(it, key, parse) }
return loc


}
fun getLocAndTime(term:String, key:KeyWord, parse:Parser): String {
println("Start NLP pls")
val toSort = SortWords(key, term).getTopicsPhrase(parse)
val dateArray =ArrayList<String>()
var time = ""
var time = "123456789"
dateArray.add( "tomorrow")
//work on this
for (i in dateArray){
for (i2 in toSort){
if (i == i2.word) time = i2.word
break

}
}
println(time)
var text = ""
for (i in toSort){
if (i.type == "NN" && i.word != time){
text += i.word
if (i.type == "NN" && i.word != time && i.word != "weather"){
text += i.word + "%20"
}
}
val urlSearch = URL("https://atlas.microsoft.com/search/address/json?subscription-key=fB86F9IVmt2S20DMe5rlo3kJOpNkaUp1Py5txnPQt-I&api-version=1.0&query=$text")
val jsonRawText = urlSearch.readText()
val jArray = JsonParser().parse(jsonRawText).asJsonObject.getAsJsonArray("results")
return ""

}
val lat = jArray[0].asJsonObject.getAsJsonObject("position").get("lat").asString
val log = jArray[0].asJsonObject.getAsJsonObject("position").get("lon").asString
return "hello 2"

companion object {
const val NOW = 0
}
}

0 comments on commit 5d926f7

Please sign in to comment.