You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2014/03/19 13:11:22 UTC
svn commit: r1579201 [2/2] - in /uima/ruta/trunk:
example-projects/ruta-ep-example-extensions/src/main/java/org/apache/uima/ruta/example/extensions/
ruta-core/src/main/java/org/apache/uima/ruta/engine/
ruta-core/src/main/java/org/apache/uima/ruta/rule/...
Modified: uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/packages/PackagesManager.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/packages/PackagesManager.java?rev=1579201&r1=1579200&r2=1579201&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/packages/PackagesManager.java (original)
+++ uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/core/packages/PackagesManager.java Wed Mar 19 12:11:20 2014
@@ -97,7 +97,7 @@ public class PackagesManager {
private Map packsWithDeps = new HashMap();
- public static PackagesManager getInstance() {
+ public static synchronized PackagesManager getInstance() {
if (manager == null) {
manager = new PackagesManager();
}
@@ -450,7 +450,7 @@ public class PackagesManager {
return getInternalPackageNames(install, project.getElementName());
}
- public Set getInternalPackageNames(IInterpreterInstall install, IProject project) {
+ public synchronized Set getInternalPackageNames(IInterpreterInstall install, IProject project) {
return getInternalPackageNames(install, project.getName());
}
Modified: uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRuleElement.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRuleElement.java?rev=1579201&r1=1579200&r2=1579201&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRuleElement.java (original)
+++ uima/ruta/trunk/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaRuleElement.java Wed Mar 19 12:11:20 2014
@@ -56,12 +56,12 @@ public class RutaRuleElement extends Exp
if (conditions != null) {
this.conditions = conditions;
} else {
- conditions = new ArrayList<RutaCondition>();
+ this.conditions = new ArrayList<RutaCondition>();
}
if (actions != null) {
this.actions = actions;
} else {
- actions = new ArrayList<RutaAction>();
+ this.actions = new ArrayList<RutaAction>();
}
if (quantifierPartExpressions != null) {
this.quantifierExpressions = quantifierPartExpressions;
Modified: uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/core/TextRulerSingleSlotRule.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/core/TextRulerSingleSlotRule.java?rev=1579201&r1=1579200&r2=1579201&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/core/TextRulerSingleSlotRule.java (original)
+++ uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/core/TextRulerSingleSlotRule.java Wed Mar 19 12:11:20 2014
@@ -120,7 +120,7 @@ public class TextRulerSingleSlotRule ext
slotPattern.fillerPattern.add(item);
setNeedsCompile(true);
} else {
- new Exception("[TextRulerRule] BOUNDARY SLOT RULES CANNOT HAVE FILLER ITEMS!");
+ throw new RuntimeException("[TextRulerRule] BOUNDARY SLOT RULES CANNOT HAVE FILLER ITEMS!");
}
}
Modified: uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/core/TextRulerTarget.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/core/TextRulerTarget.java?rev=1579201&r1=1579200&r2=1579201&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/core/TextRulerTarget.java (original)
+++ uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/core/TextRulerTarget.java Wed Mar 19 12:11:20 2014
@@ -19,6 +19,8 @@
package org.apache.uima.ruta.textruler.core;
+import java.util.Arrays;
+
/**
*
* TextRulerTarget encapsulates a learning target of an ML-algorithm. It currently can be
@@ -174,6 +176,6 @@ public class TextRulerTarget {
@Override
public int hashCode() {
- return slotNames.hashCode() * type.hashCode();
+ return Arrays.asList(slotNames).hashCode() * type.hashCode();
}
}
Modified: uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/kep/KEPRuleItemCondition.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/kep/KEPRuleItemCondition.java?rev=1579201&r1=1579200&r2=1579201&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/kep/KEPRuleItemCondition.java (original)
+++ uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/kep/KEPRuleItemCondition.java Wed Mar 19 12:11:20 2014
@@ -15,7 +15,7 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-*/
+ */
package org.apache.uima.ruta.textruler.learner.kep;
@@ -53,19 +53,20 @@ public class KEPRuleItemCondition {
+ (regExp + type == null ? "" : type.getShortName()) + ")";
}
- public boolean equals(KEPRuleItemCondition other) {
- if (this.condition == Condition.REGEXP && other.condition == Condition.REGEXP
- && this.regExp.equals(other.regExp) && this.isNot == other.isNot)
- return true;
- if (this.type.toString().equals(other.type.toString()) && this.isNot == other.isNot
- && this.condition == other.condition)
- return true;
+ public boolean equals(Object o) {
+ if (o instanceof KEPRuleItemCondition) {
+ KEPRuleItemCondition other = (KEPRuleItemCondition) o;
+ if (this.condition == Condition.REGEXP && other.condition == Condition.REGEXP
+ && this.regExp.equals(other.regExp) && this.isNot == other.isNot)
+ return true;
+ if (this.type.toString().equals(other.type.toString()) && this.isNot == other.isNot
+ && this.condition == other.condition)
+ return true;
+ } else if (o instanceof Type) {
+ if (this.type.toString().equals(((Type) o).toString()))
+ return true;
+ }
return false;
}
- public boolean equals(Type type) {
- if (this.type.toString().equals(type.toString()))
- return true;
- return false;
- }
}
Modified: uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/lp2/LP2RuleItem.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/lp2/LP2RuleItem.java?rev=1579201&r1=1579200&r2=1579201&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/lp2/LP2RuleItem.java (original)
+++ uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/lp2/LP2RuleItem.java Wed Mar 19 12:11:20 2014
@@ -290,10 +290,6 @@ public class LP2RuleItem implements Text
return wordConstraint;
}
- public void removeConstraintWithName(String name) {
- otherConstraints.remove(name);
- }
-
public int totalConstraintCount() {
return otherConstraints.size() + (wordConstraint != null ? 1 : 0)
+ (contextConstraint != null ? 1 : 0);
Modified: uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/ShiftAllRule.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/ShiftAllRule.java?rev=1579201&r1=1579200&r2=1579201&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/ShiftAllRule.java (original)
+++ uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/ShiftAllRule.java Wed Mar 19 12:11:20 2014
@@ -176,13 +176,13 @@ public class ShiftAllRule extends Shifti
return true;
}
if (frontBoundaryItem != null)
- if (frontBoundaryItem.equals(target))
+ if (frontBoundaryItem.getAnnotation().equals(target))
return true;
if (errorBoundaryItem != null)
- if (errorBoundaryItem.equals(target))
+ if (errorBoundaryItem.getAnnotation().equals(target))
return true;
if (rearBoundaryItem != null)
- if (rearBoundaryItem.equals(target))
+ if (rearBoundaryItem.getAnnotation().equals(target))
return true;
for (Condition each : getConditions()) {
if (each.getItem().getAnnotation().getType().getShortName()
Modified: uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/ShiftingRule.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/ShiftingRule.java?rev=1579201&r1=1579200&r2=1579201&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/ShiftingRule.java (original)
+++ uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/ShiftingRule.java Wed Mar 19 12:11:20 2014
@@ -69,10 +69,10 @@ public abstract class ShiftingRule exten
return true;
}
if (frontBoundaryItem != null)
- if (frontBoundaryItem.equals(target))
+ if (frontBoundaryItem.getAnnotation().equals(target))
return true;
if (rearBoundaryItem != null)
- if (rearBoundaryItem.equals(target))
+ if (rearBoundaryItem.getAnnotation().equals(target))
return true;
for (Condition each : getConditions()) {
if (each.getItem().getAnnotation().getType().getShortName()
Modified: uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/TrabalLearner.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/TrabalLearner.java?rev=1579201&r1=1579200&r2=1579201&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/TrabalLearner.java (original)
+++ uima/ruta/trunk/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/learner/trabal/TrabalLearner.java Wed Mar 19 12:11:20 2014
@@ -1121,8 +1121,8 @@ public class TrabalLearner extends TextR
}
public RankedList getPositiveExamplesFor(Type type) {
- if (positiveExamples.containsKey(type)) {
- return positiveExamples.get(type);
+ if (positiveExamples.containsKey(type.getShortName())) {
+ return positiveExamples.get(type.getShortName());
} else {
return new RankedList(idf);
}
@@ -1158,7 +1158,7 @@ public class TrabalLearner extends TextR
result.add(new Condition(ConditionType.BEFORE, item));
}
for (TrabalRuleItem item : getConsumingTerms(frontBoundary, doc)) {
- if (!item.getAnnotation().equals(cas.getDocumentAnnotation())) {
+ if (!item.getAnnotation().getType().equals(cas.getDocumentAnnotation().getType())) {
result.add(new Condition(ConditionType.PARTOF, item));
}
}
@@ -1203,7 +1203,7 @@ public class TrabalLearner extends TextR
result.add(new Condition(ConditionType.BEFORE, item));
}
for (TrabalRuleItem item : getConsumingTerms(ruleItem, doc)) {
- if (!item.getAnnotation().equals(cas.getDocumentAnnotation())) {
+ if (!item.getAnnotation().getType().equals(cas.getDocumentAnnotation().getType())) {
result.add(new Condition(ConditionType.PARTOF, item));
}
}