com.aliasi.test.unit.features.MockFeatureExtractor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aliasi-lingpipe Show documentation
Show all versions of aliasi-lingpipe Show documentation
This is the original Lingpipe:
http://alias-i.com/lingpipe/web/download.html
There were not made any changes to the source code.
package com.aliasi.test.unit.features;
import java.io.ObjectOutputStream;
import java.io.IOException;
import java.io.NotSerializableException;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import java.util.Map;
import com.aliasi.util.FeatureExtractor;
public class MockFeatureExtractor
extends SerializableMockFeatureExtractor {
private void writeObject(ObjectOutputStream out) throws IOException {
throw new NotSerializableException();
}
public static void assertFeats(FeatureExtractor fe,
E in,
String[] feats,
double[] vals) {
Map featVec = fe.features(in);
assertEquals(feats.length,vals.length);
assertEquals(featVec.size(),feats.length);
for (int i = 0; i < feats.length; ++i) {
assertNotNull("no val for " + feats[i],featVec.get(feats[i]));
assertEquals(feats[i],vals[i],featVec.get(feats[i]).doubleValue(),0.0001);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy