Java tutorial
/* * Copyright 2016 * Ubiquitous Knowledge Processing (UKP) Lab * Technische Universitt Darmstadt * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.tudarmstadt.ukp.experiments.argumentation.comments.pipeline; import de.tudarmstadt.ukp.dkpro.argumentation.type.DebateArgumentMetaData; import org.apache.commons.math.stat.Frequency; import org.apache.uima.analysis_engine.AnalysisEngineProcessException; import org.apache.uima.fit.component.JCasAnnotator_ImplBase; import org.apache.uima.fit.factory.AnalysisEngineFactory; import org.apache.uima.fit.factory.CollectionReaderFactory; import org.apache.uima.fit.pipeline.SimplePipeline; import org.apache.uima.fit.util.JCasUtil; import org.apache.uima.jcas.JCas; /** * @author Ivan Habernal */ public class DebateStatistics extends JCasAnnotator_ImplBase { Frequency pointFrequency = new Frequency(); @Override public void process(JCas aJCas) throws AnalysisEngineProcessException { DebateArgumentMetaData metaData = JCasUtil.selectSingle(aJCas, DebateArgumentMetaData.class); int points = metaData.getArgPoints(); pointFrequency.addValue(points); } @Override public void collectionProcessComplete() throws AnalysisEngineProcessException { super.collectionProcessComplete(); System.out.println(pointFrequency); } public static void main(String[] args) { String inFolder = args[0]; try { SimplePipeline.runPipeline( CollectionReaderFactory.createReaderDescription(DebateArgumentReader.class, DebateArgumentReader.PARAM_SOURCE_LOCATION, inFolder), // statistics AnalysisEngineFactory.createEngineDescription(DebateStatistics.class)); } catch (Exception ex) { ex.printStackTrace(); } } }