public NGram createNGram ( List words ) { int [ ] nums = new int [ words . size ( ) ] ; //ngram needs it own copy of this array so keep making a unique one for each instance. for ( int wi = 0 ; wi < nums . length ; wi ++ ) { nums [ wi ] = wordMap . getIndex ( words . get ( wi ) ) ; if ( nums [ wi ] == - 1 ) { return null ; } } return new NGram ( nums ) ; }
Creates a new n - gram for the specified list of words .