public String[] lemmatize(String[] toks, String[] tags) { String[] ses = predictSES(toks, tags); String[] lemmas = decodeLemmas(toks, ses); return lemmas; }
/** * Predict all possible lemmas (using a default upper bound). * @param numLemmas the default number of lemmas * @param toks the tokens * @param tags the postags * @return a double array containing all posible lemmas for each token and postag pair */ public String[][] predictLemmas(int numLemmas, String[] toks, String[] tags) { Sequence[] bestSequences = model.bestSequences(numLemmas, toks, new Object[] {tags}, contextGenerator, sequenceValidator); String[][] allLemmas = new String[bestSequences.length][]; for (int i = 0; i < allLemmas.length; i++) { List<String> ses = bestSequences[i].getOutcomes(); String[] sesArray = ses.toArray(new String[ses.size()]); allLemmas[i] = decodeLemmas(toks,sesArray); } return allLemmas; }
public String[] lemmatize(String[] toks, String[] tags) { String[] ses = predictSES(toks, tags); String[] lemmas = decodeLemmas(toks, ses); return lemmas; }
public String[] lemmatize(String[] toks, String[] tags) { String[] ses = predictSES(toks, tags); String[] lemmas = decodeLemmas(toks, ses); return lemmas; }
/** * {@inheritDoc} * <p> * How the lemmatization is performed depends on which constructor * was used to create the class. The lemmatization could be * dictionary-based or model-based. */ @Override public String[] lemmatize(String[] tokens, String[] posTags) { String[] lemmas = lemmatizer.lemmatize(tokens, posTags); if(isModelBased) { // Must call decodeLemmas for model-based lemmatization. lemmas = ((LemmatizerME) lemmatizer).decodeLemmas(tokens, lemmas); } return lemmas; }
/** * Predict all possible lemmas (using a default upper bound). * @param numLemmas the default number of lemmas * @param toks the tokens * @param tags the postags * @return a double array containing all posible lemmas for each token and postag pair */ public String[][] predictLemmas(int numLemmas, String[] toks, String[] tags) { Sequence[] bestSequences = model.bestSequences(numLemmas, toks, new Object[] {tags}, contextGenerator, sequenceValidator); String[][] allLemmas = new String[bestSequences.length][]; for (int i = 0; i < allLemmas.length; i++) { List<String> ses = bestSequences[i].getOutcomes(); String[] sesArray = ses.toArray(new String[ses.size()]); allLemmas[i] = decodeLemmas(toks,sesArray); } return allLemmas; }
/** * Predict all possible lemmas (using a default upper bound). * @param numLemmas the default number of lemmas * @param toks the tokens * @param tags the postags * @return a double array containing all posible lemmas for each token and postag pair */ public String[][] predictLemmas(int numLemmas, String[] toks, String[] tags) { Sequence[] bestSequences = model.bestSequences(numLemmas, toks, new Object[] {tags}, contextGenerator, sequenceValidator); String[][] allLemmas = new String[bestSequences.length][]; for (int i = 0; i < allLemmas.length; i++) { List<String> ses = bestSequences[i].getOutcomes(); String[] sesArray = ses.toArray(new String[ses.size()]); allLemmas[i] = decodeLemmas(toks,sesArray); } return allLemmas; }