Search in sources :

Example 1 with UnknownPosTagException

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;
}
Also used : PosTag(com.joliciel.talismane.posTagger.PosTag) UnknownPosTagException(com.joliciel.talismane.posTagger.UnknownPosTagException)

Aggregations

PosTag (com.joliciel.talismane.posTagger.PosTag)1 UnknownPosTagException (com.joliciel.talismane.posTagger.UnknownPosTagException)1