use of org.opensextant.extractors.flexpat.RegexPatternManager in project Xponents by OpenSextant.
the class TestXCoord method systemTests.
/**
* Using the TestUtility, all patterns are tested and reported to the
* results folder.
*/
public void systemTests() {
RegexPatternManager mgr = xcoord.getPatternManager();
log.info("\n\n=== SYSTEM TESTS ===\n\n");
if (!mgr.testing) {
log.info("TESTING OFF -- TURN ON DEBUG in LOG4J");
return;
}
xcoord.match_UTM(true);
xcoord.match_MGRS(true);
xcoord.match_DD(true);
xcoord.match_DMS(true);
xcoord.match_DM(true);
try {
TestXCoordReporter tester = new TestXCoordReporter("./results/xcoord_System.csv");
for (PatternTestCase tst : mgr.testcases) {
TextMatchResult results = xcoord.extract_coordinates(tst.text, tst.id, tst.family_id);
results.add_trace("Test Payload: " + tst.text);
if (!results.evaluated) {
continue;
}
log.info("=========SYSTEM TEST " + tst.id + " FOUND:" + (results.matches.isEmpty() ? "NOTHING" : results.matches.size()));
tester.save_result(null, results);
}
tester.close_report();
} catch (Exception err) {
log.error("Not finishing tests", err);
return;
}
log.info("=== SYSTEM TESTS DONE ===");
}
use of org.opensextant.extractors.flexpat.RegexPatternManager in project Xponents by OpenSextant.
the class XTemporal method createPatternManager.
@Override
protected RegexPatternManager createPatternManager(InputStream strm, String name) throws IOException {
patterns_file = name;
PatternManager mgr = new PatternManager(strm, patterns_file);
mgr.testing = debug;
return mgr;
}
Aggregations