use of edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager in project cogcomp-nlp by CogComp.
the class LemmatizerTATest method stanfordTest.
@Test
public void stanfordTest() {
Properties props = new Properties();
// set non-default lemmatizer constructor params
props.setProperty(LemmatizerConfigurator.USE_STNFRD_CONVENTIONS.key, LemmatizerConfigurator.TRUE);
// since we are calling
props.setProperty(LemmatizerConfigurator.IS_LAZILY_INITIALIZED.key, LemmatizerConfigurator.FALSE);
ResourceManager rm = new LemmatizerConfigurator().getConfig(new ResourceManager(props));
IllinoisLemmatizer lem = new IllinoisLemmatizer(new LemmatizerConfigurator().getConfig(rm));
String lemma = lem.getLemma("me", "PRP");
assertTrue(lemma.equals("i"));
}
use of edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager in project cogcomp-nlp by CogComp.
the class CuratorFactoryTest method testGetIndividualTextAnnotationViews.
@Test
public void testGetIndividualTextAnnotationViews() throws IOException {
// if we are running the test on Semaphore, ignore this test, since Gurobi is not provided on Semaphore.
if (System.getenv().containsKey("CI") && System.getenv().get("CI").equals("true") && System.getenv().containsKey("SEMAPHORE") && System.getenv().get("SEMAPHORE").equals("true") && System.getenv().containsKey("CIRCLECI") && System.getenv().get("CIRCLECI").equals("true")) {
System.out.println("Running the test on Semaphore. Skipping this test . . . ");
} else {
TextAnnotation ta = null;
try {
ResourceManager rm = new ResourceManager(CONFIG_FILE);
ta = curator.createBasicTextAnnotation("test", "0", text);
for (String viewName : rm.getCommaSeparatedValues(CuratorConfigurator.VIEWS_TO_ADD.key)) curator.addView(ta, viewName);
} catch (AnnotatorException e) {
e.printStackTrace();
fail(e.getMessage());
} catch (IllegalArgumentException e) {
// If this is a "connection timeout" exception we can ignore it
if (e.getMessage().contains("Connection timed out"))
return;
}
testViews(ta);
}
}
use of edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager in project cogcomp-nlp by CogComp.
the class ExternalAnnotatorServiceFactory method buildPipeline.
/**
* create an AnnotatorService with components specified by the ResourceManager (to override
* defaults in {@link ExternalToolsConfigurator}
*
* @param rm non-default config options
* @return AnnotatorService with specified NLP components
* @throws IOException
* @throws AnnotatorException
*/
public static BasicAnnotatorService buildPipeline(ResourceManager rm) throws IOException, AnnotatorException {
// Merges default configuration with the user-specified overrides.
ResourceManager fullRm = (new ExternalToolsConfigurator()).getConfig(rm);
Boolean splitOnDash = fullRm.getBoolean(ExternalToolsConfigurator.SPLIT_ON_DASH);
boolean isSentencePipeline = fullRm.getBoolean(ExternalToolsConfigurator.USE_SENTENCE_PIPELINE.key);
TextAnnotationBuilder taBldr = new TokenizerTextAnnotationBuilder(new StatefulTokenizer(splitOnDash));
Map<String, Annotator> annotators = buildAnnotators();
return isSentencePipeline ? new SentencePipeline(taBldr, annotators, fullRm) : new BasicAnnotatorService(taBldr, annotators, fullRm);
}
Aggregations