use of com.joliciel.talismane.posTagger.UnknownPosTagException in project talismane by joliciel-informatique.
the class DefaultPosTagMapper method getPosTags.
@Override
public Set<PosTag> getPosTags(LexicalEntry lexicalEntry) {
if (lexicalEntry.getCategory() == null)
return Collections.emptySet();
Set<PosTag> posTags = posTagsPerCategory.get(lexicalEntry.getCategory());
if (posTags == null) {
PosTag posTag = null;
try {
posTag = posTagSet.getPosTag(lexicalEntry.getCategory());
} catch (UnknownPosTagException e) {
// unknown posTag, do nothing
}
if (posTag == null)
posTags = Collections.emptySet();
else {
posTags = new HashSet<>();
posTags.add(posTag);
}
posTagsPerCategory.put(lexicalEntry.getCategory(), posTags);
}
return posTags;
}
Aggregations