Update derekovecs api server address and fix call

Change-Id: Ie777e8202d5f5a7d2802c3be4e508e607daf9ec9
diff --git a/R/derekovecs_apicall_syn_nlc.R b/R/derekovecs_apicall_syn_nlc.R
index b896e5c..93ab249 100644
--- a/R/derekovecs_apicall_syn_nlc.R
+++ b/R/derekovecs_apicall_syn_nlc.R
@@ -7,6 +7,7 @@
 library(tidyverse)
 
 stopwords <- readLines(con = "../data/stopwords.txt",encoding="UTF-8")
+derekovecs_server = 'https://corpora.ids-mannheim.de/openlab/derekovecs/'
 
 # ngramme <- read.csv("../data/gold03_anno_ml.csv", quote="", header = TRUE, sep = "\t", dec=",", encoding="UTF-8")
 
@@ -17,9 +18,9 @@
 
 DeReKoVecsCall <- function(wordform = "Grund", cutoff = 500000, n = 100) {
   params = list(word = wordform, cutoff = cutoff, n = n, json = 1)
-  response <- tryCatch({httr::GET(url = 'http://korap-worker-04:5673', query = params,timeout(10))},
-                       error=function(cond) return(NA))
-  if(!is.na(response)) {
+  response <- tryCatch({httr::GET(url = derekovecs_server, query = params,timeout(10))},
+                       error=function(cond) return(NULL))
+  if(!is.null(response) && httr::status_code(response) == 200) {
     content(response, as = 'parsed', type = 'application/json', simplifyDataFrame = TRUE)
   }
   else {
@@ -34,9 +35,9 @@
 }
 
 getClassicCollocates <- function(wordform = "Grund") {
-  response <- tryCatch({httr::GET(url = 'http://korap-worker-04:5673/getClassicCollocators', query = list(w=wordform),timeout(10))},
-                       error=function(cond) return(NA))
-  if(!is.na(response)) {
+  response <- tryCatch({httr::GET(url = paste0(derekovecs_server, 'getClassicCollocators'), query = list(w=wordform),timeout(10))},
+                       error=function(cond) return(NULL))
+  if(!is.null(response) && httr::status_code(response) == 200) {
     content(response, as = 'parsed', type = 'application/json', simplifyDataFrame = TRUE)$collocates
   }
   else {