"; //System.out.println(classifyText(text1)); System.out.println(classifyText(text)); } public static Map classifyText(String text) { Map result = new HashMap(); try { // 上传普通文本 JSONObject res = client.keyword(new HashMap()); // 如果返回的json中有error这个key,就代表发生错误了 if(!res.has("error")) { result = JSONObject.fromObject(res); }else { result.put("error_code", res.getString("error_code")); result.put("error_msg", res.getString("error_msg")); } } catch (Exception e) { result.put("error_code", -1); result.put("error_msg", "发生异常"); } return result; }}