@Override public String toString() { return toString(DEFAULT_FORMAT); }
public String toString(CoreLabel.OutputFormat format) { return label.toString(format); }
/** Allows choices of how to format Label. * * @param format An instance of the OutputFormat enum (the same as for a CoreLabel) * @return A String representation of the label, including marking copy nodes with primes (') */ public String toString(CoreLabel.OutputFormat format) { return label.toString(format) + toPrimes(); }
/** * Modifier must have IndexAnnotation. If head has 0 as its index, then it is * the start symbol ("boundary symbol" in the Dan Klein code). * * @param modifier * @param head * @param rel */ public CollinsDependency(CoreLabel modifier, CoreLabel head, CollinsRelation rel) { if(modifier.index() == 0) throw new RuntimeException("No index annotation for " + modifier.toString()); this.modifier = modifier; this.head = head; relation = rel; }
/** * Returns a {@code String} representation of this node and * its subtree with one node per line, indented according to * {@code indentLevel}. * * @param indentLevel how many levels to indent (0 for root node) * @return {@code String} representation of this subtree */ public String toPrettyString(int indentLevel) { StringBuilder buf = new StringBuilder("\n"); for (int i = 0; i < indentLevel; i++) { buf.append(" "); } if (children == null || children.length == 0) { buf.append(label.toString(CoreLabel.OutputFormat.VALUE_INDEX_MAP)); } else { buf.append('(').append(label.toString(CoreLabel.OutputFormat.VALUE_INDEX_MAP)); for (TreeGraphNode child : children) { buf.append(' ').append(child.toPrettyString(indentLevel + 1)); } buf.append(')'); } return buf.toString(); }
throw new RuntimeException(" Why does the token not have the class " + e.getValue() + " set? Existing classes " + tokenj.toString(CoreLabel.OutputFormat.ALL));
for (Label lab : parse.yield()) { if (lab instanceof CoreLabel) { System.out.println(((CoreLabel) lab).toString(CoreLabel.OutputFormat.VALUE_MAP)); } else { System.out.println(lab);
static public DepPattern patternToDepPattern(Pair<IndexedWord, GrammaticalRelation> p, DataInstance sent) { Token token = new Token(PatternFactory.PatternType.DEP); CoreLabel backingLabel = sent.getTokens().get(p.first().index() -1); assert backingLabel.containsKey(PatternsAnnotations.ProcessedTextAnnotation.class) : "the keyset are " + backingLabel.toString(CoreLabel.OutputFormat.ALL); token.addORRestriction(PatternsAnnotations.ProcessedTextAnnotation.class, backingLabel.get(PatternsAnnotations.ProcessedTextAnnotation.class)); return new DepPattern(token, p.second()); }
@Override public String toString() { return toString(DEFAULT_FORMAT); }
@Override public String toString() { return toString(DEFAULT_FORMAT); }
@Override public String toString() { return toString(DEFAULT_FORMAT); }
public String toString(CoreLabel.OutputFormat format) { return label.toString(format); }
@Override public String toString() { return label.toString(); }
public String toString(String format) { return label.toString(format); }
public String toString(CoreLabel.OutputFormat format) { return label.toString(format); }
/** Allows choices of how to format Label. * * @param format An instance of the OutputFormat enum (the same as for a CoreLabel) * @return A String representation of the label, including marking copy nodes with primes (') */ public String toString(CoreLabel.OutputFormat format) { return label.toString(format) + toPrimes(); }
/** Allows choices of how to format Label. * * @param format An instance of the OutputFormat enum (the same as for a CoreLabel) * @return A String representation of the label, including marking copy nodes with primes (') */ public String toString(CoreLabel.OutputFormat format) { return label.toString(format) + toPrimes(); }
/** * Returns a {@code String} representation of this node and * its subtree with one node per line, indented according to * {@code indentLevel}. * * @param indentLevel how many levels to indent (0 for root node) * @return {@code String} representation of this subtree */ public String toPrettyString(int indentLevel) { StringBuilder buf = new StringBuilder("\n"); for (int i = 0; i < indentLevel; i++) { buf.append(" "); } if (children == null || children.length == 0) { buf.append(label.toString(CoreLabel.OutputFormat.VALUE_INDEX_MAP)); } else { buf.append('(').append(label.toString(CoreLabel.OutputFormat.VALUE_INDEX_MAP)); for (TreeGraphNode child : children) { buf.append(' ').append(child.toPrettyString(indentLevel + 1)); } buf.append(')'); } return buf.toString(); }
static public DepPattern patternToDepPattern(Pair<IndexedWord, GrammaticalRelation> p, DataInstance sent) { Token token = new Token(PatternFactory.PatternType.DEP); CoreLabel backingLabel = sent.getTokens().get(p.first().index() -1); assert backingLabel.containsKey(PatternsAnnotations.ProcessedTextAnnotation.class) : "the keyset are " + backingLabel.toString(CoreLabel.OutputFormat.ALL); token.addORRestriction(PatternsAnnotations.ProcessedTextAnnotation.class, backingLabel.get(PatternsAnnotations.ProcessedTextAnnotation.class)); return new DepPattern(token, p.second()); }
public DataBag exec(Tuple input) throws IOException { if (input == null || input.size() < 1 || input.isNull(0)) return null; // Output bag DataBag bagOfTokens = bagFactory.newDefaultBag(); StringReader textInput = new StringReader(input.get(0).toString()); PTBTokenizer ptbt = new PTBTokenizer(textInput, new CoreLabelTokenFactory(), ""); for (CoreLabel label; ptbt.hasNext(); ) { label = (CoreLabel)ptbt.next(); Tuple termText = tupleFactory.newTuple(label.toString()); bagOfTokens.add(termText); } return bagOfTokens; } }