Search in sources :

Example 1 with DocInput

use of org.opensextant.data.DocInput in project Xponents by OpenSextant.

the class XtractorGroup method processAndFormat.

/**
     * Processes input content against all extractors and all formatters This
     * does not throw exceptions, as some processing may fail, while others
     * succeed. TODO: Processing/Formatting details would have to be retrieved
     * by calling some other method that is statefully tracking such things.
     *
     * @param input
     * @return status -1 failure, 0 nothing found, 1 found matches and
     *         formatted; 2 found content but nothing formatted. them.
     */
public int processAndFormat(TextInput input) {
    reset();
    ExtractionResult compilation = new ExtractionResult(input.id);
    if (input instanceof DocInput) {
        compilation.recordFile = ((DocInput) input).getFilepath();
        compilation.recordTextFile = ((DocInput) input).getTextpath();
    }
    compilation.matches = process(input);
    compilation.input = input;
    if (compilation.matches.isEmpty()) {
        // nothing found
        return 0;
    }
    int status = format(compilation);
    return status;
}
Also used : DocInput(org.opensextant.data.DocInput) ExtractionResult(org.opensextant.extraction.ExtractionResult)

Aggregations

DocInput (org.opensextant.data.DocInput)1 ExtractionResult (org.opensextant.extraction.ExtractionResult)1