@@ -161,7 +161,7 @@ public StanfordCoreNLPServer(int port, int timeout, boolean strict) throws IOExc
161
161
/**
162
162
* Create a new Stanford CoreNLP Server, with the default parameters.
163
163
*
164
- * @throws IOException Thrown if we could not write the shutdown key to the a file.
164
+ * @throws IOException Thrown if we could not write the shutdown key to a file.
165
165
*/
166
166
public StanfordCoreNLPServer () throws IOException {
167
167
this (null );
@@ -171,7 +171,7 @@ public StanfordCoreNLPServer() throws IOException {
171
171
* Create a new Stanford CoreNLP Server with the default parameters and
172
172
* pass in properties (server_id, ...).
173
173
*
174
- * @throws IOException Thrown if we could not write the shutdown key to the a file.
174
+ * @throws IOException Thrown if we could not write the shutdown key to a file.
175
175
*/
176
176
public StanfordCoreNLPServer (Properties props ) throws IOException {
177
177
// set up default IO properties
@@ -203,8 +203,8 @@ public StanfordCoreNLPServer(Properties props) throws IOException {
203
203
// log server's default properties
204
204
TreeSet <String > defaultPropertyKeys = new TreeSet <>(this .defaultProps .stringPropertyNames ());
205
205
log ("Server default properties:\n \t \t \t (Note: unspecified annotator properties are English defaults)\n " +
206
- String . join ( " \n " , defaultPropertyKeys .stream ().map (
207
- k -> String .format ("\t \t \t %s = %s" , k , this .defaultProps .get (k ))).collect (Collectors .toList () )));
206
+ defaultPropertyKeys .stream ().map (
207
+ k -> String .format ("\t \t \t %s = %s" , k , this .defaultProps .get (k ))).collect (Collectors .joining ( " \n " )));
208
208
209
209
this .serverExecutor = Executors .newFixedThreadPool (ArgumentParser .threads );
210
210
this .corenlpExecutor = Executors .newFixedThreadPool (ArgumentParser .threads );
@@ -256,9 +256,9 @@ public StanfordCoreNLPServer(Properties props) throws IOException {
256
256
*
257
257
* @return A map of (key, value) pairs corresponding to the request parameters.
258
258
*
259
- * @throws UnsupportedEncodingException Thrown if we could not decode the URL with utf8.
259
+ * @throws IllegalStateException Thrown if we could not decode the URL with utf8.
260
260
*/
261
- private static Map <String , String > getURLParams (URI uri ) throws UnsupportedEncodingException {
261
+ private static Map <String , String > getURLParams (URI uri ) {
262
262
String query = uri .getRawQuery ();
263
263
if (query != null ) {
264
264
try {
@@ -485,9 +485,9 @@ private Properties getProperties(HttpExchange httpExchange) throws UnsupportedEn
485
485
486
486
// Load the default properties if resetDefault is false
487
487
// If resetDefault is true, ignore server properties this server was started with,
488
- // with the exception of the keys in serverIOProperties (i.e. don't reset IO properties)
488
+ // except the keys in serverIOProperties (i.e., don't reset IO properties)
489
489
Properties props = new Properties ();
490
- if (! urlParams .getOrDefault ("resetDefault" , "false" ).toLowerCase (). equals ("true" ))
490
+ if ( ! urlParams .getOrDefault ("resetDefault" , "false" ).equalsIgnoreCase ("true" ))
491
491
defaultProps .forEach ((key1 , value ) -> props .setProperty (key1 .toString (), value .toString ()));
492
492
else {
493
493
// if resetDefault is called, still maintain the serverIO properties (e.g. inputFormat, outputFormat, prettyPrint)
@@ -521,8 +521,9 @@ private Properties getProperties(HttpExchange httpExchange) throws UnsupportedEn
521
521
languageSpecificProperties .load (is );
522
522
PropertiesUtils .overWriteProperties (props ,languageSpecificProperties );
523
523
// don't enforce requirements for non-English
524
- if (!LanguageInfo .getLanguageFromString (language ).equals (LanguageInfo .HumanLanguage .ENGLISH ))
525
- props .setProperty ("enforceRequirements" , "false" );
524
+ if ( ! LanguageInfo .HumanLanguage .ENGLISH .equals (LanguageInfo .getLanguageFromString (language ))) {
525
+ props .setProperty ("enforceRequirements" , "false" );
526
+ }
526
527
// check if the server is set to use the srparser, and if so,
527
528
// set the parse.model to be srparser.model
528
529
// also, check properties for the srparser.model prop
@@ -800,7 +801,7 @@ public void handle(HttpExchange httpExchange) throws IOException {
800
801
801
802
802
803
/**
803
- * Sending the appropriate shutdown key will gracefully shutdown the server.
804
+ * Sending the appropriate shutdown key will gracefully shut down the server.
804
805
* This key is, by default, saved into the local file /tmp/corenlp.shutdown on the
805
806
* machine the server was run from.
806
807
*/
@@ -1120,7 +1121,7 @@ public void handle(HttpExchange httpExchange) throws IOException {
1120
1121
String pattern = params .get ("pattern" );
1121
1122
// (get whether to filter / find)
1122
1123
String filterStr = params .getOrDefault ("filter" , "false" );
1123
- final boolean filter = filterStr .trim ().isEmpty () || "true" .equalsIgnoreCase (filterStr . toLowerCase () );
1124
+ final boolean filter = filterStr .trim ().isEmpty () || "true" .equalsIgnoreCase (filterStr );
1124
1125
// (create the matcher)
1125
1126
final TokenSequencePattern regex = TokenSequencePattern .compile (pattern );
1126
1127
@@ -1248,10 +1249,10 @@ public void handle(HttpExchange httpExchange) throws IOException {
1248
1249
String pattern = params .get ("pattern" );
1249
1250
// (get whether to filter / find)
1250
1251
String filterStr = params .getOrDefault ("filter" , "false" );
1251
- final boolean filter = filterStr .trim ().isEmpty () || "true" .equalsIgnoreCase (filterStr . toLowerCase () );
1252
+ final boolean filter = filterStr .trim ().isEmpty () || "true" .equalsIgnoreCase (filterStr );
1252
1253
// (in case of find, get whether to only keep unique matches)
1253
1254
String uniqueStr = params .getOrDefault ("unique" , "false" );
1254
- final boolean unique = uniqueStr .trim ().isEmpty () || "true" .equalsIgnoreCase (uniqueStr . toLowerCase () );
1255
+ final boolean unique = uniqueStr .trim ().isEmpty () || "true" .equalsIgnoreCase (uniqueStr );
1255
1256
// (create the matcher)
1256
1257
final SemgrexPattern regex = SemgrexPattern .compile (pattern );
1257
1258
final SemanticGraphCoreAnnotations .DependenciesType dependenciesType =
@@ -1501,8 +1502,10 @@ protected class SceneGraphHandler implements HttpHandler {
1501
1502
/**
1502
1503
* Create a new SceneGraphHandler.
1503
1504
* <br>
1504
- * It's not clear what a callback would do with this, since there's no Annotation at the end of a SceneGraph call, so we just skip it
1505
- * @param callback The callback to call when annotation has finished.
1505
+ * It's not clear what a callback would do with this, since there's no Annotation at the end of a SceneGraph call,
1506
+ * so we just skip it.
1507
+ *
1508
+ * @param authenticator The callback to call when annotation has finished.
1506
1509
*/
1507
1510
public SceneGraphHandler (Predicate <Properties > authenticator ) {
1508
1511
this .authenticator = authenticator ;
0 commit comments