/** * Generates a string representing the grammar rule production that the specified parse * is starting. The rule is of the form p.type -> c.children[0..n].type. * @param p The parse which stats teh production. * @param includePunctuation Whether punctuation should be included in the production. * @return a string representing the grammar rule production that the specified parse * is starting. */ protected String production(Parse p, boolean includePunctuation) { StringBuilder production = new StringBuilder(20); production.append(p.getType()).append("->"); Parse[] children = AbstractBottomUpParser.collapsePunctuation(p.getChildren(),punctSet); for (int ci = 0; ci < children.length; ci++) { production.append(children[ci].getType()); if (ci + 1 != children.length) { production.append(","); Collection<Parse> nextPunct = children[ci].getNextPunctuationSet(); if (includePunctuation && nextPunct != null) { //TODO: make sure multiple punctuation comes out the same for (Iterator<Parse> pit = nextPunct.iterator(); pit.hasNext();) { Parse punct = pit.next(); production.append(punct.getType()).append(","); } } } } return production.toString(); }
production.append(p.getType()).append(","); punctProduction.append(p.getType()).append(","); Collection<Parse> nextPunct = p.getNextPunctuationSet(); if (nextPunct != null) { for (Iterator<Parse> pit = nextPunct.iterator(); pit.hasNext();) { Parse p1 = null; Parse p2 = null; Collection<Parse> p1s = constituents[end].getNextPunctuationSet(); Collection<Parse> p2s = null; Collection<Parse> p_1s = constituents[start].getPreviousPunctuationSet(); p2s = p1.getNextPunctuationSet();
parent.setNextPunctuation(chunks[reduceEnd].getNextPunctuationSet());
Collection<Parse> p1s = constituents[index].getNextPunctuationSet(); Collection<Parse> p2s = null; Collection<Parse> p_1s = constituents[index].getPreviousPunctuationSet(); p2s = p1.getNextPunctuationSet();
Collection<Parse> punct1s = p0.getNextPunctuationSet(); punct2s = p1.getNextPunctuationSet();
Collection<Parse> punct1s = p0.getNextPunctuationSet();
currentChunks[ci] = (Parse) chunks[ci].clone(); currentChunks[ci].setPrevPunctuation(chunks[ci].getPreviousPunctuationSet()); currentChunks[ci].setNextPunctuation(chunks[ci].getNextPunctuationSet()); currentChunks[ci].setLabel(Parser.COMPLETE); chunks[ci].setLabel(Parser.COMPLETE); newParent.add(currentChunks[ci],rules); newParent.setPrevPunctuation(currentChunks[ci].getPreviousPunctuationSet()); newParent.setNextPunctuation(currentChunks[ci].getNextPunctuationSet()); currentChunks[ci].setParent(newParent); currentChunks[ci] = newParent;
Collection<Parse> punct1s = p0.getNextPunctuationSet(); punct2s = p1.getNextPunctuationSet();
/** * Generates a string representing the grammar rule production that the specified parse * is starting. The rule is of the form p.type -> c.children[0..n].type. * @param p The parse which stats teh production. * @param includePunctuation Whether punctuation should be included in the production. * @return a string representing the grammar rule production that the specified parse * is starting. */ protected String production(Parse p, boolean includePunctuation) { StringBuilder production = new StringBuilder(20); production.append(p.getType()).append("->"); Parse[] children = AbstractBottomUpParser.collapsePunctuation(p.getChildren(),punctSet); for (int ci = 0; ci < children.length; ci++) { production.append(children[ci].getType()); if (ci + 1 != children.length) { production.append(","); Collection<Parse> nextPunct = children[ci].getNextPunctuationSet(); if (includePunctuation && nextPunct != null) { //TODO: make sure multiple punctuation comes out the same for (Iterator<Parse> pit = nextPunct.iterator(); pit.hasNext();) { Parse punct = pit.next(); production.append(punct.getType()).append(","); } } } } return production.toString(); }
/** * Generates a string representing the grammar rule production that the specified parse * is starting. The rule is of the form p.type -> c.children[0..n].type. * @param p The parse which stats teh production. * @param includePunctuation Whether punctuation should be included in the production. * @return a string representing the grammar rule production that the specified parse * is starting. */ protected String production(Parse p, boolean includePunctuation) { StringBuilder production = new StringBuilder(20); production.append(p.getType()).append("->"); Parse[] children = AbstractBottomUpParser.collapsePunctuation(p.getChildren(),punctSet); for (int ci = 0; ci < children.length; ci++) { production.append(children[ci].getType()); if (ci + 1 != children.length) { production.append(","); Collection<Parse> nextPunct = children[ci].getNextPunctuationSet(); if (includePunctuation && nextPunct != null) { //TODO: make sure multiple punctuation comes out the same for (Iterator<Parse> pit = nextPunct.iterator(); pit.hasNext();) { Parse punct = pit.next(); production.append(punct.getType()).append(","); } } } } return production.toString(); }
production.append(p.getType()).append(","); punctProduction.append(p.getType()).append(","); Collection<Parse> nextPunct = p.getNextPunctuationSet(); if (nextPunct != null) { for (Iterator<Parse> pit = nextPunct.iterator(); pit.hasNext();) { Parse p1 = null; Parse p2 = null; Collection<Parse> p1s = constituents[end].getNextPunctuationSet(); Collection<Parse> p2s = null; Collection<Parse> p_1s = constituents[start].getPreviousPunctuationSet(); p2s = p1.getNextPunctuationSet();
production.append(p.getType()).append(","); punctProduction.append(p.getType()).append(","); Collection<Parse> nextPunct = p.getNextPunctuationSet(); if (nextPunct != null) { for (Iterator<Parse> pit = nextPunct.iterator(); pit.hasNext();) { Parse p1 = null; Parse p2 = null; Collection<Parse> p1s = constituents[end].getNextPunctuationSet(); Collection<Parse> p2s = null; Collection<Parse> p_1s = constituents[start].getPreviousPunctuationSet(); p2s = p1.getNextPunctuationSet();
parent.setNextPunctuation(chunks[reduceEnd].getNextPunctuationSet());
parent.setNextPunctuation(chunks[reduceEnd].getNextPunctuationSet());
Collection<Parse> p1s = constituents[index].getNextPunctuationSet(); Collection<Parse> p2s = null; Collection<Parse> p_1s = constituents[index].getPreviousPunctuationSet(); p2s = p1.getNextPunctuationSet();
Collection<Parse> p1s = constituents[index].getNextPunctuationSet(); Collection<Parse> p2s = null; Collection<Parse> p_1s = constituents[index].getPreviousPunctuationSet(); p2s = p1.getNextPunctuationSet();
Collection<Parse> punct1s = p0.getNextPunctuationSet(); punct2s = p1.getNextPunctuationSet();
Collection<Parse> punct1s = p0.getNextPunctuationSet(); punct2s = p1.getNextPunctuationSet();
Collection<Parse> punct1s = p0.getNextPunctuationSet();
Collection<Parse> punct1s = p0.getNextPunctuationSet();