diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..cf80c5a --- /dev/null +++ b/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + opennlp + ccg + 0.10.0 + pom + + + src/ + + + + 1.8 + 1.8 + + + diff --git a/src/ccg2xml/ccg.ply b/src/ccg2xml/ccg.ply index 106c0ba..a9d386a 100755 --- a/src/ccg2xml/ccg.ply +++ b/src/ccg2xml/ccg.ply @@ -26,11 +26,7 @@ import cStringIO # Local imports import lex, yacc -from Tkinter import * -from tkMessageBox import * -import tkFont - -## Get options +# Get options usage = """%prog [OPTIONS] FILE ... diff --git a/src/opennlp/ccgbank/parse/SimpleNode.java b/src/opennlp/ccgbank/parse/SimpleNode.java index 0287942..232d94b 100755 --- a/src/opennlp/ccgbank/parse/SimpleNode.java +++ b/src/opennlp/ccgbank/parse/SimpleNode.java @@ -8,162 +8,179 @@ import opennlp.ccgbank.parse.CCGbankDerivationTreeConstants; public class SimpleNode implements Node { - //Javacc generated variables - protected Node parent; - protected Node[] children; - protected int id; - protected CCGbankDerivation parser; - - //User defined variables - - // lex, sense, role triples - public static class LexSenseRole { - public String lex, sense, role; - public LexSenseRole(String lex, String sense, String role) { - this.lex = lex; this.sense = sense; this.role = role; - } - } - - //CCGbank id - public String header; - - //The serial no of the gold standard parse - String parseNo=""; - - //Node type eg:-Treenode,Leafnode,atomcat etc - public String type=""; - - //Traps any feature which is leftover - public String leftover; - - //Headedness info 0 or 1 - public String head=""; - - //No:of daughters of a node - public String dtr=""; - - //Category Specification - public String cat=""; - - //Category Specification without co-indexation info in leafnodes - public String catRedundant=""; - - //Lexical information - public String lex=""; - - //Part of speech info. eg: RB, IN etc - public String pos=""; - - // The roles (or rel) that the node plays - public List nodeRoles = null; - - // The arg roles of a verbal cat - public List argRoles = null; - - //First token in the node scope - Token first_token; - - //Final token in the node scope - Token last_token; - - //Function which produces the content of the node. - public String print()throws Exception{ - - Token p=first_token; - - while(p!=last_token){ - cat=cat+p.image; - p=p.next; - } - - return cat+last_token.image; - } - - - //The remaining part incl comments is Javacc generated. - - public SimpleNode(int i) { - id = i; - } - - public SimpleNode(CCGbankDerivation p, int i) { - this(i); - parser = p; - } - - /** - * @return the header - */ - public String getHeader() { - return header; - } - - /** - * @param header the header to set - */ - public void setHeader(String header) { - this.header = header; - } - - /** - * @return the leftover - */ - public String getLeftover() { - return leftover; - } - - -public void jjtOpen() { - } - - public void jjtClose() { - } - - - public void jjtSetParent(Node n) { parent = n; } - public Node jjtGetParent() { return parent; } - - public void jjtAddChild(Node n, int i) { - if (children == null) { - children = new Node[i + 1]; - } else if (i >= children.length) { - Node c[] = new Node[i + 1]; - System.arraycopy(children, 0, c, 0, children.length); - children = c; - } - children[i] = n; - } - - public Node jjtGetChild(int i) { - return children[i]; - } - - public int jjtGetNumChildren() { - return (children == null) ? 0 : children.length; - } - - /* You can override these two methods in subclasses of SimpleNode to - customize the way the node appears when the tree is dumped. If - your output uses more than one line you should override - toString(String), otherwise overriding toString() is probably all - you need to do. */ - @Override - public String toString() { return CCGbankDerivationTreeConstants.jjtNodeName[id]; } - public String toString(String prefix) { return prefix + toString(); } + //Javacc generated variables + protected Node parent; + protected Node[] children; + protected int id; + protected CCGbankDerivation parser; + + //User defined variables + + // lex, sense, role triples + public static class LexSenseRole { + public String lex, sense, role; + + public LexSenseRole(String lex, String sense, String role) { + this.lex = lex; + this.sense = sense; + this.role = role; + } + } + + //CCGbank id + public String header; + + //The serial no of the gold standard parse + String parseNo = ""; + + //Node type eg:-Treenode,Leafnode,atomcat etc + public String type = ""; + + //Traps any feature which is leftover + public String leftover; + + //Headedness info 0 or 1 + public String head = ""; + + //No:of daughters of a node + public String dtr = ""; + + //Category Specification + public String cat = ""; + + //Category Specification without co-indexation info in leafnodes + public String catRedundant = ""; + + //Lexical information + public String lex = ""; + + //Part of speech info. eg: RB, IN etc + public String pos = ""; + + // The roles (or rel) that the node plays + public List nodeRoles = null; + + // The arg roles of a verbal cat + public List argRoles = null; + + //First token in the node scope + Token first_token; + + //Final token in the node scope + Token last_token; + + //Function which produces the content of the node. + public String print() throws Exception { + + Token p = first_token; + + while (p != last_token) { + cat = cat + p.image; + p = p.next; + } + + return cat + last_token.image; + } + + + //The remaining part incl comments is Javacc generated. + + public SimpleNode(int i) { + id = i; + } + + public SimpleNode(CCGbankDerivation p, int i) { + this(i); + parser = p; + } + + /** + * @return the header + */ + public String getHeader() { + return header; + } + + /** + * @param header the header to set + */ + public void setHeader(String header) { + this.header = header; + } + + /** + * @return the leftover + */ + public String getLeftover() { + return leftover; + } + + public int getId(){ + return id; + } + + + public void jjtOpen() { + } + + public void jjtClose() { + } + + + public void jjtSetParent(Node n) { + parent = n; + } + + public Node jjtGetParent() { + return parent; + } + + public void jjtAddChild(Node n, int i) { + if (children == null) { + children = new Node[i + 1]; + } else if (i >= children.length) { + Node c[] = new Node[i + 1]; + System.arraycopy(children, 0, c, 0, children.length); + children = c; + } + children[i] = n; + } + + public Node jjtGetChild(int i) { + return children[i]; + } + + public int jjtGetNumChildren() { + return (children == null) ? 0 : children.length; + } + + /* You can override these two methods in subclasses of SimpleNode to + customize the way the node appears when the tree is dumped. If + your output uses more than one line you should override + toString(String), otherwise overriding toString() is probably all + you need to do. */ + @Override + public String toString() { + return CCGbankDerivationTreeConstants.jjtNodeName[id]; + } + + public String toString(String prefix) { + return prefix + toString(); + } /* Override this method if you want to customize how the node dumps out its children. */ - public void dump(String prefix) { - System.out.println(toString(prefix)); - if (children != null) { - for (int i = 0; i < children.length; ++i) { - SimpleNode n = (SimpleNode)children[i]; - if (n != null) { - n.dump(prefix + " "); - } - } - } - } + public void dump(String prefix) { + System.out.println(toString(prefix)); + if (children != null) { + for (int i = 0; i < children.length; ++i) { + SimpleNode n = (SimpleNode) children[i]; + if (n != null) { + n.dump(prefix + " "); + } + } + } + } } diff --git a/src/pom.xml b/src/pom.xml new file mode 100644 index 0000000..4d905e4 --- /dev/null +++ b/src/pom.xml @@ -0,0 +1,156 @@ + + + 4.0.0 + opennlp + openccg + 0.10.0 + + + 1.8 + 1.8 + ${project.build.directory}/generated-sources + + + + + + jdom + jdom + 1.1 + + + + trove + trove + 1.0.2 + + + + org.apache.ant + ant + 1.9.0 + + + + net.sf.jgrapht + jgrapht + 0.8.3 + + + + net.sf.jopt-simple + jopt-simple + 3.1 + + + + junit + junit + 4.12 + + + + + jline + jline + 1.0 + + + + org.eclipse.birt.runtime.3_7_1 + org.apache.xml.serializer + 2.7.1 + + + + + + + openccg + . + + + maven-compiler-plugin + 3.7.0 + + + **/.backup.orig/** + srilmbridge/ + kenlm/ + + + + + org.codehaus.mojo + javacc-maven-plugin + 2.6 + + + jjt + generate-sources + + jjtree-javacc + + + ${basedir}/opennlp/ccgbank/parse/ + ${project.build.gen}/jjtree/ + + + + jj + generate-sources + + javacc + + + ${project.build.gen}/jjtree/opennlp/ccgbank/parse/ + ${project.build.gen}/jjtree/ + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${project.build.gen} + + + + + + + + +