/** * Computes the head parses for this parse and its sub-parses and stores this information * in the parse data structure. * * @param rules The head rules which determine how the head of the parse is computed. */ public void updateHeads(HeadRules rules) { if (parts != null && parts.size() != 0) { for (int pi = 0, pn = parts.size(); pi < pn; pi++) { Parse c = parts.get(pi); c.updateHeads(rules); } this.head = rules.getHead(parts.toArray(new Parse[parts.size()]), type); if (head == null) { head = this; } else { this.headIndex = head.headIndex; } } else { this.head = this; } }
public AbstractBottomUpParser(POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage) { this.tagger = tagger; this.chunker = chunker; this.M = beamSize; this.K = beamSize; this.Q = advancePercentage; reportFailedParse = true; this.headRules = headRules; this.punctSet = headRules.getPunctuationTags(); odh = new TreeSet<>(); ndh = new TreeSet<>(); completeParses = new TreeSet<>(); }
public void add(Parse daughter, HeadRules rules) { if (daughter.prevPunctSet != null) { parts.addAll(daughter.prevPunctSet); } parts.add(daughter); this.span = new Span(span.getStart(),daughter.getSpan().getEnd()); this.head = rules.getHead(getChildren(),type); this.headIndex = head.headIndex; }
public AbstractParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype, Dictionary dict) { super(d); this.dict = dict; if (etype == ParserEventTypeEnum.CHUNK) { this.chunkerContextGenerator = new ChunkContextGenerator(); } else if (etype == ParserEventTypeEnum.TAG) { this.tagContextGenerator = new DefaultPOSContextGenerator(null); } this.rules = rules; punctSet = rules.getPunctuationTags(); this.etype = etype; init(); }
public Parse adjoinRoot(Parse node, HeadRules rules, int parseIndex) { Parse lastChild = parts.get(parseIndex); Parse adjNode = new Parse(this.text,new Span(lastChild.getSpan().getStart(), node.getSpan().getEnd()),lastChild.getType(),1, rules.getHead(new Parse[]{lastChild,node},lastChild.getType())); adjNode.parts.add(lastChild); if (node.prevPunctSet != null) { adjNode.parts.addAll(node.prevPunctSet); } adjNode.parts.add(node); parts.set(parseIndex,adjNode); return adjNode; }
public AbstractBottomUpParser(POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage) { this.tagger = tagger; this.chunker = chunker; this.M = beamSize; this.K = beamSize; this.Q = advancePercentage; reportFailedParse = true; this.headRules = headRules; this.punctSet = headRules.getPunctuationTags(); odh = new TreeSet<>(); ndh = new TreeSet<>(); completeParses = new TreeSet<>(); }
/** * Sister adjoins this node's last child and the specified sister node and returns their * new parent node. The new parent node replace this nodes last child. * * @param sister The node to be adjoined. * @param rules The head rules for the parser. * @return The new parent node of this node and the specified sister node. */ public Parse adjoin(Parse sister, HeadRules rules) { Parse lastChild = parts.get(parts.size() - 1); Parse adjNode = new Parse(this.text,new Span(lastChild.getSpan().getStart(),sister.getSpan().getEnd()), lastChild.getType(),1,rules.getHead(new Parse[]{lastChild,sister},lastChild.getType())); adjNode.parts.add(lastChild); if (sister.prevPunctSet != null) { adjNode.parts.addAll(sister.prevPunctSet); } adjNode.parts.add(sister); parts.set(parts.size() - 1, adjNode); this.span = new Span(span.getStart(),sister.getSpan().getEnd()); this.head = rules.getHead(getChildren(),type); this.headIndex = head.headIndex; return adjNode; }
public AbstractBottomUpParser(POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage) { this.tagger = tagger; this.chunker = chunker; this.M = beamSize; this.K = beamSize; this.Q = advancePercentage; reportFailedParse = true; this.headRules = headRules; this.punctSet = headRules.getPunctuationTags(); odh = new TreeSet<>(); ndh = new TreeSet<>(); completeParses = new TreeSet<>(); }
rules.getPunctuationTags()); String[] cwords = new String[chunks.length]; for (int wi = 0; wi < cwords.length; wi++) { chunks[ci].show(); if (lastChild(chunks[ci], chunks[ci].getParent(),rules.getPunctuationTags())) {
p2.getSpan().getEnd()), type, 1, headRules.getHead(cons, type)); chunk.isChunk(true); newParses[si].insert(chunk);
public AbstractParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype, Dictionary dict) { super(d); this.dict = dict; if (etype == ParserEventTypeEnum.CHUNK) { this.chunkerContextGenerator = new ChunkContextGenerator(); } else if (etype == ParserEventTypeEnum.TAG) { this.tagContextGenerator = new DefaultPOSContextGenerator(null); } this.rules = rules; punctSet = rules.getPunctuationTags(); this.etype = etype; init(); }
/** * Computes the head parses for this parse and its sub-parses and stores this information * in the parse data structure. * * @param rules The head rules which determine how the head of the parse is computed. */ public void updateHeads(HeadRules rules) { if (parts != null && parts.size() != 0) { for (int pi = 0, pn = parts.size(); pi < pn; pi++) { Parse c = parts.get(pi); c.updateHeads(rules); } this.head = rules.getHead(parts.toArray(new Parse[parts.size()]), type); if (head == null) { head = this; } else { this.headIndex = head.headIndex; } } else { this.head = this; } }
public AbstractParserEventStream(ObjectStream<Parse> d, HeadRules rules, ParserEventTypeEnum etype, Dictionary dict) { super(d); this.dict = dict; if (etype == ParserEventTypeEnum.CHUNK) { this.chunkerContextGenerator = new ChunkContextGenerator(); } else if (etype == ParserEventTypeEnum.TAG) { this.tagContextGenerator = new DefaultPOSContextGenerator(null); } this.rules = rules; punctSet = rules.getPunctuationTags(); this.etype = etype; init(); }
/** * Computes the head parses for this parse and its sub-parses and stores this information * in the parse data structure. * * @param rules The head rules which determine how the head of the parse is computed. */ public void updateHeads(HeadRules rules) { if (parts != null && parts.size() != 0) { for (int pi = 0, pn = parts.size(); pi < pn; pi++) { Parse c = parts.get(pi); c.updateHeads(rules); } this.head = rules.getHead(parts.toArray(new Parse[parts.size()]), type); if (head == null) { head = this; } else { this.headIndex = head.headIndex; } } else { this.head = this; } }
rules.getPunctuationTags()); String[] cwords = new String[chunks.length]; for (int wi = 0; wi < cwords.length; wi++) { chunks[ci].show(); if (lastChild(chunks[ci], chunks[ci].getParent(),rules.getPunctuationTags())) {
public void add(Parse daughter, HeadRules rules) { if (daughter.prevPunctSet != null) { parts.addAll(daughter.prevPunctSet); } parts.add(daughter); this.span = new Span(span.getStart(),daughter.getSpan().getEnd()); this.head = rules.getHead(getChildren(),type); this.headIndex = head.headIndex; }
rules.getPunctuationTags()); String[] cwords = new String[chunks.length]; for (int wi = 0; wi < cwords.length; wi++) { chunks[ci].show(); if (lastChild(chunks[ci], chunks[ci].getParent(),rules.getPunctuationTags())) {
public void add(Parse daughter, HeadRules rules) { if (daughter.prevPunctSet != null) { parts.addAll(daughter.prevPunctSet); } parts.add(daughter); this.span = new Span(span.getStart(),daughter.getSpan().getEnd()); this.head = rules.getHead(getChildren(),type); this.headIndex = head.headIndex; }
public Parse adjoinRoot(Parse node, HeadRules rules, int parseIndex) { Parse lastChild = parts.get(parseIndex); Parse adjNode = new Parse(this.text,new Span(lastChild.getSpan().getStart(), node.getSpan().getEnd()),lastChild.getType(),1, rules.getHead(new Parse[]{lastChild,node},lastChild.getType())); adjNode.parts.add(lastChild); if (node.prevPunctSet != null) { adjNode.parts.addAll(node.prevPunctSet); } adjNode.parts.add(node); parts.set(parseIndex,adjNode); return adjNode; }