use of org.dkpro.tc.api.features.Instance in project dkpro-tc by dkpro.
the class InstanceTest method instanceEmptyInitializationTest.
@Test
public void instanceEmptyInitializationTest() throws Exception {
Instance instance = new Instance();
assertEquals(0, instance.getFeatures().size());
Feature f3 = new Feature("feature3", "value1", FeatureType.STRING);
instance.addFeature(f3);
assertEquals(1, instance.getFeatures().size());
}
use of org.dkpro.tc.api.features.Instance in project dkpro-tc by dkpro.
the class InstanceTest method instanceNoSetOutcomeTest.
@Test
public void instanceNoSetOutcomeTest() throws Exception {
Instance instance = new Instance();
assertEquals(null, instance.getOutcome());
}
use of org.dkpro.tc.api.features.Instance in project dkpro-tc by dkpro.
the class InstanceTest method testSetterAndGetter.
@Test
public void testSetterAndGetter() {
Instance i = new Instance(Arrays.asList(new Feature("dummy", 0, FeatureType.STRING)), "RESULT");
i.setJcasId(4711);
i.setSequenceId(234);
i.setWeight(2.0);
i.setSequencePosition(3);
assertEquals(4711, i.getJcasId());
assertEquals(234, i.getSequenceId());
assertEquals(2.0, i.getWeight(), 0.001);
assertEquals(3, i.getSequencePosition());
assertTrue(i.toString().startsWith("4711-234"));
}
use of org.dkpro.tc.api.features.Instance in project dkpro-tc by dkpro.
the class InstanceTest method instanceAddFeatureSetTest.
@Test
public void instanceAddFeatureSetTest() throws Exception {
Feature f1 = new Feature("feature1", "value1", FeatureType.STRING);
Feature f2 = new Feature("feature2", "value1", FeatureType.STRING);
List<Feature> features = new ArrayList<>();
features.add(f1);
features.add(f2);
Instance instance = new Instance(features, "outcome");
Set<Feature> s = new HashSet<Feature>();
Feature f3 = new Feature("feature3", "value3", FeatureType.STRING);
Feature f4 = new Feature("feature4", "value4", FeatureType.STRING);
s.add(f3);
s.add(f4);
instance.addFeatures(s);
assertEquals(4, instance.getFeatures().size());
}
use of org.dkpro.tc.api.features.Instance in project dkpro-tc by dkpro.
the class InstanceTest method instanceSetSingleOutcomeTest.
@Test
public void instanceSetSingleOutcomeTest() throws Exception {
Feature f1 = new Feature("feature1", "value1", FeatureType.STRING);
Instance instance = new Instance();
instance.addFeature(f1);
instance.setOutcomes("outcome");
assertEquals(1, instance.getOutcomes().size());
assertEquals("outcome", instance.getOutcome());
}
Aggregations