use of org.dkpro.tc.features.twitter.NumberOfHashTags in project dkpro-tc by dkpro.
the class NumberOfHashTagsTest method numberOfHashTagsFeatureExtractorTest.
@Test
public void numberOfHashTagsFeatureExtractorTest() throws Exception {
AnalysisEngineDescription desc = createEngineDescription(NoOpAnnotator.class);
AnalysisEngine engine = createEngine(desc);
JCas jcas = engine.newJCas();
jcas.setDocumentLanguage("en");
jcas.setDocumentText("This is a very #emotional tweet ;-) #icouldcry #ILoveHashTags");
engine.process(jcas);
TextClassificationTarget aTarget = new TextClassificationTarget(jcas, 0, jcas.getDocumentText().length());
aTarget.addToIndexes();
NumberOfHashTags extractor = new NumberOfHashTags();
List<Feature> features = new ArrayList<Feature>(extractor.extract(jcas, aTarget));
Assert.assertEquals(1, features.size());
for (Feature feature : features) {
assertFeature(NumberOfHashTags.class.getSimpleName(), 3, feature);
}
}
Aggregations