@Test public void initialLetterTest() throws Exception { AnalysisEngineDescription desc = createEngineDescription(BreakIteratorSegmenter.class); AnalysisEngine engine = createEngine(desc); JCas jcas = engine.newJCas(); jcas.setDocumentLanguage("en"); jcas.setDocumentText("he Loves it"); engine.process(jcas); TextClassificationTarget aTarget = new TextClassificationTarget(jcas, 3, 8); aTarget.addToIndexes(); InitialCharacterUpperCase extractor = new InitialCharacterUpperCase(); Set<Feature> features = extractor.extract(jcas, aTarget); List<Feature> fetList = new ArrayList<>(features); Assert.assertEquals(1, features.size()); Assert.assertEquals(InitialCharacterUpperCase.FEATURE_NAME, fetList.get(0).getName()); Assert.assertEquals(1.0, (double) fetList.get(0).getValue(), 0.1); }
@Override public Set<Feature> extract(JCas jcas, TextClassificationTarget aTarget) throws TextClassificationException { String token = aTarget.getCoveredText(); boolean bool = Character.isUpperCase(token.charAt(0)); return new Feature(FEATURE_NAME, bool ? 1.0 : 0.0, bool == false, FeatureType.BOOLEAN) .asSet(); }
InitialCharacterUpperCase extends FeatureExtractorResource_ImplBase implements FeatureExtractor { @Override public Set<Feature> extract(JCas jcas, TextClassificationTarget aTarget) throws TextClassificationException { String token = aTarget.getCoveredText(); boolean bool = Character.isUpperCase(token.charAt(0)); return new Feature(FEATURE_NAME, bool ? 1.0 : 0.0, bool == false, FeatureType.BOOLEAN) .asSet(); } }
InitialCharacterUpperCase extends FeatureExtractorResource_ImplBase implements FeatureExtractor { @Override public Set<Feature> extract(JCas jcas, TextClassificationTarget aTarget) throws TextClassificationException { String token = aTarget.getCoveredText(); boolean bool = Character.isUpperCase(token.charAt(0)); return new Feature(FEATURE_NAME, bool ? 1.0 : 0.0, bool == false, FeatureType.BOOLEAN) .asSet(); }  }
InitialCharacterUpperCase extends FeatureExtractorResource_ImplBase implements FeatureExtractor { @Override public Set<Feature> extract(JCas jcas, TextClassificationTarget aTarget) throws TextClassificationException { String token = aTarget.getCoveredText(); boolean bool = Character.isUpperCase(token.charAt(0)); return new Feature(FEATURE_NAME, bool ? 1.0 : 0.0, bool == false, FeatureType.BOOLEAN) .asSet(); }  @Override Set<Feature> extract(JCas jcas, TextClassificationTarget aTarget); }
InitialCharacterUpperCase extends FeatureExtractorResource_ImplBase implements FeatureExtractor { @Override public Set<Feature> extract(JCas jcas, TextClassificationTarget aTarget) throws TextClassificationException { String token = aTarget.getCoveredText(); boolean bool = Character.isUpperCase(token.charAt(0)); return new Feature(FEATURE_NAME, bool ? 1.0 : 0.0, bool == false, FeatureType.BOOLEAN) .asSet(); }  @Override Set<Feature> extract(JCas jcas, TextClassificationTarget aTarget); static final String FEATURE_NAME; }