@SuppressWarnings({"StringEqualsEmptyString"})
  public static void main (String[] args) throws Exception {
    Properties props = StringUtils.argsToProperties(args);
    String loadFile = props.getProperty("loadClassifier");
    String loadJarFile = props.getProperty("loadJarClassifier");
    String client = props.getProperty("client");
    String portStr = props.getProperty("port");
    props.remove("port"); // so later code doesn't complain
    if (portStr == null || portStr.equals("")) {
      System.err.println(USAGE);
      return;
    }
    String charset = "utf-8";
    String encoding = props.getProperty("encoding");
    if (encoding != null && ! "".equals(encoding)) {
      charset = encoding;
    }
    int port;
    try {
      port = Integer.parseInt(portStr);
    } catch (NumberFormatException e) {
      System.err.println("Non-numerical port");
      System.err.println(USAGE);
      return;
    }
    // default output format for if no output format is specified
    if (props.getProperty("outputFormat") == null) {
      props.setProperty("outputFormat", "slashTags");
    }

    if (client != null && ! client.equals("")) {
      // run a test client for illustration/testing
      String host = props.getProperty("host");
      NERClient.communicateWithNERServer(host, port, charset);
    } else {
      AbstractSequenceClassifier asc;
      if (loadFile != null && ! loadFile.equals("")) {
        asc = CRFClassifier.getClassifier(loadFile, props);
      } else if (loadJarFile != null && ! loadJarFile.equals("")) {
        asc = CRFClassifier.getJarClassifier(loadJarFile, props);
      } else {
        asc = CRFClassifier.getDefaultClassifier(props);
      }

      new NERServer(port, asc, charset).run();
    }
  }
@ SuppressWarnings ( { "StringEqualsEmptyString" } ) public static void main ( String [ ] args ) throws Exception { Properties props = StringUtils . argsToProperties ( args ) ; String loadFile = props . getProperty ( "loadClassifier" ) ; String loadJarFile = props . getProperty ( "loadJarClassifier" ) ; String client = props . getProperty ( "client" ) ; String portStr = props . getProperty ( "port" ) ; props . remove ( "port" ) ; if ( portStr == null || portStr . equals ( "" ) ) { System . err . println ( USAGE ) ; return ; } String charset = "utf-8" ; String encoding = props . getProperty ( "encoding" ) ; if ( encoding != null && ! "" . equals ( encoding ) ) { charset = encoding ; } int port ; try { port = Integer . parseInt ( portStr ) ; } catch ( NumberFormatException e ) { System . err . println ( "Non-numerical port" ) ; System . err . println ( USAGE ) ; return ; } if ( props . getProperty ( "outputFormat" ) == null ) { props . setProperty ( "outputFormat" , "slashTags" ) ; } if ( client != null && ! client . equals ( "" ) ) { String host = props . getProperty ( "host" ) ; NERClient . communicateWithNERServer ( host , port , charset ) ; } else { AbstractSequenceClassifier asc ; if ( loadFile != null && ! loadFile . equals ( "" ) ) { asc = CRFClassifier . getClassifier ( loadFile , props ) ; } else if ( loadJarFile != null && ! loadJarFile . equals ( "" ) ) { asc = CRFClassifier . getJarClassifier ( loadJarFile , props ) ; } else { asc = CRFClassifier . getDefaultClassifier ( props ) ; } new NERServer ( port , asc , charset ) . run ( ) ; } }
Starts this server on the specified port.  The classifier used can be
either a default one stored in the jar file from which this code is
invoked or you can specify it as a filename or as another classifier
resource name, which must correspond to the name of a resource in the
/classifiers/ directory of the jar file.
<p>
Usage: <code>java edu.stanford.nlp.ie.NERServer [-loadClassifier file|-loadJarClassifier resource|-client] -port portNumber</code>

@param args Command-line arguments (described above)
@throws Exception If file or Java class problems with serialized classifier