Commit e0a76167 authored by mak28ma's avatar mak28ma
Browse files

fixed even more bugs...

parent 768779d1
......@@ -143,6 +143,7 @@ public class EntityAccuracyEvaluation implements IEvaluation {
private void createBEEntities(ALabelling[] labels, Map<Point, String> entityMap) {
int beg = -1;
boolean inEntity = false;
String openedS = "";
for (int i = 0; i < labels.length; i++) {
ALabelling labelling = labels[i];
String stringLabel = labelling.getStringLabel();
......@@ -154,18 +155,24 @@ public class EntityAccuracyEvaluation implements IEvaluation {
if (split[0].startsWith("B")) {
// check if we had a previous entity to close
inEntity = true;
beg = i;
}
else if (split[0].startsWith("O")) {
if (inEntity) {
// close the previous entity
entityMap.put(new Point(beg, i - 1), labels[i - 1].getStringLabel().split(typeSplitter)[1]);
entityMap.put(new Point(beg, i - 1), openedS);
}
inEntity = false;
inEntity = true;
openedS = split[1];
beg = i;
}
} else if (split[0].startsWith("E")) {
// else if (split[0].startsWith("O")) {
// if (inEntity) {
// // close the previous entity
// entityMap.put(new Point(beg, i - 1), labels[i - 1].getStringLabel().split(typeSplitter)[1]);
// }
// inEntity = false;
//
// }
else if (split[0].startsWith("E")) {
if (inEntity){
//build that entity
......@@ -180,8 +187,7 @@ public class EntityAccuracyEvaluation implements IEvaluation {
//possibly there is a last entity
if (inEntity) {
// add it
entityMap.put(new Point(beg, labels.length - 1),
labels[labels.length - 1].getStringLabel().split(typeSplitter)[1]);
entityMap.put(new Point(beg, labels.length - 1),openedS);
}
}
......
......@@ -28,6 +28,7 @@ import de.uniwue.ls6.datastructure.ALabelling;
import de.uniwue.ls6.datastructure.Instance;
import de.uniwue.ls6.datastructure.SimpleLabelling;
import de.uniwue.ls6.rulelearning.algorithm.impl.MultiClassOneVsAllRepresentationRuleAlgorithm;
import de.uniwue.ls6.rulelearning.algorithm.impl.MultiClassRuleLearningAlgorithm;
import de.uniwue.ls6.rulelearning.evaluation.eval.EEntityEvaluationsScheme;
import de.uniwue.ls6.rulelearning.evaluation.eval.EntityAccuracyEvaluation;
import de.uniwue.ls6.rulelearning.evaluation.eval.LabelAccuracyEvaluation;
......@@ -37,6 +38,7 @@ import de.uniwue.ls6.rulelearning.instanceloading.featuregenerator.CMU_NextToken
import de.uniwue.ls6.rulelearning.instanceloading.featuregenerator.CMU_PersonRegex;
import de.uniwue.ls6.rulelearning.instanceloading.featuregenerator.CMU_PrevTokenLineBreak;
import de.uniwue.ls6.rulelearning.instanceloading.featuregenerator.CMU_TimeRegex;
import de.uniwue.ls6.rulelearning.instanceloading.featuregenerator.POSTagFeatureGenerator;
import de.uniwue.ls6.rulelearning.instanceloading.featuregenerator.WordCategorizationNoNGram;
import de.uniwue.ls6.rulelearning.instanceloading.featuregenerator.WordFeaturegenerator;
import de.uniwue.ls6.rulelearning.instanceloading.io.InstanceCreationFactory;
......@@ -51,9 +53,9 @@ public class FirstTestEACLBE5 {
.toUri().toString();
TypeSystemDescription tsd = TypeSystemDescriptionFactory.createTypeSystemDescriptionFromPath(uriDkPro);
MultiClassOneVsAllRepresentationRuleAlgorithm algorithm = new MultiClassOneVsAllRepresentationRuleAlgorithm(
200);
algorithm.skipTrainingForLabel("O-");
MultiClassRuleLearningAlgorithm algorithm = new MultiClassRuleLearningAlgorithm(
50);
//algorithm.skipTrainingForLabel("O-");
// algorithm.setUseDropOut(new Random(13374211), 0.7);
List<Instance> instancesTrain = new ArrayList<Instance>();
List<Instance> instancesTest = new ArrayList<Instance>();
......@@ -154,12 +156,12 @@ public class FirstTestEACLBE5 {
instancesTrain.addAll(InstanceCreationFactory.createWindowedInstancesFromUIMAFiles(trainData, 100000,
instancesTrain.size(), 3, 3, "de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS", tsd,
new BE_CONNL_NE_UIMA_FeatureGen("de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.morph.Morpheme",
"Entity", "morphTag"),
"Entity", "morphTag"),new POSTagFeatureGenerator("PosValue"),
new WordFeaturegenerator(), new CMU_PersonRegex(), new WordCategorizationNoNGram(), new CMU_TimeRegex(),
new CMU_LineStartsWithToken(), new CMU_PrevTokenLineBreak(), new CMU_NextTokenLineBreak()));
}
private static void evaluate(MultiClassOneVsAllRepresentationRuleAlgorithm algorithm,
private static void evaluate(MultiClassRuleLearningAlgorithm algorithm,
List<Instance> instancesTestA) {
List<ALabelling> goldLabels = new ArrayList<>();
List<ALabelling> systemLabels = new ArrayList<>();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment