@@ -90,6 +90,8 @@ public class StanfordCoreNLPServer implements Runnable {
90
90
protected static String blockList = null ;
91
91
@ ArgumentParser .Option (name ="stanford" , gloss ="If true, do special options (domain blockList, timeout modifications) for public Stanford server" )
92
92
protected boolean stanford = false ;
93
+ @ ArgumentParser .Option (name ="srparser" , gloss ="If true, use the srparser by default if possible. Should save speed & memory on large queries" )
94
+ protected boolean srparser = false ;
93
95
94
96
/** List of server specific properties **/
95
97
private static final List <String > serverSpecificProperties = ArgumentParser .listOptions (StanfordCoreNLPServer .class );
@@ -521,6 +523,13 @@ private Properties getProperties(HttpExchange httpExchange) throws UnsupportedEn
521
523
// don't enforce requirements for non-English
522
524
if (!LanguageInfo .getLanguageFromString (language ).equals (LanguageInfo .HumanLanguage .ENGLISH ))
523
525
props .setProperty ("enforceRequirements" , "false" );
526
+ // check if the server is set to use the srparser, and if so,
527
+ // set the parse.model to be srparser.model
528
+ // also, check properties for the srparser.model prop
529
+ // perhaps some languages don't have a default set for that
530
+ if (srparser && languageSpecificProperties .containsKey ("srparser.model" )) {
531
+ props .setProperty ("parse.model" , languageSpecificProperties .getProperty ("srparser.model" ));
532
+ }
524
533
} catch (IOException e ) {
525
534
err ("Failure to load language specific properties: " + languagePropertiesFile + " for " + language );
526
535
}
0 commit comments