You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2014/01/02 13:40:29 UTC
svn commit: r1554795 -
/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/Parse.java
Author: joern
Date: Thu Jan 2 12:40:28 2014
New Revision: 1554795
URL: http://svn.apache.org/r1554795
Log:
OPENNLP-598 Added support for right / left square brackets. Manually merged the provided patch. Thanks to Ioan Barbulescu
Modified:
opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/Parse.java
Modified: opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/Parse.java
URL: http://svn.apache.org/viewvc/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/Parse.java?rev=1554795&r1=1554794&r2=1554795&view=diff
==============================================================================
--- opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/Parse.java (original)
+++ opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/parser/Parse.java Thu Jan 2 12:40:28 2014
@@ -42,6 +42,8 @@ public class Parse implements Cloneable,
public static final String BRACKET_RRB = ")";
public static final String BRACKET_LCB = "{";
public static final String BRACKET_RCB = "}";
+ public static final String BRACKET_LSB = "[";
+ public static final String BRACKET_RSB = "]";
/**
* The text string on which this parse is based.
@@ -653,6 +655,13 @@ public class Parse implements Cloneable,
else if (rest.startsWith("-RRB-")) {
return "-RRB-";
}
+ else if (rest.startsWith("-RSB-")) {
+ return "-RSB-";
+ }
+ else if (rest.startsWith("-LSB-")) {
+ return "-LSB-";
+ }
+
else if (rest.startsWith("-NONE-")) {
return "-NONE-";
}
@@ -686,6 +695,12 @@ public class Parse implements Cloneable,
else if (BRACKET_RCB.equals(token)) {
return "-RCB-";
}
+ else if (BRACKET_LSB.equals(token)) {
+ return "-LSB-";
+ }
+ else if (BRACKET_RSB.equals(token)) {
+ return "-RSB-";
+ }
return token;
}
@@ -703,6 +718,12 @@ public class Parse implements Cloneable,
else if ("-RCB-".equals(token)) {
return BRACKET_RCB;
}
+ else if ("-LSB-".equals(token)) {
+ return BRACKET_LSB;
+ }
+ else if ("-RSB-".equals(token)) {
+ return BRACKET_RSB;
+ }
return token;
}