public Set<Feature> extract(JCas aView, TextClassificationTarget aTarget) throws TextClassificationException { Feature feature = new Feature(FEATURE_NAME, aTarget.getCoveredText().contains( "-") ? 1 : 0); Set<Feature> features = new HashSet<Feature>(); features.add(feature); return features; } }
public Set<Feature> extract(JCas aView, TextClassificationTarget aTarget) throws TextClassificationException { Feature feature = new Feature(FEATURE_NAME, aTarget.getCoveredText().contains( ".") ? 1 : 0); Set<Feature> features = new HashSet<Feature>(); features.add(feature); return features; }
public Set<Feature> extract(JCas aView, TextClassificationTarget aTarget) throws TextClassificationException { Feature feature = new Feature(FEATURE_NAME, aTarget.getCoveredText().contains( "_") ? 1 : 0); Set<Feature> features = new HashSet<Feature>(); features.add(feature); return features; }
@Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { return new Feature("BaselineFeature", 0, FeatureType.NUMERIC).asSet(); }
public static Feature retrieve(JCas jcas) throws TextClassificationException { String fullId = getFullId(jcas); return new Feature(ID_FEATURE_NAME, fullId, FeatureType.STRING); };
public Set<Feature> extract(JCas aView, TextClassificationTarget aTarget) throws TextClassificationException { String text = aTarget.getCoveredText(); boolean isRetweet = isRetweet(text); Feature feature = new Feature(FEATURE_NAME, isRetweet ? 1 : 0); Set<Feature> features = new HashSet<Feature>(); features.add(feature); return features; }
public Set<Feature> extract(JCas aView, TextClassificationTarget aTarget) throws TextClassificationException { String text = aTarget.getCoveredText(); boolean isUserMention = isUserMention(text); Feature feature = new Feature(FEATURE_NAME, isUserMention ? 1 : 0); Set<Feature> features = new HashSet<Feature>(); features.add(feature); return features; }
public Set<Feature> extract(JCas aView, TextClassificationTarget aTarget) throws TextClassificationException { String text = aTarget.getCoveredText(); boolean containsComma = containsComma(text); Feature feature = new Feature(FEATURE_NAME, containsComma ? 1 : 0); Set<Feature> features = new HashSet<Feature>(); features.add(feature); return features; }
public Set<Feature> extract(JCas aView, TextClassificationTarget aTarget) throws TextClassificationException { String token = aTarget.getCoveredText(); Feature feature = new Feature(FEATURE_NAME, isAllCapitalized(token) ? 1 : 0); Set<Feature> features = new HashSet<Feature>(); features.add(feature); return features; }
public Set<Feature> extract(JCas aView, TextClassificationTarget aTarget) throws TextClassificationException { String token = aTarget.getCoveredText(); boolean flc = firstLetterCapitalized(token); Feature feature = new Feature(FEATURE_NAME, flc ? 1 : 0); Set<Feature> features = new HashSet<Feature>(); features.add(feature); return features; }
@Override public Set<Feature> extract(JCas jCas, TextClassificationTarget aTarget) throws TextClassificationException { int nrOfEmoticons = JCasUtil.selectCovered(jCas, POS_EMO.class, aTarget).size(); int nrOfTokens = JCasUtil.selectCovered(jCas, Token.class, aTarget).size(); double ratio = (double) nrOfEmoticons / nrOfTokens; return new Feature(EmoticonRatio.class.getSimpleName(), ratio, FeatureType.NUMERIC).asSet(); } }
@Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { if (normalizeWithFirst) { return new Feature("SharedNounChunkView1", getSharedNounChunksCount(view1, view2), FeatureType.NUMERIC).asSet(); } else { return new Feature("SharedNounChunkView2", getSharedNounChunksCount(view2, view1), FeatureType.NUMERIC).asSet(); } }
public static Feature retrieve(JCas jcas, TextClassificationTarget unit) throws TextClassificationException { String fullId = getFullId(jcas); fullId = fullId + "_" + unit.getId(); String suffix = unit.getSuffix(); if (suffix != null && suffix.length() > 0) { fullId = fullId + "_" + suffix; } return new Feature(ID_FEATURE_NAME, fullId, FeatureType.STRING); };
public static Feature retrieve(JCas jcas, TextClassificationTarget unit, Integer sequenceId) throws TextClassificationException { String fullId = getFullId(jcas); fullId = fullId + "_" + sequenceId; fullId = fullId + "_" + unit.getId(); String suffix = unit.getSuffix(); if (suffix != null && suffix.length() > 0) { fullId = fullId + "_" + suffix; } return new Feature(ID_FEATURE_NAME, fullId, FeatureType.STRING); };
public static Feature retrieve(JCas jcas, TextClassificationTarget unit, Integer sequenceId) throws TextClassificationException { String fullId = getFullId(jcas); fullId = fullId + "_" + sequenceId; fullId = fullId + "_" + unit.getId(); String suffix = unit.getSuffix(); if (suffix != null && suffix.length() > 0) { fullId = fullId + "_" + suffix; } return new Feature(ID_FEATURE_NAME, fullId, FeatureType.STRING); };
@Override public Set<Feature> extract(JCas jcas, TextClassificationTarget aTarget) throws TextClassificationException { long maxLen = getMax(); List<Sentence> sentences = JCasUtil.selectCovered(jcas, Sentence.class, aTarget); double ratio = getRatio(sentences.size(), maxLen); return new Feature(FEATURE_NAME, ratio, FeatureType.NUMERIC).asSet(); }
@Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { return new Feature("DiffNounPhraseTokenLength", getAverageNounPhraseTokenLength(view1) - getAverageNounPhraseTokenLength(view2), FeatureType.NUMERIC).asSet(); }
@Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { return new Feature("DiffNounPhraseCharacterLength", getAverageNounPhraseCharacterLength(view1) - getAverageNounPhraseCharacterLength(view2), FeatureType.NUMERIC).asSet(); }
public Set<Feature> extract(JCas aView, TextClassificationTarget unit) throws TextClassificationException { super.extract(aView, unit); Integer currentTargetIdx = super.unitBegin2Idx.get(unit.getBegin()); Integer targetIdx = currentTargetIdx + shiftIdx; String featureVal = getTargetText(targetIdx); return new Feature(FEATURE_NAME + toHumanReadable(shiftIdx), featureVal, FeatureType.NUMERIC).asSet(); }
public Set<Feature> extract(JCas aView, TextClassificationTarget target) throws TextClassificationException { super.extract(aView, target); Integer currentTargetIdx = super.targetBegin2Idx.get(target.getBegin()); Integer targetIdx = currentTargetIdx + shiftIdx; String featureVal = getTargetText(targetIdx); return new Feature(FEATURE_NAME + toHumanReadable(shiftIdx), featureVal, FeatureType.STRING).asSet(); }