/** * Constructs a CoreLabel as a String with a corresponding BEGIN and END position. * (Does not take substring). */ @Override public CoreLabel makeToken(String tokenText, int begin, int length) { return makeToken(tokenText, tokenText, begin, length); }
private static CoreMap wordsToSentence(List<String> sentWords) { String sentText = StringUtils.join(sentWords, " "); Annotation sentence = new Annotation(sentText); List<CoreLabel> tokens = new ArrayList<>(sentWords.size()); for (String text:sentWords) { CoreLabel token = tokenFactory.makeToken(); token.set(CoreAnnotations.TextAnnotation.class, text); tokens.add(token); } sentence.set(CoreAnnotations.TokensAnnotation.class, tokens); return sentence; }
CoreMap newChunk; if (tokenFactory != null) { newChunk = tokenFactory.makeToken(); } else { newChunk = new Annotation("");
output.add(tokenFactory.makeToken(text.substring(token.beginPosition(), offsetBegin), token.beginPosition(), offsetBegin-token.beginPosition())); output.add(tokenFactory.makeToken(text.substring(offsetBegin,offsetEnd), offsetBegin, offsetEnd-offsetBegin)); output.add(tokenFactory.makeToken(text.substring(offsetEnd,token.endPosition()), offsetEnd, token.endPosition()-offsetEnd)); } else { output.add(tokenFactory.makeToken(text.substring(token.beginPosition(), offsetBegin), token.beginPosition(), offsetBegin-token.beginPosition())); output.add(tokenFactory.makeToken(text.substring(offsetBegin,token.endPosition()), offsetBegin, token.endPosition()-offsetBegin)); output.add(tokenFactory.makeToken(text.substring(token.beginPosition(),offsetEnd), token.beginPosition(), offsetEnd-token.beginPosition())); output.add(tokenFactory.makeToken(text.substring(offsetEnd,token.endPosition()), offsetEnd, token.endPosition()-offsetEnd)); } else {
CoreMap newChunk; if (tokenFactory != null) { newChunk = tokenFactory.makeToken(chunkText, firstCharOffset, lastCharOffset); } else { newChunk = new Annotation(chunkText);
CoreLabel token = tf.makeToken(word, 0, 0); token.setTag(pos); token.set(CoreAnnotations.CoNLLDepParentIndexAnnotation.class, head);
/** * Constructs a CoreLabel as a String with a corresponding BEGIN and END position. * (Does not take substring). */ public CoreLabel makeToken(String tokenText, int begin, int length) { return makeToken(tokenText, tokenText, begin, length); }
/** * Constructs a CoreLabel as a String with a corresponding BEGIN and END position. * (Does not take substring). */ @Override public CoreLabel makeToken(String tokenText, int begin, int length) { return makeToken(tokenText, tokenText, begin, length); }
/** * Constructs a CoreLabel as a String with a corresponding BEGIN and END position. * (Does not take substring). */ @Override public CoreLabel makeToken(String tokenText, int begin, int length) { return makeToken(tokenText, tokenText, begin, length); }
private static CoreMap wordsToSentence(List<String> sentWords) { String sentText = StringUtils.join(sentWords, " "); Annotation sentence = new Annotation(sentText); List<CoreLabel> tokens = new ArrayList<>(sentWords.size()); for (String text:sentWords) { CoreLabel token = tokenFactory.makeToken(); token.set(CoreAnnotations.TextAnnotation.class, text); tokens.add(token); } sentence.set(CoreAnnotations.TokensAnnotation.class, tokens); return sentence; }
private static CoreMap wordsToSentence(List<String> sentWords) { String sentText = StringUtils.join(sentWords, " "); Annotation sentence = new Annotation(sentText); List<CoreLabel> tokens = new ArrayList<CoreLabel>(sentWords.size()); for (String text:sentWords) { CoreLabel token = tokenFactory.makeToken(); token.set(CoreAnnotations.TextAnnotation.class, text); tokens.add(token); } sentence.set(CoreAnnotations.TokensAnnotation.class, tokens); return sentence; }
CoreMap newChunk; if (tokenFactory != null) { newChunk = tokenFactory.makeToken(); } else { newChunk = new Annotation("");
CoreMap newChunk; if (tokenFactory != null) { newChunk = tokenFactory.makeToken(); } else { newChunk = new Annotation("");
CoreMap newChunk; if (tokenFactory != null) { newChunk = tokenFactory.makeToken(chunkText, firstCharOffset, lastCharOffset); } else { newChunk = new Annotation(chunkText);
CoreLabel token = tf.makeToken(word, 0, 0); token.setTag(pos); token.set(CoreAnnotations.CoNLLDepParentIndexAnnotation.class, head);
CoreLabel token = tf.makeToken(word, 0, 0); token.setTag(pos); token.set(CoreAnnotations.CoNLLDepParentIndexAnnotation.class, head);
CoreMap newChunk; if (tokenFactory != null) { newChunk = tokenFactory.makeToken(chunkText, firstCharOffset, lastCharOffset); } else { newChunk = new Annotation(chunkText);
CoreLabel stanfordTok = tf.makeToken(form, tokStart, tokLength); stanfordTok.setIndex(tokIndex++); stanfordTokens.add(stanfordTok);
CoreLabel stanfordTok = tf.makeToken(form, tokStart, tokLength); stanfordTok.setIndex(tokIndex++); stanfordTokens.add(stanfordTok);
CoreLabel token = tokenFactory.makeToken(t.getText(), t.getBegin(), t.getEnd() - t.getBegin());