Skip to content

Commit

Permalink
Merge branch 'maw-server' of jamie:/u/nlp/git/javanlp into maw-server
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun Tejasvi Chaganty authored and Stanford NLP committed Sep 3, 2015
1 parent 6657954 commit f7d312f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
17 changes: 5 additions & 12 deletions src/edu/stanford/nlp/pipeline/StanfordCoreNLPClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
//
// extract all the properties from the command line
// if cmd line is empty, set the properties to null. The processor will search for the properties file in the classpath
if (args.length < 2) {
System.err.println("Usage: " + StanfordCoreNLPClient.class.getSimpleName() + " -host <hostname> -port <port> ...");
System.exit(1);
}
// if (args.length < 2) {
// System.err.println("Usage: " + StanfordCoreNLPClient.class.getSimpleName() + " -host <hostname> -port <port> ...");
// System.exit(1);
// }
Properties props = StringUtils.argsToProperties(args);
boolean hasH = props.containsKey("h");
boolean hasHelp = props.containsKey("help");
Expand All @@ -557,16 +557,9 @@ public static void main(String[] args) throws IOException, ClassNotFoundExceptio
return;
}

// Check required properties
if (props.getProperty("backend") == null) {
System.err.println("Usage: " + StanfordCoreNLPClient.class.getSimpleName() + " -backend <hostname:port,...> ...");
System.err.println("Missing required option: -backend <hostname:port,...>");
System.exit(1);
}

// Create the backends
List<Backend> backends = new ArrayList<>();
for (String spec : props.getProperty("backend").split(",")) {
for (String spec : props.getProperty("backend", "104.131.152.210:80").split(",")) {
String host = spec.substring(0, spec.indexOf(":"));
int port = Integer.parseInt(spec.substring(spec.indexOf(":") + 1));
backends.add(new Backend(host, port));
Expand Down
2 changes: 1 addition & 1 deletion src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public StanfordCoreNLPServer(int port) {
serverPort = port;

defaultProps = new Properties();
// defaultProps.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
defaultProps.setProperty("annotators", "tokenize,ssplit,pos,lemma,depparse");
defaultProps.setProperty("inputFormat", "text");
defaultProps.setProperty("outputFormat", "json");
Expand Down Expand Up @@ -256,6 +255,7 @@ private Annotation getDocument(Properties props, HttpExchange httpExchange) thro
@Override
public void run() {
try {

server = HttpServer.create(new InetSocketAddress(serverPort), 0); // 0 is the default 'backlog'
server.createContext("/ping", new PingHandler());
server.createContext("/", new SimpleAnnotateHandler(defaultProps));
Expand Down

0 comments on commit f7d312f

Please sign in to comment.