From ac989900af65965117d85ec3a1e479c6f2f09d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDygimantas=20Medelis?= Date: Fri, 19 Apr 2019 06:41:09 +0300 Subject: [PATCH 01/10] Remove unused imports --- src/ccg2xml/ccg.ply | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 ... From bddbabe9bb170ac927c6538c6367ac2536deffb1 Mon Sep 17 00:00:00 2001 From: Sarunas Navickas Date: Mon, 3 Jun 2019 13:14:13 +0300 Subject: [PATCH 02/10] Initial stuff --- pom.xml | 20 +++++++++++ src/opennlp/ccg/pom.xml | 71 +++++++++++++++++++++++++++++++++++++ src/opennlp/ccgbank/pom.xml | 21 +++++++++++ 3 files changed, 112 insertions(+) create mode 100644 pom.xml create mode 100644 src/opennlp/ccg/pom.xml create mode 100644 src/opennlp/ccgbank/pom.xml diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..0f76f32 --- /dev/null +++ b/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + opennlp + ccg + 0.10.0 + pom + + + src/opennlp/ccgbank + src/opennlp/ccg + + + + 1.8 + 1.8 + + + diff --git a/src/opennlp/ccg/pom.xml b/src/opennlp/ccg/pom.xml new file mode 100644 index 0000000..56056fb --- /dev/null +++ b/src/opennlp/ccg/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + opennlp + ccg-core + 0.10.0 + + + 1.8 + 1.8 + + + + + opennlp + ccgbank + 1.0 + + + + jdom + jdom + 1.0 + + + + trove + trove + 1.1-beta-5 + + + + org.apache.ant + ant + 1.10.6 + + + + org.jgrapht + jgrapht + 0.7.3 + + + + net.sf.jopt-simple + jopt-simple + 5.0.4 + + + + junit + junit + 4.12 + + + + + + + . + + + maven-compiler-plugin + 3.8.1 + + + + + + diff --git a/src/opennlp/ccgbank/pom.xml b/src/opennlp/ccgbank/pom.xml new file mode 100644 index 0000000..48c45ec --- /dev/null +++ b/src/opennlp/ccgbank/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + opennlp + ccgbank + 1.0 + pom + + + 1.8 + 1.8 + + + + + + . + + + From c648c99acd48485707a7d846b345851d16699c08 Mon Sep 17 00:00:00 2001 From: Sarunas Navickas Date: Mon, 3 Jun 2019 14:15:10 +0300 Subject: [PATCH 03/10] Some updates --- pom.xml | 1 - src/opennlp/ccg/pom.xml | 43 +++++++++++++++++++++++++++++++------ src/opennlp/ccgbank/pom.xml | 26 ++++++++++++++++++---- 3 files changed, 59 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 0f76f32..6ac06b5 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,6 @@ pom - src/opennlp/ccgbank src/opennlp/ccg diff --git a/src/opennlp/ccg/pom.xml b/src/opennlp/ccg/pom.xml index 56056fb..5edc01e 100644 --- a/src/opennlp/ccg/pom.xml +++ b/src/opennlp/ccg/pom.xml @@ -12,11 +12,11 @@ - - opennlp - ccgbank - 1.0 - + + + + + jdom @@ -37,7 +37,7 @@ - org.jgrapht + jgrapht jgrapht 0.7.3 @@ -55,9 +55,23 @@ + + jline + jline + 2.14.6 + + + + org.eclipse.birt.runtime.3_7_1 + org.apache.xml.serializer + 2.7.1 + + + + ccg . @@ -66,6 +80,23 @@ + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ../ccgbank + + + + + diff --git a/src/opennlp/ccgbank/pom.xml b/src/opennlp/ccgbank/pom.xml index 48c45ec..9ee5e8a 100644 --- a/src/opennlp/ccgbank/pom.xml +++ b/src/opennlp/ccgbank/pom.xml @@ -5,17 +5,35 @@ opennlp ccgbank 1.0 - pom 1.8 1.8 - + + + jdom + jdom + 1.0 + + + + org.apache.ant + ant + 1.10.6 + + . - - + + + maven-compiler-plugin + 3.8.1 + + + + + From 88af6c1b2f242b32fdcc439c0ee6cd9fe890b193 Mon Sep 17 00:00:00 2001 From: Sarunas Navickas Date: Thu, 11 Jul 2019 16:15:50 +0300 Subject: [PATCH 04/10] Adjust lib versions --- pom.xml | 2 +- src/opennlp/ccgbank/pom.xml | 39 ----------------------------------- src/opennlp/{ccg => }/pom.xml | 24 ++++++++++----------- 3 files changed, 13 insertions(+), 52 deletions(-) delete mode 100644 src/opennlp/ccgbank/pom.xml rename src/opennlp/{ccg => }/pom.xml (89%) diff --git a/pom.xml b/pom.xml index 6ac06b5..5493d1d 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ pom - src/opennlp/ccg + src/opennlp diff --git a/src/opennlp/ccgbank/pom.xml b/src/opennlp/ccgbank/pom.xml deleted file mode 100644 index 9ee5e8a..0000000 --- a/src/opennlp/ccgbank/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - opennlp - ccgbank - 1.0 - - - 1.8 - 1.8 - - - - - jdom - jdom - 1.0 - - - - org.apache.ant - ant - 1.10.6 - - - - - . - - - maven-compiler-plugin - 3.8.1 - - - - - - diff --git a/src/opennlp/ccg/pom.xml b/src/opennlp/pom.xml similarity index 89% rename from src/opennlp/ccg/pom.xml rename to src/opennlp/pom.xml index 5edc01e..5d3beb8 100644 --- a/src/opennlp/ccg/pom.xml +++ b/src/opennlp/pom.xml @@ -3,14 +3,14 @@ 4.0.0 opennlp - ccg-core + openccg 0.10.0 1.8 1.8 - + @@ -21,31 +21,31 @@ jdom jdom - 1.0 + 1.1 trove trove - 1.1-beta-5 + 1.0.2 org.apache.ant ant - 1.10.6 + 1.9.0 - jgrapht + net.sf.jgrapht jgrapht - 0.7.3 + 0.8.3 net.sf.jopt-simple jopt-simple - 5.0.4 + 3.1 @@ -58,7 +58,7 @@ jline jline - 2.14.6 + 1.0 @@ -71,7 +71,7 @@ - ccg + openccg . @@ -80,7 +80,7 @@ - + From 188cf0d89d008499309e4ab45bdce5903f031430 Mon Sep 17 00:00:00 2001 From: Sarunas Navickas Date: Fri, 12 Jul 2019 09:41:54 +0300 Subject: [PATCH 05/10] Compile jtrees --- pom.xml | 2 +- src/opennlp/pom.xml | 102 ------------------------------ src/pom.xml | 149 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+), 103 deletions(-) delete mode 100644 src/opennlp/pom.xml create mode 100644 src/pom.xml diff --git a/pom.xml b/pom.xml index 5493d1d..cf80c5a 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ pom - src/opennlp + src/ diff --git a/src/opennlp/pom.xml b/src/opennlp/pom.xml deleted file mode 100644 index 5d3beb8..0000000 --- a/src/opennlp/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - opennlp - openccg - 0.10.0 - - - 1.8 - 1.8 - - - - - - - - - - - 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.8.1 - - - - - - - diff --git a/src/pom.xml b/src/pom.xml new file mode 100644 index 0000000..c248437 --- /dev/null +++ b/src/pom.xml @@ -0,0 +1,149 @@ + + + 4.0.0 + opennlp + openccg + 0.10.0 + + + 1.8 + 1.8 + + + + + + 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.8.1 + + + **/.backup.orig/** + srilmbridge/ + kenlm/ + + + + + com.helger.maven + ph-javacc-maven-plugin + 4.1.3 + + + javac + generate-sources + + javacc + + + ${basedir}/opennlp/ccgbank/parse/ + ${project.build.directory} + + + + jjt + generate-sources + + jjtree-javacc + + + ${basedir}/opennlp/ccgbank/parse/ + ${project.build.directory} + + + + jj + generate-sources + + javacc + + + ${basedir}/opennlp/ccgbank/parse/ + ${project.build.directory} + + + + + + maven-resources-plugin + 3.1.0 + + + copy-resources + compile + + copy-resources + + + ${project.build.directory}/opennlp/ccgbank/parse/ + + + ${basedir}/opennlp/ccgbank/parse/ + + SimpleNode.java + + + + + + + + + + From 64999502d9bca0c570c392366d8ec5faafe84438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Navickas?= Date: Fri, 12 Jul 2019 11:47:08 +0300 Subject: [PATCH 06/10] Format it to make readable --- src/opennlp/ccgbank/parse/SimpleNode.java | 319 +++++++++++----------- 1 file changed, 166 insertions(+), 153 deletions(-) diff --git a/src/opennlp/ccgbank/parse/SimpleNode.java b/src/opennlp/ccgbank/parse/SimpleNode.java index 0287942..18cbcfc 100755 --- a/src/opennlp/ccgbank/parse/SimpleNode.java +++ b/src/opennlp/ccgbank/parse/SimpleNode.java @@ -8,162 +8,175 @@ 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 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 + " "); + } + } + } + } } From 14e3ae2c8f0a268ef60bf2a9c41f5f01d7bee0a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Navickas?= Date: Fri, 12 Jul 2019 11:48:18 +0300 Subject: [PATCH 07/10] It should be `TokenMgrException` instead of `TokenMgrError` ? --- src/opennlp/ccgbank/CCGBankTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opennlp/ccgbank/CCGBankTask.java b/src/opennlp/ccgbank/CCGBankTask.java index 07718dc..76115d6 100755 --- a/src/opennlp/ccgbank/CCGBankTask.java +++ b/src/opennlp/ccgbank/CCGBankTask.java @@ -34,7 +34,7 @@ import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerException; -import opennlp.ccgbank.parse.TokenMgrError; +import opennlp.ccgbank.parse.TokenMgrException; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; From 9842dc0b1a8abb721336defbcf3eb30821ec8afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Navickas?= Date: Fri, 12 Jul 2019 12:22:59 +0300 Subject: [PATCH 08/10] missing `getId` method --- src/opennlp/ccgbank/parse/SimpleNode.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/opennlp/ccgbank/parse/SimpleNode.java b/src/opennlp/ccgbank/parse/SimpleNode.java index 18cbcfc..dc91c92 100755 --- a/src/opennlp/ccgbank/parse/SimpleNode.java +++ b/src/opennlp/ccgbank/parse/SimpleNode.java @@ -115,6 +115,10 @@ public String getLeftover() { return leftover; } + public int getid(){ + return id; + } + public void jjtOpen() { } From 5cfc6ed04226b8337f190c840764617761418df9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Navickas?= Date: Fri, 12 Jul 2019 12:47:02 +0300 Subject: [PATCH 09/10] fix `getId` --- src/opennlp/ccgbank/parse/SimpleNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opennlp/ccgbank/parse/SimpleNode.java b/src/opennlp/ccgbank/parse/SimpleNode.java index dc91c92..232d94b 100755 --- a/src/opennlp/ccgbank/parse/SimpleNode.java +++ b/src/opennlp/ccgbank/parse/SimpleNode.java @@ -115,7 +115,7 @@ public String getLeftover() { return leftover; } - public int getid(){ + public int getId(){ return id; } From 73a13e23184a2ff97753b16122c4c16f91ce7b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Navickas?= Date: Fri, 12 Jul 2019 13:13:45 +0300 Subject: [PATCH 10/10] Make it compile --- src/opennlp/ccgbank/CCGBankTask.java | 2 +- src/pom.xml | 47 ++++++++++++++++------------ 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/opennlp/ccgbank/CCGBankTask.java b/src/opennlp/ccgbank/CCGBankTask.java index 76115d6..07718dc 100755 --- a/src/opennlp/ccgbank/CCGBankTask.java +++ b/src/opennlp/ccgbank/CCGBankTask.java @@ -34,7 +34,7 @@ import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerException; -import opennlp.ccgbank.parse.TokenMgrException; +import opennlp.ccgbank.parse.TokenMgrError; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; diff --git a/src/pom.xml b/src/pom.xml index c248437..4d905e4 100644 --- a/src/pom.xml +++ b/src/pom.xml @@ -9,6 +9,7 @@ 1.8 1.8 + ${project.build.directory}/generated-sources @@ -71,7 +72,7 @@ maven-compiler-plugin - 3.8.1 + 3.7.0 **/.backup.orig/** @@ -81,21 +82,10 @@ - com.helger.maven - ph-javacc-maven-plugin - 4.1.3 + org.codehaus.mojo + javacc-maven-plugin + 2.6 - - javac - generate-sources - - javacc - - - ${basedir}/opennlp/ccgbank/parse/ - ${project.build.directory} - - jjt generate-sources @@ -104,7 +94,7 @@ ${basedir}/opennlp/ccgbank/parse/ - ${project.build.directory} + ${project.build.gen}/jjtree/ @@ -114,19 +104,36 @@ javacc - ${basedir}/opennlp/ccgbank/parse/ - ${project.build.directory} + ${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} + + + + + +