private void readDep(IndexedWord gov, String reln) { readWhiteSpace(); if (!isLeftBracket(peek())) { // it's a leaf String label = readName(); IndexedWord dep = makeVertex(label); sg.addVertex(dep); if (gov == null) sg.roots.add(dep); sg.addEdge(gov, dep, GrammaticalRelation.valueOf(this.language, reln), Double.NEGATIVE_INFINITY, false); } else { readLeftBracket(); String label = readName(); IndexedWord dep = makeVertex(label); sg.addVertex(dep); if (gov == null) sg.roots.add(dep); if (gov != null && reln != null) { sg.addEdge(gov, dep, GrammaticalRelation.valueOf(this.language, reln), Double.NEGATIVE_INFINITY, false); } readWhiteSpace(); while (!isRightBracket(peek()) && !isEOF) { reln = readName(); readRelnSeparator(); readDep(dep, reln); readWhiteSpace(); } readRightBracket(); } }
private void readDep(IndexedWord gov, String reln) { readWhiteSpace(); if (!isLeftBracket(peek())) { // it's a leaf String label = readName(); IndexedWord dep = makeVertex(label); sg.addVertex(dep); if (gov == null) sg.roots.add(dep); sg.addEdge(gov, dep, GrammaticalRelation.valueOf(reln), Double.NEGATIVE_INFINITY, false); } else { readLeftBracket(); String label = readName(); IndexedWord dep = makeVertex(label); sg.addVertex(dep); if (gov == null) sg.roots.add(dep); if (gov != null && reln != null) { sg.addEdge(gov, dep, GrammaticalRelation.valueOf(reln), Double.NEGATIVE_INFINITY, false); } readWhiteSpace(); while (!isRightBracket(peek()) && !isEOF) { reln = readName(); readColon(); readDep(dep, reln); readWhiteSpace(); } readRightBracket(); } }
private void readDep(IndexedWord gov, String reln) { readWhiteSpace(); if (!isLeftBracket(peek())) { // it's a leaf String label = readName(); IndexedWord dep = makeVertex(label); sg.addVertex(dep); if (gov == null) sg.roots.add(dep); sg.addEdge(gov, dep, GrammaticalRelation.valueOf(this.language, reln), Double.NEGATIVE_INFINITY, false); } else { readLeftBracket(); String label = readName(); IndexedWord dep = makeVertex(label); sg.addVertex(dep); if (gov == null) sg.roots.add(dep); if (gov != null && reln != null) { sg.addEdge(gov, dep, GrammaticalRelation.valueOf(this.language, reln), Double.NEGATIVE_INFINITY, false); } readWhiteSpace(); while (!isRightBracket(peek()) && !isEOF) { reln = readName(); readRelnSeparator(); readDep(dep, reln); readWhiteSpace(); } readRightBracket(); } }
private void readDep(IndexedWord gov, String reln) { readWhiteSpace(); if (!isLeftBracket(peek())) { // it's a leaf String label = readName(); IndexedWord dep = makeVertex(label); sg.addVertex(dep); if (gov == null) sg.roots.add(dep); sg.addEdge(gov, dep, GrammaticalRelation.valueOf(this.language, reln), Double.NEGATIVE_INFINITY, false); } else { readLeftBracket(); String label = readName(); IndexedWord dep = makeVertex(label); sg.addVertex(dep); if (gov == null) sg.roots.add(dep); if (gov != null && reln != null) { sg.addEdge(gov, dep, GrammaticalRelation.valueOf(this.language, reln), Double.NEGATIVE_INFINITY, false); } readWhiteSpace(); while (!isRightBracket(peek()) && !isEOF) { reln = readName(); readRelnSeparator(); readDep(dep, reln); readWhiteSpace(); } readRightBracket(); } }
@Override protected boolean isPunct(char ch) { return isLeftBracket(ch) || isRightBracket(ch) || isColon(ch); }
private void readRightBracket() { // System.out.println("Read right."); readWhiteSpace(); char ch = read(); if (!isRightBracket(ch)) throw new ParserException("Expected right paren!"); }
@Override protected boolean isPunct(char ch) { return isLeftBracket(ch) || isRightBracket(ch) || isRelnSeparator(ch); }
@Override protected boolean isPunct(char ch) { return isLeftBracket(ch) || isRightBracket(ch) || isRelnSeparator(ch); }
private void readRightBracket() { // System.out.println("Read right."); readWhiteSpace(); char ch = read(); if (!isRightBracket(ch)) throw new ParserException("Expected right paren!"); }
private void readRightBracket() { // System.out.println("Read right."); readWhiteSpace(); char ch = read(); if (!isRightBracket(ch)) throw new ParserException("Expected right paren!"); }
@Override protected boolean isPunct(char ch) { return isLeftBracket(ch) || isRightBracket(ch) || isRelnSeparator(ch); }
private void readRightBracket() { // System.out.println("Read right."); readWhiteSpace(); char ch = read(); if (!isRightBracket(ch)) throw new ParserException("Expected right paren!"); }