/** * Decodes the lemma from the word and the induced lemma class. * @param toks the array of tokens * @param preds the predicted lemma classes * @return the array of decoded lemmas */ public static String[] decodeLemmas(String[] toks, String[] preds) { List<String> lemmas = new ArrayList<>(); for (int i = 0; i < toks.length; i++) { String lemma = StringUtil.decodeShortestEditScript(toks[i].toLowerCase(), preds[i]); if (lemma.length() == 0) { lemma = "_"; } lemmas.add(lemma); } return lemmas.toArray(new String[lemmas.size()]); }
/** * Decodes the lemma from the word and the induced lemma class. * @param toks the array of tokens * @param preds the predicted lemma classes * @return the array of decoded lemmas */ public static String[] decodeLemmas(String[] toks, String[] preds) { List<String> lemmas = new ArrayList<>(); for (int i = 0; i < toks.length; i++) { String lemma = StringUtil.decodeShortestEditScript(toks[i].toLowerCase(), preds[i]); if (lemma.length() == 0) { lemma = "_"; } lemmas.add(lemma); } return lemmas.toArray(new String[lemmas.size()]); }
/** * Decodes the lemma from the word and the induced lemma class. * @param toks the array of tokens * @param preds the predicted lemma classes * @return the array of decoded lemmas */ public static String[] decodeLemmas(String[] toks, String[] preds) { List<String> lemmas = new ArrayList<>(); for (int i = 0; i < toks.length; i++) { String lemma = StringUtil.decodeShortestEditScript(toks[i].toLowerCase(), preds[i]); if (lemma.length() == 0) { lemma = "_"; } lemmas.add(lemma); } return lemmas.toArray(new String[lemmas.size()]); }