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 2013/03/04 17:36:38 UTC
svn commit: r1452376 - in
/uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2:
BasicLP2.java NaiveLP2.java OptimizedLP2.java
Author: pkluegl
Date: Mon Mar 4 16:36:37 2013
New Revision: 1452376
URL: http://svn.apache.org/r1452376
Log:
UIMA-2706
- adapted lp2 for multiple slots
Modified:
uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/BasicLP2.java
uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/NaiveLP2.java
uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/OptimizedLP2.java
Modified: uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/BasicLP2.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/BasicLP2.java?rev=1452376&r1=1452375&r2=1452376&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/BasicLP2.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/BasicLP2.java Mon Mar 4 16:36:37 2013
@@ -20,12 +20,12 @@
package org.apache.uima.textmarker.textruler.learner.lp2;
import java.io.File;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.uima.cas.CAS;
@@ -45,7 +45,6 @@ import org.apache.uima.textmarker.textru
import org.apache.uima.textmarker.textruler.core.TextRulerTarget.MLTargetType;
import org.apache.uima.textmarker.textruler.core.TextRulerToolkit;
import org.apache.uima.textmarker.textruler.extension.TextRulerLearnerDelegate;
-import org.apache.uima.textmarker.textruler.extension.TextRulerLearner.TextRulerLearnerState;
import org.apache.uima.util.FileUtils;
public abstract class BasicLP2 extends TextRulerBasicLearner {
@@ -90,23 +89,23 @@ public abstract class BasicLP2 extends T
protected Set<TextRulerExample> coveredExamples;
- protected int slotMaximumTokenCount = 0;
+ protected Map<String, Integer> slotMaximumTokenCountMap = new TreeMap<String, Integer>();
protected LP2CurrentBestRulesQueue currentBestRules;
protected LP2CurrentBestRulesQueue currentContextualRules;
- protected TextRulerRuleList bestRulesPool;
+ protected Map<String, TextRulerRuleList> bestRulesPoolMap = new TreeMap<String, TextRulerRuleList>();
- protected TextRulerRuleList contextRulesPool;
+ protected Map<String, TextRulerRuleList> contextRulesPoolMap = new TreeMap<String, TextRulerRuleList>();
- protected String leftBoundaryBestRulesString = null;
+ protected Map<String, String> leftBoundaryBestRulesMap = new TreeMap<String, String>();
- protected String rightBoundaryBestRulesString = null;
+ protected Map<String, String> rightBoundaryBestRulesMap = new TreeMap<String, String>();
- protected String leftBoundaryContextualRulesString = null;
+ protected Map<String, String> leftBoundaryContextualRulesMap = new TreeMap<String, String>();
- protected String rightBoundaryContextualRulesString = null;
+ protected Map<String, String> rightBoundaryContextualRulesMap = new TreeMap<String, String>();
public BasicLP2(String inputDir, String prePropTMFile, String tmpDir, String[] slotNames,
Set<String> filterSet, TextRulerLearnerDelegate delegate) {
@@ -134,8 +133,12 @@ public abstract class BasicLP2 extends T
if (shouldAbort())
return null;
- bestRulesPool = new TextRulerRuleList();
- contextRulesPool = new TextRulerRuleList();
+ TextRulerRuleList bestRulesPool = new TextRulerRuleList();
+ TextRulerRuleList contextRulesPool = new TextRulerRuleList();
+ String slotName = target.getSingleSlotRawTypeName();
+ bestRulesPoolMap.put(slotName, bestRulesPool);
+ contextRulesPoolMap.put(slotName, contextRulesPool);
+
coveredExamples = new HashSet<TextRulerExample>();
int roundNumber = 0;
for (TextRulerExample e : examples)
@@ -183,8 +186,6 @@ public abstract class BasicLP2 extends T
if (contextualRules != null)
for (TextRulerRule r : contextRulesPool)
contextualRules.add(r);
- bestRulesPool = null;
- contextRulesPool = null;
return result;
}
@@ -212,8 +213,8 @@ public abstract class BasicLP2 extends T
coveredExamples = null;
currentBestRules = null;
currentContextualRules = null;
- bestRulesPool = null;
- contextRulesPool = null;
+ bestRulesPoolMap.clear();
+ contextRulesPoolMap.clear();
}
@Override
@@ -241,7 +242,7 @@ public abstract class BasicLP2 extends T
TextRulerToolkit.getFilterSetWithSlotNames(slotNames, filterSet));
if (shouldAbort())
return;
- slotMaximumTokenCount = histogram.size() - 1; // -1 since the
+ slotMaximumTokenCountMap.put(slotName, histogram.size() - 1); // -1 since the
// zero-histogram point
// also needs a place!
@@ -253,8 +254,8 @@ public abstract class BasicLP2 extends T
// best
// rules
if (bestRules != null) {
- leftBoundaryBestRulesString = bestRules.getRulesString("");
- leftBoundaryContextualRulesString = ctxRules.getRulesString("\t");
+ leftBoundaryBestRulesMap.put(slotName, bestRules.getRulesString(""));
+ leftBoundaryContextualRulesMap.put(slotName, ctxRules.getRulesString("\t"));
bestRules.clear(); // free som memory/references
}
if (shouldAbort())
@@ -266,31 +267,13 @@ public abstract class BasicLP2 extends T
// boundary best
// rules
if (bestRules != null) {
- rightBoundaryBestRulesString = bestRules.getRulesString("");
- rightBoundaryContextualRulesString = ctxRules.getRulesString("\t");
+ rightBoundaryBestRulesMap.put(slotName, bestRules.getRulesString(""));
+ rightBoundaryContextualRulesMap.put(slotName, ctxRules.getRulesString("\t"));
}
// TODO add correction rule learn stuff
// testTaggingRulesAndCreateCorrectionRulesExamples(null, STANDARD_MAX_CONTEXTUAL_RULES_COUNT)
- File file = new File(tempDirectory() + "rules.tm");
- String resultString;
- try {
-
- // = getResultString();
- // System.out.println(resultString);
- // resultString =
- // resultString.replaceAll("NUM[{]REGEXP[(]\"12\"[)][-][>]MARKONCE[(]stimeSTART[)][}];",
- // "NUM{REGEXP(\"12\")} ALL{->MARKONCE(stimeSTART)};");
- // System.out.println(resultString);
-
- resultString = "PACKAGE org.apache.uima.ml;\n\nDocument{->FILTERTYPE(SPACE, BREAK, NBSP, MARKUP)};\n";
- // resultString += "NUM{REGEXP(\"12\")} ALL{->MARKONCE(stimeSTART)};";
- FileUtils.saveString2File(resultString, file);
- } catch (IOException e) {
- TextRulerPlugin.error(e);
- }
-
// correct left start
TextRulerTarget lsTarget = new TextRulerTarget(slotName, MLTargetType.SINGLE_LEFT_CORRECTION,
this);
@@ -317,12 +300,12 @@ public abstract class BasicLP2 extends T
protected abstract void induceRulesFromExample(TextRulerExample e, int roundNumber);
protected void addToFinalContextRulesPool(LP2Rule rule) {
- if (TextRulerToolkit.DEBUG )
+ if (TextRulerToolkit.DEBUG)
TextRulerToolkit.appendStringToFile(tempDirectory() + "ctxpool.tm", rule.getRuleString()
+ "\n");
-
- if (!contextRulesPool.contains(rule)) {
- contextRulesPool.add(rule);
+ String slotName = rule.getTarget().getSingleSlotRawTypeName();
+ if (!contextRulesPoolMap.get(slotName).contains(rule)) {
+ contextRulesPoolMap.get(slotName).add(rule);
// TextRulerToolkit.log("CONTEXT RULE: "+rule.getRuleString()+" ; "+rule.getCoveringStatistics());
} else {
if (TextRulerToolkit.DEBUG) {
@@ -336,14 +319,15 @@ public abstract class BasicLP2 extends T
if (TextRulerToolkit.DEBUG && false)
TextRulerToolkit.appendStringToFile(tempDirectory() + "bestpool.tm", rule.getRuleString()
+ "\n");
-
- if (!bestRulesPool.contains(rule)) {
- bestRulesPool.add(rule);
+ String slotName = rule.getTarget().getSingleSlotRawTypeName();
+ if (!bestRulesPoolMap.get(slotName).contains(rule)) {
+ bestRulesPoolMap.get(slotName).add(rule);
// TextRulerToolkit.log("BEST RULE: "+rule.getRuleString());
// add all covered positives to covering set
coveredExamples.addAll(rule.getCoveringStatistics().getCoveredPositiveExamples());
if (TextRulerToolkit.DEBUG)
- bestRulesPool.saveToRulesFile(getIntermediateRulesFileName(), getTMFileHeaderString());
+ bestRulesPoolMap.get(slotName).saveToRulesFile(getIntermediateRulesFileName(),
+ getTMFileHeaderString());
} else {
if (TextRulerToolkit.DEBUG && false) {
TextRulerToolkit.log("KANN SOWAS PASSIEREN ??");
@@ -354,55 +338,82 @@ public abstract class BasicLP2 extends T
}
public String getResultString() {
- String result = getTMFileHeaderString();
- result += "// LEFT BOUNDARY RULES:\n";
- if (leftBoundaryBestRulesString != null) {
- result += leftBoundaryBestRulesString;
- result += "\n// RIGHT BOUNDARY RULES:\n";
- if (rightBoundaryBestRulesString != null)
- result += rightBoundaryBestRulesString;
- else if (bestRulesPool != null)
- result += bestRulesPool.getRulesString("");
-
- result += "\nBLOCK(contextualRules) Document{}\n" + "{\n"
- + "\tDocument{->ASSIGN(redoContextualRules, false)}; // reset flag\n";
- result += "\n\t// LEFT BOUNDARY CONTEXTUAL RULES:\n";
- result += leftBoundaryContextualRulesString;
-
- result += "\n\t// RIGHT BOUNDARY CONTEXTUAL RULES:\n";
- if (rightBoundaryBestRulesString != null)
- result += rightBoundaryContextualRulesString;
- else if (contextRulesPool != null)
- result += contextRulesPool.getRulesString("\t");
-
- result += "\n\tDocument{IF(redoContextualRules)->CALL(thisFile.contextualRules)};\n}\n";
- } else if (bestRulesPool != null) {
- result += bestRulesPool.getRulesString("");
- result += "\n\t// LEFT BOUNDARY CONTEXTUAL RULES:\n";
- if (contextRulesPool != null)
- result += contextRulesPool.getRulesString("");
- }
- String leftBoundary = TextRulerToolkit.getTypeShortName((new TextRulerTarget(slotNames[0],
- MLTargetType.SINGLE_LEFT_BOUNDARY, this)).getSingleSlotTypeName());
- String rightBoundary = TextRulerToolkit.getTypeShortName((new TextRulerTarget(slotNames[0],
- MLTargetType.SINGLE_RIGHT_BOUNDARY, this)).getSingleSlotTypeName());
- String slotMarkName = TextRulerToolkit.getTypeShortName(slotNames[0]);
- int maxInnerLength = (slotMaximumTokenCount * 3) - 2;
- result += "\n//slot-building rules:\n";
- result += leftBoundary + "{IS(" + rightBoundary + ")->UNMARK(" + leftBoundary + "), UNMARK("
- + rightBoundary + "), MARKONCE(" + slotMarkName + ")};\n";
- result += leftBoundary + "{->UNMARK(" + leftBoundary + ")} ";
- if (maxInnerLength > 0) {
- result += "ANY[0, " + maxInnerLength + "]? ";
- result += rightBoundary + "{->UNMARK(" + rightBoundary + "), MARKONCE(" + slotMarkName
- + ", 1, 3)};\n";
- } else
- result += rightBoundary + "{->UNMARK(" + rightBoundary + "), MARKONCE(" + slotMarkName
- + ", 1, 2)};\n";
+ StringBuilder sb = new StringBuilder();
+ String header = getTMFileHeaderString();
+ sb.append(header);
+
+ for (String eachSlot : slotNames) {
+
+ String leftBoundaryBestRulesString = leftBoundaryBestRulesMap.get(eachSlot);
+ String rightBoundaryBestRulesString = rightBoundaryBestRulesMap.get(eachSlot);
+ String leftBoundaryContextualRulesString = leftBoundaryContextualRulesMap.get(eachSlot);
+ String rightBoundaryContextualRulesString = rightBoundaryContextualRulesMap.get(eachSlot);
+ TextRulerRuleList bestRulesPool = bestRulesPoolMap.get(eachSlot);
+ TextRulerRuleList contextRulesPool = contextRulesPoolMap.get(eachSlot);
+
+ sb.append("\n// Slot: " + TextRulerToolkit.getTypeShortName(eachSlot) + "\n");
+ sb.append("// LEFT BOUNDARY RULES:\n");
+ if (leftBoundaryBestRulesString != null) {
+ sb.append(leftBoundaryBestRulesString);
+ sb.append("\n// RIGHT BOUNDARY RULES:\n");
+ if (rightBoundaryBestRulesString != null)
+ sb.append(rightBoundaryBestRulesString);
+ else if (bestRulesPool != null)
+ sb.append(bestRulesPool.getRulesString(""));
+
+ sb.append("\nBLOCK(contextualRules_" + TextRulerToolkit.getTypeShortName(eachSlot)
+ + ") Document{} {\n"
+ + "\tDocument{->ASSIGN(redoContextualRules, false)}; // reset flag\n");
+ sb.append("\n\t// LEFT BOUNDARY CONTEXTUAL RULES:\n");
+ sb.append(leftBoundaryContextualRulesString);
+
+ sb.append("\n\t// RIGHT BOUNDARY CONTEXTUAL RULES:\n");
+ if (rightBoundaryBestRulesString != null)
+ sb.append(rightBoundaryContextualRulesString);
+ else if (contextRulesPool != null)
+ sb.append(contextRulesPool.getRulesString("\t"));
+
+ sb.append("\n\t//Document{IF(redoContextualRules)->CALL(thisFile.contextualRules_"
+ + TextRulerToolkit.getTypeShortName(eachSlot) + ")};\n}\n");
+ } else if (bestRulesPool != null) {
+ sb.append(bestRulesPool.getRulesString(""));
+ sb.append("\n\t// LEFT BOUNDARY CONTEXTUAL RULES:\n");
+ if (contextRulesPool != null)
+ sb.append(contextRulesPool.getRulesString(""));
+ }
+ }
- result += "\n//cleaning up:\n" + leftBoundary + "{->UNMARK(" + leftBoundary + ")};\n"
- + rightBoundary + "{->UNMARK(" + rightBoundary + ")};\n";
- return result;
+ for (String eachSlot : slotNames) {
+ String leftBoundary = TextRulerToolkit.getTypeShortName((new TextRulerTarget(eachSlot,
+ MLTargetType.SINGLE_LEFT_BOUNDARY, this)).getSingleSlotTypeName());
+ String rightBoundary = TextRulerToolkit.getTypeShortName((new TextRulerTarget(eachSlot,
+ MLTargetType.SINGLE_RIGHT_BOUNDARY, this)).getSingleSlotTypeName());
+ String slotMarkName = TextRulerToolkit.getTypeShortName(eachSlot);
+ int maxInnerLength = (getMaxTokens(eachSlot) * 3) - 2;
+ sb.append("\n//slot-building rules:\n");
+ sb.append(leftBoundary + "{IS(" + rightBoundary + ")->UNMARK(" + leftBoundary + "), UNMARK("
+ + rightBoundary + "), MARKONCE(" + slotMarkName + ")};\n");
+ sb.append(leftBoundary + "{->UNMARK(" + leftBoundary + ")} ");
+ if (maxInnerLength > 0) {
+ sb.append("ANY[0, " + maxInnerLength + "]? ");
+ sb.append(rightBoundary + "{->UNMARK(" + rightBoundary + "), MARKONCE(" + slotMarkName
+ + ", 1, 3)};\n");
+ } else
+ sb.append(rightBoundary + "{->UNMARK(" + rightBoundary + "), MARKONCE(" + slotMarkName
+ + ", 1, 2)};\n");
+
+ sb.append("\n//cleaning up:\n" + leftBoundary + "{->UNMARK(" + leftBoundary + ")};\n"
+ + rightBoundary + "{->UNMARK(" + rightBoundary + ")};\n");
+ }
+
+ return sb.toString();
+ }
+
+ private Integer getMaxTokens(String slot) {
+ if(slotMaximumTokenCountMap.get(slot) == null) {
+ return 0;
+ }
+ return slotMaximumTokenCountMap.get(slot);
}
public void setParameters(Map<String, Object> params) {
@@ -564,11 +575,12 @@ public abstract class BasicLP2 extends T
// check if all helper types are present:
List<String> list = new ArrayList<String>();
- // only the first slot is important for now...
- list.add(new TextRulerTarget(slotNames[0], MLTargetType.SINGLE_LEFT_BOUNDARY, this)
- .getSingleSlotTypeName());
- list.add(new TextRulerTarget(slotNames[0], MLTargetType.SINGLE_RIGHT_BOUNDARY, this)
- .getSingleSlotTypeName());
+ for (String eachSlot : slotNames) {
+ list.add(new TextRulerTarget(eachSlot, MLTargetType.SINGLE_LEFT_BOUNDARY, this)
+ .getSingleSlotTypeName());
+ list.add(new TextRulerTarget(eachSlot, MLTargetType.SINGLE_RIGHT_BOUNDARY, this)
+ .getSingleSlotTypeName());
+ }
boolean result = true;
List<String> missingTypes = new ArrayList<String>();
Modified: uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/NaiveLP2.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/NaiveLP2.java?rev=1452376&r1=1452375&r2=1452376&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/NaiveLP2.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/NaiveLP2.java Mon Mar 4 16:36:37 2013
@@ -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.textmarker.textruler.learner.lp2;
@@ -76,15 +76,16 @@ public class NaiveLP2 extends BasicLP2 {
// testRuleOnDocumentSet(newRule, exampleDocuments);
//
// checkAndHandleNewRule(newRule);
- //
+ //
// if (TextRulerToolkit.DEBUG)
// test.add(newRule);
// }
// new cache and testCAS optimized rule testing:
- sendStatusUpdateToDelegate("Round " + roundNumber + " - Testing " + (genRules.size())
- + "generalizations... - uncovered examples: "
- + (examples.size() - coveredExamples.size() + " / " + examples.size()),
+ sendStatusUpdateToDelegate(
+ "Round " + roundNumber + " - Testing " + (genRules.size())
+ + "generalizations... - uncovered examples: "
+ + (examples.size() - coveredExamples.size() + " / " + examples.size()),
TextRulerLearnerState.ML_RUNNING, false);
testRulesOnDocumentSet(new ArrayList<TextRulerRule>(genRules), exampleDocuments);
@@ -126,9 +127,8 @@ public class NaiveLP2 extends BasicLP2 {
boolean isBestRule = !(tooFewPositives || tooManyErrors);
if (TextRulerToolkit.DEBUG && SAVE_DEBUG_INFO_IN_TEMPFOLDER)
- TextRulerToolkit.appendStringToFile(tempDirectory() + "bestcandidates.tm", rule
- .getRuleString()
- + "\n");
+ TextRulerToolkit.appendStringToFile(tempDirectory() + "bestcandidates.tm",
+ rule.getRuleString() + "\n");
if (isBestRule) {
currentBestRules.add(rule);
@@ -148,14 +148,15 @@ public class NaiveLP2 extends BasicLP2 {
rule = rule.copy();
LP2RuleItem item = rule.getMarkingRuleItem();
// TextRulerToolkit.log("CONTEXTUAL RULE CANDIDATE: "+rule.getRuleString()+" ; "+rule.getCoveringStatistics());
- item.setContextConstraint(new MLLP2ContextConstraint(slotMaximumTokenCount, rule));
+ item.setContextConstraint(new MLLP2ContextConstraint(slotMaximumTokenCountMap.get(rule
+ .getTarget().getSingleSlotRawTypeName()), rule));
rule.setIsContextualRule(true);
rule.setNeedsCompile(true);
if (TextRulerToolkit.DEBUG && SAVE_DEBUG_INFO_IN_TEMPFOLDER)
- TextRulerToolkit.appendStringToFile(tempDirectory() + "ctxcandidates.tm", rule
- .getRuleString());
+ TextRulerToolkit.appendStringToFile(tempDirectory() + "ctxcandidates.tm",
+ rule.getRuleString());
testRuleOnDocumentSet(rule, exampleDocuments); // not very
// fast... but
@@ -210,11 +211,11 @@ public class NaiveLP2 extends BasicLP2 {
.getBegin() : exampleAnnotation.getEnd();
List<AnnotationFS> leftContext = TextRulerToolkit.getAnnotationsBeforePosition(docCas,
- thePosition, windowSize, TextRulerToolkit.getFilterSetWithSlotNames(slotNames,
- filterSet), tokensRootType);
+ thePosition, windowSize,
+ TextRulerToolkit.getFilterSetWithSlotNames(slotNames, filterSet), tokensRootType);
List<AnnotationFS> rightContext = TextRulerToolkit.getAnnotationsAfterPosition(docCas,
- thePosition, windowSize, TextRulerToolkit.getFilterSetWithSlotNames(slotNames,
- filterSet), tokensRootType);
+ thePosition, windowSize,
+ TextRulerToolkit.getFilterSetWithSlotNames(slotNames, filterSet), tokensRootType);
// the left context has to be reversed since we get the arrayList from
// the slot's point of view!
Modified: uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/OptimizedLP2.java
URL: http://svn.apache.org/viewvc/uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/OptimizedLP2.java?rev=1452376&r1=1452375&r2=1452376&view=diff
==============================================================================
--- uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/OptimizedLP2.java (original)
+++ uima/sandbox/textmarker/trunk/textmarker-ep-textruler/src/main/java/org/apache/uima/textmarker/textruler/learner/lp2/OptimizedLP2.java Mon Mar 4 16:36:37 2013
@@ -453,7 +453,8 @@ public class OptimizedLP2 extends BasicL
// tag of the current learning process: (opening/closing tags)
LP2RuleItem ctxItem = new LP2RuleItem();
- MLLP2ContextConstraint ctxConstraint = new MLLP2ContextConstraint(slotMaximumTokenCount,
+ MLLP2ContextConstraint ctxConstraint = new MLLP2ContextConstraint(
+ slotMaximumTokenCountMap.get(aStartRule.getTarget().getSingleSlotRawTypeName()),
aStartRule);
ctxItem.setContextConstraint(ctxConstraint);
LP2Rule ctxStartRule = new LP2Rule(this, aStartRule.getTarget());