Search in sources :

Example 1 with ParseConfigurationOutput

use of com.joliciel.talismane.parser.output.ParseConfigurationOutput in project talismane by joliciel-informatique.

the class StandoffWriter method onNextParseConfiguration.

@Override
public void onNextParseConfiguration(ParseConfiguration parseConfiguration) throws IOException {
    Map<String, Object> model = new HashMap<String, Object>();
    ParseConfigurationOutput output = new ParseConfigurationOutput(parseConfiguration);
    model.put("sentence", output);
    model.put("configuration", parseConfiguration);
    model.put("tokenCount", tokenCount);
    model.put("relationCount", relationCount);
    model.put("sentenceCount", sentenceCount);
    model.put("characterCount", characterCount);
    model.put("LOG", LOG);
    List<DependencyArc> dependencies = new ArrayList<DependencyArc>();
    for (DependencyArc dependencyArc : parseConfiguration.getRealDependencies()) {
        if (!dependencyArc.getLabel().equals(punctuationDepLabel)) {
            dependencies.add(dependencyArc);
        }
    }
    model.put("dependencies", dependencies);
    this.process(model, writer);
    tokenCount += parseConfiguration.getPosTagSequence().size();
    relationCount += dependencies.size();
    characterCount += parseConfiguration.getSentence().getText().length();
    sentenceCount += 1;
}
Also used : ParseConfigurationOutput(com.joliciel.talismane.parser.output.ParseConfigurationOutput) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DependencyArc(com.joliciel.talismane.parser.DependencyArc)

Aggregations

DependencyArc (com.joliciel.talismane.parser.DependencyArc)1 ParseConfigurationOutput (com.joliciel.talismane.parser.output.ParseConfigurationOutput)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1