protected final void createAutomaticDictionary ( final ObjectStream < POSSample > aDictSamples , final int aDictCutOff ) { if ( aDictCutOff != Flags . DEFAULT_DICT_CUTOFF ) { try { TagDictionary dict = getPosTaggerFactory ( ) . getTagDictionary ( ) ; if ( dict == null ) { dict = getPosTaggerFactory ( ) . createEmptyTagDictionary ( ) ; getPosTaggerFactory ( ) . setTagDictionary ( dict ) ; } if ( dict instanceof MutableTagDictionary ) { POSTaggerME . populatePOSDictionary ( aDictSamples , ( MutableTagDictionary ) dict , aDictCutOff ) ; } else { throw new IllegalArgumentException ( "Can't extend a POSDictionary" + " that does not implement MutableTagDictionary." ) ; } this . dictSamples . reset ( ) ; } catch ( final IOException e ) { throw new TerminateToolException ( - 1 , "IO error while creating/extending POS Dictionary: " + e . getMessage ( ) , e ) ; } } }
Automatically create a tag dictionary from training data .