List<Token> lbjTokens = LBJavaUtils.recordToLBJTokens(record);
List<Token> lbjTokens = new LinkedList<>(); List<List<String>> sentences = tokensAsStrings(record.getView(ViewNames.TOKENS).getConstituents(), record.getView(ViewNames.SENTENCE).getConstituents(), record.getText());
List<Token> lbjTokens = LBJavaUtils.recordToLBJTokens(record);
List<Token> lbjTokens = new LinkedList<>(); List<List<String>> sentences = tokensAsStrings(record.getView(ViewNames.TOKENS).getConstituents(), record.getView(ViewNames.SENTENCE).getConstituents(), record.getText());
/** * annotates TextAnnotation with POS view and adds it to the TextAnnotation. * * @param record TextAnnotation to annotate */ @Override public void addView(TextAnnotation record) throws AnnotatorException { if (!record.hasView(tokensfield) && !record.hasView(sentencesfield)) { throw new AnnotatorException("Record must be tokenized and sentence split first"); } long startTime = System.currentTimeMillis(); List<Token> input = LBJavaUtils.recordToLBJTokens(record); List<Constituent> tokens = record.getView(ViewNames.TOKENS).getConstituents(); TokenLabelView posView = new TokenLabelView(ViewNames.POS, getAnnotatorName(), record, 1.0); int tcounter = 0; for (Token lbjtoken : input) { tagger.discreteValue(lbjtoken); Constituent token = tokens.get(tcounter); Constituent label = new Constituent(tagger.discreteValue(lbjtoken), ViewNames.POS, record, token.getStartSpan(), token.getEndSpan()); posView.addConstituent(label); tcounter++; } long endTime = System.currentTimeMillis(); logger.debug("Tagged input in {}ms", endTime - startTime); record.addView(ViewNames.POS, posView); }
/** * annotates TextAnnotation with POS view and adds it to the TextAnnotation. * * @param record TextAnnotation to annotate */ @Override public void addView(TextAnnotation record) throws AnnotatorException { if (!record.hasView(tokensfield) && !record.hasView(sentencesfield)) { throw new AnnotatorException("Record must be tokenized and sentence split first"); } long startTime = System.currentTimeMillis(); List<Token> input = LBJavaUtils.recordToLBJTokens(record); List<Constituent> tokens = record.getView(ViewNames.TOKENS).getConstituents(); TokenLabelView posView = new TokenLabelView(ViewNames.POS, getAnnotatorName(), record, 1.0); int tcounter = 0; for (Token lbjtoken : input) { tagger.discreteValue(lbjtoken); Constituent token = tokens.get(tcounter); Constituent label = new Constituent(tagger.discreteValue(lbjtoken), ViewNames.POS, record, token.getStartSpan(), token.getEndSpan()); posView.addConstituent(label); tcounter++; } long endTime = System.currentTimeMillis(); logger.debug("Tagged input in {}ms", endTime - startTime); record.addView(ViewNames.POS, posView); }
List<Token> lbjTokens = LBJavaUtils.recordToLBJTokens(ta);
List<Token> lbjTokens = LBJavaUtils.recordToLBJTokens(ta);