package de.tudarmstadt.awesome.erclaerung.feature;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.uima.jcas.JCas;

import de.tudarmstadt.ukp.dkpro.tc.api.exception.TextClassificationException;
import de.tudarmstadt.ukp.dkpro.tc.api.features.DocumentFeatureExtractor;
import de.tudarmstadt.ukp.dkpro.tc.api.features.Feature;
import de.tudarmstadt.ukp.dkpro.tc.api.features.FeatureExtractorResource_ImplBase;

public class WSoundUUDominanceDFE extends FeatureExtractorResource_ImplBase implements DocumentFeatureExtractor {
	public static final String FN_UU_DOMINANCE = "UUDominance";

	public List<Feature> extract(JCas jcas) throws TextClassificationException {
		String documentText = jcas.getDocumentText().toLowerCase();

		double w_sound_as_w = StringUtils.countMatches(documentText, "w") * 0.5d;
		double w_sound_as_uu = StringUtils.countMatches(documentText, "uu");

		double res = 0;
		if (w_sound_as_w > 0 && w_sound_as_uu > 0)
			res = w_sound_as_uu / w_sound_as_w;

		List<Feature> featList = new ArrayList<Feature>();
		featList.add(new Feature(FN_UU_DOMINANCE, res));
		return featList;
	}
}

@@ -168,19 +168,127 @@
 ima.
-jcas.JCas;%0A
+fit.util.JCasUtil;%0Aimport org.apache.uima.jcas.JCas;%0A%0Aimport de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token;
 %0Aimp
@@ -903,28 +903,24 @@
 %09double 
-w_sound_as_w
+count_uu
  = Strin
@@ -958,18 +958,12 @@
 t, %22
-w%22) * 0.5d
+uu%22)
 ;%0A%09%09
@@ -973,171 +973,153 @@
 ble 
-w_sound_as_uu = StringUtils.countMatches(documentText, %22uu%22);%0A%0A%09%09double res = 0;%0A%09%09if (w_sound_as_w %3E 0 && w_sound_as_uu %3E 0)%0A%09%09%09res = w_sound_as_uu / w_sound_as_w
+count_tokens = JCasUtil.select(jcas, Token.class).size();%0A%0A%09%09double res = 1000 * count_uu / count_tokens;%0A%0A%09%09// System.out.println(%22%5BUU%5D %22 + res)
 ;%0A%0A%09

Fix in the forumula