Search in sources :

Example 1 with Extractor

use of org.opensextant.extraction.Extractor in project Xponents by OpenSextant.

the class XtractorGroup method process.

/**
     * Process one input. If you have no need for formatting output at this time
     * use this. If you have complext ExtractionResults where you want to add
     * meta attributes, then you would use this approach
     */
public List<TextMatch> process(TextInput input) {
    List<TextMatch> oneResultSet = new ArrayList<TextMatch>();
    progressMonitor.setNumberOfSteps(extractors.size());
    /**
         * Process all extraction and compile on a single list.
         */
    for (Extractor x : extractors) {
        try {
            List<TextMatch> results = x.extract(input);
            if (results != null && !results.isEmpty()) {
                oneResultSet.addAll(results);
            }
        } catch (ExtractionException loopErr) {
            log.error("Extractor=" + x.getName() + "on Input=" + input.id, loopErr);
            currErrors.add("Extractor=" + x.getName() + " ERR=" + loopErr.getMessage());
        }
    }
    progressMonitor.completeDocument();
    return oneResultSet;
}
Also used : ExtractionException(org.opensextant.extraction.ExtractionException) ArrayList(java.util.ArrayList) TextMatch(org.opensextant.extraction.TextMatch) Extractor(org.opensextant.extraction.Extractor)

Example 2 with Extractor

use of org.opensextant.extraction.Extractor in project Xponents by OpenSextant.

the class XponentsGeotagger method stop.

/**
	 * Must explicitly stop Solr multi-threading. 
	 */
@Override
public void stop() {
    Extractor x = getExtractor();
    if (x != null) {
        x.cleanup();
    }
    System.exit(0);
}
Also used : Extractor(org.opensextant.extraction.Extractor)

Aggregations

Extractor (org.opensextant.extraction.Extractor)2 ArrayList (java.util.ArrayList)1 ExtractionException (org.opensextant.extraction.ExtractionException)1 TextMatch (org.opensextant.extraction.TextMatch)1