use of com.joliciel.talismane.posTagger.PosTag in project talismane by joliciel-informatique.
the class LexiconPosTagsFeature method checkInternal.
@Override
public FeatureResult<List<WeightedOutcome<String>>> checkInternal(TokenWrapper tokenWrapper, RuntimeEnvironment env) throws TalismaneException {
TokenWrapper innerWrapper = this.getToken(tokenWrapper, env);
if (innerWrapper == null)
return null;
Token token = innerWrapper.getToken();
FeatureResult<List<WeightedOutcome<String>>> result = null;
List<WeightedOutcome<String>> resultList = new ArrayList<WeightedOutcome<String>>();
for (PosTag posTag : token.getPossiblePosTags()) {
resultList.add(new WeightedOutcome<String>(posTag.getCode(), 1.0));
}
if (resultList.size() > 0)
result = this.generateResult(resultList);
return result;
}
use of com.joliciel.talismane.posTagger.PosTag in project talismane by joliciel-informatique.
the class LexiconPosTagsForStringFeature method checkInternal.
@Override
public FeatureResult<List<WeightedOutcome<String>>> checkInternal(TokenWrapper tokenWrapper, RuntimeEnvironment env) throws TalismaneException {
TokenWrapper innerWrapper = this.getToken(tokenWrapper, env);
if (innerWrapper == null)
return null;
FeatureResult<List<WeightedOutcome<String>>> result = null;
FeatureResult<String> wordToCheckResult = wordToCheckFeature.check(innerWrapper, env);
if (wordToCheckResult != null) {
String wordToCheck = wordToCheckResult.getOutcome();
List<WeightedOutcome<String>> resultList = new ArrayList<WeightedOutcome<String>>();
PosTaggerLexicon lexicon = TalismaneSession.get(sessionId).getMergedLexicon();
Set<PosTag> posTags = lexicon.findPossiblePosTags(wordToCheck);
for (PosTag posTag : posTags) {
resultList.add(new WeightedOutcome<String>(posTag.getCode(), 1.0));
}
if (resultList.size() > 0)
result = this.generateResult(resultList);
}
return result;
}
Aggregations