You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2011/08/01 16:21:35 UTC

svn commit: r1152792 [1/10] - in /uima/sandbox/trunk/TextMarker: org.apache.uima.tm.textruler.lp2/ org.apache.uima.tm.textruler.lp2/META-INF/ org.apache.uima.tm.textruler.lp2/bin/ org.apache.uima.tm.textruler.lp2/src/ org.apache.uima.tm.textruler.lp2/s...

Author: joern
Date: Mon Aug  1 14:21:12 2011
New Revision: 1152792

URL: http://svn.apache.org/viewvc?rev=1152792&view=rev
Log:
UIMA-2172 Initial commit of the TextMarker contribution.

Added:
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.classpath   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.project   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/META-INF/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/META-INF/MANIFEST.MF   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/bin/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/build.properties   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/plugin.xml   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/BasicLP2.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2CurrentBestRulesQueue.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Plugin.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Rule.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2RuleItem.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/NaiveLP2.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/NaiveLP2Factory.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/NaiveLP2PreferencePage.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/OptimizedLP2.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/OptimizedLP2Factory.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/OptimizedLP2PreferencePage.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/.classpath   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/.project   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/META-INF/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/META-INF/MANIFEST.MF   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/bin/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/build.properties   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/plugin.xml   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/Rapier.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierDebugHelper.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierFactory.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierGeneralizationHelper.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierPatternItemMapping.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierPatternSegment.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierPlugin.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierPreferencePage.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierRule.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierRuleItem.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/src/main/java/org/apache/uima/tm/textruler/rapier/RapierRulePriorityQueue.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/.classpath   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/.project   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/META-INF/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/META-INF/MANIFEST.MF   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/bin/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/build.properties   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/plugin.xml   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/WhiskPlugin.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/generic/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/generic/Whisk.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/generic/WhiskFactory.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/generic/WhiskGenericPreferencePage.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/generic/WhiskRule.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/generic/WhiskRuleItem.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/token/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/token/Whisk.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/token/WhiskFactory.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/token/WhiskRule.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/token/WhiskRuleItem.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/src/main/src/org/apache/uima/tm/textruler/whisk/token/WhiskTokenPreferencePage.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/.classpath   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/.project   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/META-INF/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/META-INF/MANIFEST.MF   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/bin/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/build.properties   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/plugin.xml   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/tm/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/tm/textruler/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/tm/textruler/wien/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/tm/textruler/wien/Wien.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/tm/textruler/wien/WienFactory.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/tm/textruler/wien/WienPlugin.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/tm/textruler/wien/WienRule.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/tm/textruler/wien/WienRuleItem.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/src/src/main/java/org/apache/uima/tm/textruler/wien/WienWordConstraint.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/.classpath   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/.project   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/META-INF/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/META-INF/MANIFEST.MF   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/bin/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/build.properties   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/PlayStop.png   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/add.png   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/config.gif   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/delete.png   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/down.gif   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/feature.gif   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/folder.png   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/folder_edit.png   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/information.gif   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/learner.png   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/lineal.png   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/start.png   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/stop.gif   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/testing.gif   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/icons/up.gif   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/plugin.xml   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/schema/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/schema/de.uniwue.tm.textruler.learner.exsd   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/TextRulerPlugin.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/CasCache.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/CasCacheLoader.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/GlobalCASSource.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerAnnotation.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerBasicLearner.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerExample.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerExampleDocument.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerExampleDocumentSet.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerMultiSlotRule.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerRule.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerRuleItem.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerRuleList.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerRulePattern.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerShiftExample.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerSingleSlotRule.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerSlotPattern.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerStatisticsCollector.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerTarget.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerToolkit.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/core/TextRulerWordConstraint.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/TextRulerController.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/TextRulerControllerDelegate.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/TextRulerLearner.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/TextRulerLearnerController.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/TextRulerLearnerDelegate.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/TextRulerLearnerFactory.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/TextRulerLearnerParameter.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/TextRulerPreprocessor.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/extension/TextRulerPreprocessorDelegate.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/preferences/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/preferences/AlgorithmPreferencePage.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/preferences/ConfigPreferencePage.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/tools/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/tools/BatchRuleEvaluator.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/tools/BatchRuleScorer.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/tools/F1Scorer.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/tools/MemoryWatch.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/tools/SGMLToXMIConverter.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/tools/TestSetGenerator.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/AddRemoveList.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/ConfigureLearnersHandler.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/LearnerConfigurator.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/SelectTypesDialog.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/StartHandler.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/StartStopHandler.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/StopHandler.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/TextRulerResultsView.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/TextRulerView.java   (with props)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/src/main/java/org/apache/uima/tm/textruler/ui/TextRulerViewComposite.java   (with props)
Modified:
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/   (props changed)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/   (props changed)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.rapier/   (props changed)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.whisk/   (props changed)
    uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.wien/   (props changed)

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug  1 14:21:12 2011
@@ -0,0 +1 @@
+.settings

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug  1 14:21:12 2011
@@ -0,0 +1 @@
+.settings

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.classpath
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.classpath?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.classpath (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.classpath Mon Aug  1 14:21:12 2011
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.classpath
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.classpath
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.project
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.project?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.project (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.project Mon Aug  1 14:21:12 2011
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.apache.uima.tm.textruler.lp2</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.project
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/.project
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/META-INF/MANIFEST.MF?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/META-INF/MANIFEST.MF (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/META-INF/MANIFEST.MF Mon Aug  1 14:21:12 2011
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TextRuler LP2 Plugin
+Bundle-SymbolicName: org.apache.uima.tm.textruler.lp2;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.apache.uima.tm.textruler.lp2.LP2Plugin
+Bundle-Vendor: University of Würzburg
+Require-Bundle: org.eclipse.core.runtime,
+ org.apache.uima.tm.textruler,
+ org.apache.uima.runtime;bundle-version="2.3.0",
+ org.eclipse.ui
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/build.properties
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/build.properties?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/build.properties (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/build.properties Mon Aug  1 14:21:12 2011
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/build.properties
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/build.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/plugin.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/plugin.xml?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/plugin.xml (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/plugin.xml Mon Aug  1 14:21:12 2011
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.apache.uima.tm.textruler.learners">
+      <learner
+            class="org.apache.uima.tm.textruler.lp2.OptimizedLP2Factory"
+            id="org.apache.uima.tm.textruler.lp2opt"
+            name="LP2 (optimized)">
+      </learner>
+      <learner
+            class="org.apache.uima.tm.textruler.lp2.NaiveLP2Factory"
+            id="org.apache.uima.tm.textruler.lp2naive"
+            name="LP2 (naive)">
+      </learner>
+   </extension>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            category="org.apache.uima.tm.textruler"
+            class="org.apache.uima.tm.textruler.lp2.NaiveLP2PreferencePage"
+            id="org.apache.uima.tm.textruler.lp2naive"
+            name="LP2 (naive)">
+      </page>
+      <page
+            category="org.apache.uima.tm.textruler"
+            class="org.apache.uima.tm.textruler.lp2.OptimizedLP2PreferencePage"
+            id="org.apache.uima.tm.textruler.lp2opt"
+            name="LP2 (optimized)">
+      </page>
+   </extension>
+
+</plugin>

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/plugin.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/plugin.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/BasicLP2.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/BasicLP2.java?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/BasicLP2.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/BasicLP2.java Mon Aug  1 14:21:12 2011
@@ -0,0 +1,560 @@
+package org.apache.uima.tm.textruler.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 org.apache.uima.cas.CAS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.tm.textruler.core.TextRulerAnnotation;
+import org.apache.uima.tm.textruler.core.TextRulerBasicLearner;
+import org.apache.uima.tm.textruler.core.TextRulerExample;
+import org.apache.uima.tm.textruler.core.TextRulerExampleDocument;
+import org.apache.uima.tm.textruler.core.TextRulerRule;
+import org.apache.uima.tm.textruler.core.TextRulerRuleList;
+import org.apache.uima.tm.textruler.core.TextRulerShiftExample;
+import org.apache.uima.tm.textruler.core.TextRulerStatisticsCollector;
+import org.apache.uima.tm.textruler.core.TextRulerTarget;
+import org.apache.uima.tm.textruler.core.TextRulerToolkit;
+import org.apache.uima.tm.textruler.core.TextRulerTarget.MLTargetType;
+import org.apache.uima.tm.textruler.extension.TextRulerLearnerDelegate;
+import org.apache.uima.util.FileUtils;
+
+public abstract class BasicLP2 extends TextRulerBasicLearner {
+
+  public static final String WINDOW_SIZE_KEY = "windowSize";
+
+  public static final String CURRENT_BEST_RULES_SIZE_KEY = "currentBestRulesSize";
+
+  public static final String CURRENT_CONTEXTUAL_RULES_SIZE_KEY = "currentContextualRulesSize";
+
+  public static final String MIN_COVERED_POSITIVES_PER_RULE_KEY = "minCoveredPositivesPerRule";
+
+  public static final String MAX_ERROR_THRESHOLD_KEY = "maxErrorThreshold";
+
+  public static final int STANDARD_WINDOW_SIZE = 2;
+
+  public static final int STANDARD_MAX_CURRENT_BEST_RULES_COUNT = 4;
+
+  public static final int STANDARD_MAX_CONTEXTUAL_RULES_COUNT = 4;
+
+  public static final int STANDARD_MIN_COVERED_POSITIVES_PER_RULE = 1;
+
+  public static final float STANDARD_MAX_ERROR_THRESHOLD = 0.1f;
+
+  public static final String CORRECTION_ANNOTATION_NAME = "lp2shift";
+
+  private static final int STANDARD_SHIFT_SIZE = 2;
+
+  protected int maxCurrentBestRulesCount = STANDARD_MAX_CURRENT_BEST_RULES_COUNT;
+
+  protected int maxCurrentContextualRulesCount = STANDARD_MAX_CONTEXTUAL_RULES_COUNT;
+
+  protected int windowSize = STANDARD_WINDOW_SIZE;
+
+  protected int shiftSize = STANDARD_SHIFT_SIZE;
+
+  protected int minCoveredPositives = STANDARD_MIN_COVERED_POSITIVES_PER_RULE;
+
+  protected float maxErrorThreshold = STANDARD_MAX_ERROR_THRESHOLD;
+
+  protected List<TextRulerExample> examples;
+
+  protected Set<TextRulerExample> coveredExamples;
+
+  protected int slotMaximumTokenCount = 0;
+
+  protected LP2CurrentBestRulesQueue currentBestRules;
+
+  protected LP2CurrentBestRulesQueue currentContextualRules;
+
+  protected TextRulerRuleList bestRulesPool;
+
+  protected TextRulerRuleList contextRulesPool;
+
+  protected String leftBoundaryBestRulesString = null;
+
+  protected String rightBoundaryBestRulesString = null;
+
+  protected String leftBoundaryContextualRulesString = null;
+
+  protected String rightBoundaryContextualRulesString = null;
+
+  public BasicLP2(String inputDir, String prePropTMFile, String tmpDir, String[] slotNames,
+          Set<String> filterSet, TextRulerLearnerDelegate delegate) {
+    super(inputDir, prePropTMFile, tmpDir, slotNames, filterSet, delegate);
+  }
+
+  protected TextRulerRuleList learnTaggingRules(TextRulerTarget target,
+          TextRulerRuleList contextualRules) {
+    if (target.type == MLTargetType.SINGLE_LEFT_BOUNDARY)
+      sendStatusUpdateToDelegate("Creating Left-Boundary Examples...",
+              TextRulerLearnerState.ML_RUNNING, false);
+    else if (target.type == MLTargetType.SINGLE_RIGHT_BOUNDARY)
+      sendStatusUpdateToDelegate("Creating Right-Boundary Examples...",
+              TextRulerLearnerState.ML_RUNNING, false);
+    else if (target.type == MLTargetType.SINGLE_LEFT_CORRECTION)
+      sendStatusUpdateToDelegate("Creating Left Correction Examples...",
+              TextRulerLearnerState.ML_RUNNING, false);
+    else
+      // if (target.type == MLTargetType.SINGLE_RIGHT_CORRECTION)
+      sendStatusUpdateToDelegate("Creating Right Correction Examples...",
+              TextRulerLearnerState.ML_RUNNING, false);
+    exampleDocuments.clearCurrentExamples();
+    exampleDocuments.createExamplesForTarget(target);
+    examples = exampleDocuments.getAllPositiveExamples();
+
+    if (shouldAbort())
+      return null;
+    bestRulesPool = new TextRulerRuleList();
+    contextRulesPool = new TextRulerRuleList();
+    coveredExamples = new HashSet<TextRulerExample>();
+    int roundNumber = 0;
+    for (TextRulerExample e : examples)
+      if (!coveredExamples.contains(e)) {
+        if (shouldAbort())
+          break;
+        roundNumber++;
+        currentBestRules = new LP2CurrentBestRulesQueue(maxCurrentBestRulesCount);
+        currentContextualRules = new LP2CurrentBestRulesQueue(maxCurrentContextualRulesCount);
+        // TextRulerToolkit.log("Example: "+e.getAnnotation().getBegin()+" : "+e.getAnnotation().getEnd());
+
+        induceRulesFromExample(e, roundNumber);
+
+        // TextRulerToolkit.log("Best Rules from this Seed: "+currentBestRules.size());
+        // if (TextRulerToolkit.DEBUG && currentBestRules.size()>1)
+        // {
+        // for (TextRulerRule r : currentBestRules)
+        // {
+        // TextRulerToolkit.log("\tp="+r.getCoveringStatistics().getCoveredPositivesCount()+"; n="+r.getCoveringStatistics().getCoveredNegativesCount()+";  "+r.getRuleString());
+        // for (TextRulerExample ex :
+        // r.getCoveringStatistics().getCoveredPositiveExamples())
+        // {
+        // TextRulerToolkit.log("\t\te="+ex.getAnnotation().getBegin());
+        //							
+        // }
+        // }
+        // }
+        for (LP2Rule bestRule : currentBestRules) {
+          addToFinalBestRulesPool(bestRule);
+        }
+        for (LP2Rule ctxRule : currentContextualRules) {
+          addToFinalContextRulesPool(ctxRule);
+        }
+        sendStatusUpdateToDelegate("New Rules added.", TextRulerLearnerState.ML_RUNNING, true);
+      }
+    if (TextRulerToolkit.DEBUG) {
+      bestRulesPool.saveToRulesFile(getIntermediateRulesFileName(), getTMFileHeaderString());
+      // for (TextRulerRule r : bestRulesPool)
+      // {
+      // TextRulerToolkit.log("p="+r.getCoveringStatistics().getCoveredPositivesCount()+"; n="+r.getCoveringStatistics().getCoveredNegativesCount()+";  "+r.getRuleString());
+      // }
+    }
+
+    TextRulerRuleList result = bestRulesPool;
+    if (contextualRules != null)
+      for (TextRulerRule r : contextRulesPool)
+        contextualRules.add(r);
+    bestRulesPool = null;
+    contextRulesPool = null;
+    return result;
+  }
+
+  @Override
+  public CAS loadCAS(String fileName, CAS reuseCAS) {
+    CAS cas = super.loadCAS(fileName, reuseCAS);
+    prepareCASWithBoundaries(cas);
+    return cas;
+  }
+
+  public void prepareCASWithBoundaries(CAS cas) {
+    for (String slotName : slotNames)
+      TextRulerExampleDocument.createBoundaryAnnotationsForCas(cas, slotName, filterSet);
+  }
+
+  public void prepareCachedCASesWithBoundaries() {
+    for (CAS cas : exampleDocuments.getCachedCASes())
+      prepareCASWithBoundaries(cas);
+  }
+
+  @Override
+  protected void cleanUp() {
+    super.cleanUp();
+    examples = null;
+    coveredExamples = null;
+    currentBestRules = null;
+    currentContextualRules = null;
+    bestRulesPool = null;
+    contextRulesPool = null;
+  }
+
+  @Override
+  protected void doRun() {
+    TextRulerToolkit.logIfDebug("--- LP2 START");
+
+    prepareCachedCASesWithBoundaries(); // if some cases are already loaded,
+    // prepare them! all others get prepared when loaded (see loadCAS)
+
+    for (int i = 0; i < slotNames.length; i++) {
+      runForSlotName(slotNames[i]);
+    }
+
+    sendStatusUpdateToDelegate("Done", TextRulerLearnerState.ML_DONE, true);
+    TextRulerToolkit.logIfDebug("--- LP2 END");
+  }
+
+  protected void runForSlotName(String slotName) {
+    // 1. get slot length histogram in order to find maximum slot length
+    // (counted in tokens)
+
+    sendStatusUpdateToDelegate("Creating slot length histogram...",
+            TextRulerLearnerState.ML_RUNNING, false);
+    List<Integer> histogram = exampleDocuments.getTokenCountHistogrammForSlotName(slotName,
+            TextRulerToolkit.getFilterSetWithSlotNames(slotNames, filterSet));
+    if (shouldAbort())
+      return;
+    slotMaximumTokenCount = histogram.size() - 1; // -1 since the
+    // zero-histogram point
+    // also needs a place!
+
+    TextRulerRuleList ctxRules = new TextRulerRuleList();
+    TextRulerRuleList bestRules = learnTaggingRules(new TextRulerTarget(slotName,
+            MLTargetType.SINGLE_LEFT_BOUNDARY, this), ctxRules); // learn
+    // left
+    // boundary
+    // best
+    // rules
+    if (bestRules != null) {
+      leftBoundaryBestRulesString = bestRules.getRulesString("");
+      leftBoundaryContextualRulesString = ctxRules.getRulesString("\t");
+      bestRules.clear(); // free som memory/references
+    }
+    if (shouldAbort())
+      return;
+    ctxRules.clear();
+    bestRules = learnTaggingRules(new TextRulerTarget(slotName, MLTargetType.SINGLE_RIGHT_BOUNDARY,
+            this), ctxRules); // learn
+    // right
+    // boundary best
+    // rules
+    if (bestRules != null) {
+      rightBoundaryBestRulesString = bestRules.getRulesString("");
+      rightBoundaryContextualRulesString = 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 de.uniwue.ml;\n\nDocument{->FILTERTYPE(SPACE, BREAK, NBSP, MARKUP)};\n";
+      // resultString += "NUM{REGEXP(\"12\")} ALL{->MARKONCE(stimeSTART)};";
+      FileUtils.saveString2File(resultString, file);
+    } catch (IOException e) {
+      // TODO send text to ui
+    }
+
+    // correct left start
+    TextRulerTarget lsTarget = new TextRulerTarget(slotName, MLTargetType.SINGLE_LEFT_CORRECTION,
+            this);
+    lsTarget.setMaxShiftDistance(shiftSize);
+    TextRulerRuleList correctLeftRules = learnTaggingRules(lsTarget, null);
+
+    // resultString = "CAP{REGEXP(\"PM\")} ALL{->MARKONCE(stimeEND)};";
+    // try {
+    // FileUtils.saveString2File(resultString, file);
+    // } catch (IOException e) {
+    // // TODO Auto-generated catch block
+    // e.printStackTrace();
+    // }
+
+    // correct right start
+    // TextRulerTarget rsTarget = new TextRulerTarget(slotName,
+    // MLTargetType.SINGLE_RIGHT_CORRECTION,
+    // this);
+    // rsTarget.setMaxShiftDistance(shiftSize);
+    // TextRulerRuleList correctRightRules = learnTaggingRules(rsTarget, null);
+    //
+    sendStatusUpdateToDelegate("SLOT Done", TextRulerLearnerState.ML_RUNNING, true);
+    TextRulerToolkit.logIfDebug("--- LP2 END FOR SLOT:" + slotName);
+  }
+
+  protected abstract void induceRulesFromExample(TextRulerExample e, int roundNumber);
+
+  protected void addToFinalContextRulesPool(LP2Rule rule) {
+    if (TextRulerToolkit.DEBUG && false)
+      TextRulerToolkit.appendStringToFile(tempDirectory() + "ctxpool.tm", rule.getRuleString()
+              + "\n");
+
+    if (!contextRulesPool.contains(rule)) {
+      contextRulesPool.add(rule);
+      // TextRulerToolkit.log("CONTEXT RULE: "+rule.getRuleString()+" ; "+rule.getCoveringStatistics());
+    } else {
+      if (TextRulerToolkit.DEBUG && false) {
+        TextRulerToolkit.appendStringToFile(tempDirectory() + "ctxpool.tm", "\tDUPLICATE\n");
+      }
+    }
+
+  }
+
+  protected void addToFinalBestRulesPool(LP2Rule rule) {
+    if (TextRulerToolkit.DEBUG && false)
+      TextRulerToolkit.appendStringToFile(tempDirectory() + "bestpool.tm", rule.getRuleString()
+              + "\n");
+
+    if (!bestRulesPool.contains(rule)) {
+      bestRulesPool.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());
+    } else {
+      if (TextRulerToolkit.DEBUG && false) {
+        TextRulerToolkit.log("KANN SOWAS PASSIEREN ??");
+        TextRulerToolkit.appendStringToFile(tempDirectory() + "bestpool.tm", "\tDUPLICATE\n");
+      }
+    }
+
+  }
+
+  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";
+
+    result += "\n//cleaning up:\n" + leftBoundary + "{->UNMARK(" + leftBoundary + ")};\n"
+            + rightBoundary + "{->UNMARK(" + rightBoundary + ")};\n";
+    return result;
+  }
+
+  public void setParameters(Map<String, Object> params) {
+    if (TextRulerToolkit.DEBUG)
+      saveParametersToTempFolder(params);
+
+    // TODO try catch
+    if (params.containsKey(WINDOW_SIZE_KEY))
+      windowSize = (Integer) params.get(WINDOW_SIZE_KEY);
+
+    if (params.containsKey(CURRENT_BEST_RULES_SIZE_KEY))
+      maxCurrentBestRulesCount = (Integer) params.get(CURRENT_BEST_RULES_SIZE_KEY);
+
+    if (params.containsKey(CURRENT_CONTEXTUAL_RULES_SIZE_KEY))
+      maxCurrentContextualRulesCount = (Integer) params.get(CURRENT_CONTEXTUAL_RULES_SIZE_KEY);
+
+    if (params.containsKey(MIN_COVERED_POSITIVES_PER_RULE_KEY))
+      minCoveredPositives = (Integer) params.get(MIN_COVERED_POSITIVES_PER_RULE_KEY);
+
+    if (params.containsKey(MAX_ERROR_THRESHOLD_KEY))
+      maxErrorThreshold = (Float) params.get(MAX_ERROR_THRESHOLD_KEY);
+  }
+
+  protected String correctionRulesInputDirectory(TextRulerTarget target) {
+    if (target.isLeftBoundary())
+      return tempDirectory() + "leftCorrectionDocs";
+    else
+      return tempDirectory() + "rightCorrectionDocs";
+  }
+
+  protected boolean testTaggingRulesAndCreateCorrectionRulesExamples(TextRulerTarget target,
+          int maxDistance) {
+    try {
+      File dir = new File(correctionRulesInputDirectory(target));
+      if (!dir.exists())
+        dir.mkdir();
+      exampleDocuments.clearCurrentExamples();
+      exampleDocuments.createExamplesForTarget(target);
+      examples = exampleDocuments.getAllPositiveExamples();
+
+      TextRulerExampleDocument[] sortedDocs = exampleDocuments
+              .getSortedDocumentsInCacheOptimizedOrder();
+      TypeSystem ts = sortedDocs[0].getCAS().getTypeSystem();
+      Type tokensRootType = ts.getType(TextRulerToolkit.TM_ANY_TYPE_NAME);
+
+      // String allRulesContent = getResultString();
+      String allRulesContent = FileUtils.file2String(new File("/testinput/testrules/rules.tm"));
+      FileUtils.saveString2File(allRulesContent, new File(getTempRulesFileName()));
+
+      CAS testCAS = getTestCAS();
+      for (TextRulerExampleDocument doc : sortedDocs) {
+        TextRulerStatisticsCollector c = new TextRulerStatisticsCollector();
+        doc.resetAndFillTestCAS(testCAS, target);
+        CAS docCAS = doc.getCAS();
+        ae.process(testCAS);
+        compareOriginalDocumentWithTestCAS(doc, testCAS, target, c, true); // test whole ruleset and
+        // collect negative
+        // examples
+
+        // now we have some covered positive examples that are good, and
+        // maybe some negative examples
+        // for that we might create Correction Rules... in order to do
+        // that we have to create
+        // ShiftExamples and map negative examples (incorrect inserted
+        // boundaries) with a specific
+        // distance to an original positive example...
+
+        // TODO should that be done in both directions ? left and right
+        // ?! what happes if we
+        // find two potential examples, one left, one right ? --> for
+        // now: use the nearer one. if
+        // exactly the same distance, use the one where the wrong tag
+        // would be IN the slot filler!
+        List<TextRulerExample> correctTags = doc.getPositiveExamples();
+        List<TextRulerExample> wrongTags = new ArrayList<TextRulerExample>(c
+                .getCoveredNegativeExamples());
+        List<TextRulerShiftExample> newExamples = new ArrayList<TextRulerShiftExample>();
+        for (TextRulerExample wrongTag : wrongTags) {
+          // test, if there's a corresponding positive example
+          // somewhere around (within maxDistance)
+          List<AnnotationFS> left = TextRulerToolkit.getAnnotationsBeforePosition(docCAS, wrongTag
+                  .getAnnotation().getBegin(), maxDistance, TextRulerToolkit
+                  .getFilterSetWithSlotNames(slotNames, filterSet), tokensRootType);
+          List<AnnotationFS> right = TextRulerToolkit.getAnnotationsAfterPosition(docCAS, wrongTag
+                  .getAnnotation().getEnd(), maxDistance, TextRulerToolkit
+                  .getFilterSetWithSlotNames(slotNames, filterSet), tokensRootType);
+
+          // TODO stop after the first found match or create one bad
+          // example for each found occurence ??!!
+          // for now: stop after one ! so create only ONE bad
+          // example...
+          int leftDistance = 0;
+          TextRulerExample leftCorrectTag = null;
+          for (int i = left.size() - 1; i >= 0; i--) {
+            leftDistance++;
+            TextRulerAnnotation needle = TextRulerToolkit.convertToTargetAnnotation(left.get(i),
+                    doc, target, docCAS.getTypeSystem());
+            leftCorrectTag = TextRulerToolkit.exampleListContainsAnnotation(correctTags, needle);
+            if (leftCorrectTag != null)
+              break;
+          }
+
+          int rightDistance = 0;
+          TextRulerExample rightCorrectTag = null;
+          for (AnnotationFS fs : right) {
+            rightDistance++;
+            TextRulerAnnotation needle = TextRulerToolkit.convertToTargetAnnotation(fs, doc,
+                    target, docCAS.getTypeSystem());
+            rightCorrectTag = TextRulerToolkit.exampleListContainsAnnotation(correctTags, needle);
+            if (rightCorrectTag != null)
+              break;
+          }
+
+          TextRulerExample theCorrectTag = null;
+          if (rightDistance < leftDistance && rightCorrectTag != null)
+            theCorrectTag = rightCorrectTag;
+          else if (rightDistance > leftDistance && leftCorrectTag != null)
+            theCorrectTag = leftCorrectTag;
+          else // use the one that would lie in the slot filler:
+          {
+            if (target.type == MLTargetType.SINGLE_LEFT_BOUNDARY && rightCorrectTag != null)
+              theCorrectTag = rightCorrectTag;
+            else
+              theCorrectTag = leftCorrectTag;
+          }
+
+          if (theCorrectTag != null) {
+            TextRulerToolkit.log("FOUND BAD EXAMPLE FOR SHIFTING !!");
+            TextRulerShiftExample shiftExample = new TextRulerShiftExample(doc, wrongTag
+                    .getAnnotation(), theCorrectTag.getAnnotation(), true, target);
+            newExamples.add(shiftExample);
+          }
+        }
+        TextRulerToolkit
+                .writeCAStoXMIFile(testCAS, dir + File.pathSeparator + doc.getCasFileName());
+      }
+      testCAS.reset();
+    } catch (Exception e) {
+      e.printStackTrace();
+      return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public String getTMFileHeaderString() {
+    return super.getTMFileHeaderString() + "BOOLEAN redoContextualRules;\n\n";
+  }
+
+  @Override
+  protected boolean checkForMandatoryTypes() {
+    if (!super.checkForMandatoryTypes())
+      return false;
+
+    CAS someCas = getTestCAS();
+    TypeSystem ts = someCas.getTypeSystem();
+    // 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());
+
+    // TODO add correction types here!
+    for (String s : list) {
+      if (ts.getType(s) == null)
+        return false;
+    }
+    return true;
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/BasicLP2.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/BasicLP2.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2CurrentBestRulesQueue.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2CurrentBestRulesQueue.java?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2CurrentBestRulesQueue.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2CurrentBestRulesQueue.java Mon Aug  1 14:21:12 2011
@@ -0,0 +1,159 @@
+package org.apache.uima.tm.textruler.lp2;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.PriorityQueue;
+
+import org.apache.uima.tm.textruler.core.TextRulerToolkit;
+
+public class LP2CurrentBestRulesQueue implements Iterable<LP2Rule> {
+
+  private PriorityQueue<LP2Rule> ruleList;
+
+  private PriorityQueue<LP2Rule> reverseRuleList;
+
+  private int maxSize;
+
+  private static int cmpRules(LP2Rule o1, LP2Rule o2) {
+    // 1st criterion: sort by decreasing number of positive matches:
+    if (o1.getCoveringStatistics().getCoveredPositivesCount() > o2.getCoveringStatistics()
+            .getCoveredPositivesCount())
+      return -1;
+    else if (o1.getCoveringStatistics().getCoveredPositivesCount() < o2.getCoveringStatistics()
+            .getCoveredPositivesCount())
+      return 1;
+    else {
+      // 2nd criterion: sort by increasing error rate:
+      if (o1.getErrorRate() < o2.getErrorRate())
+        return -1;
+      else if (o1.getErrorRate() > o2.getErrorRate())
+        return 1;
+      else {
+        // 3rd criterion:
+        // TODO:
+        // if one rule has more positive matches than a threshold then
+        // prefere the one with more generic
+        // conditions; else prefer the other one.
+
+        // test for now: prefer more general rules !
+        int c1 = o1.totalConstraintCount();
+        int c2 = o2.totalConstraintCount();
+        if (c1 < c2)
+          return -1;
+        else if (c1 > c2)
+          return 1;
+        else {
+          return o1.getRuleString().compareTo(o2.getRuleString());
+        }
+      }
+    }
+
+  }
+
+  public LP2CurrentBestRulesQueue(int maxSize) {
+    this.maxSize = Math.max(1, maxSize);
+
+    ruleList = new PriorityQueue<LP2Rule>(this.maxSize, new Comparator<LP2Rule>() {
+      public int compare(LP2Rule o1, LP2Rule o2) {
+        return cmpRules(o1, o2);
+      }
+    });
+    this.reverseRuleList = new PriorityQueue<LP2Rule>(this.maxSize, new Comparator<LP2Rule>() {
+      public int compare(LP2Rule o1, LP2Rule o2) {
+        return -cmpRules(o1, o2);
+      }
+    });
+  }
+
+  public Iterator<LP2Rule> iterator() {
+    return ruleList.iterator();
+  }
+
+  public void clear() {
+    ruleList.clear();
+    reverseRuleList.clear();
+  }
+
+  public void addAll(Collection<LP2Rule> rules) {
+    for (LP2Rule r : rules)
+      add(r);
+  }
+
+  public void add(LP2Rule rule) {
+    ruleList.add(rule);
+    reverseRuleList.add(rule);
+    // TextRulerToolkit.log("ADD TO RULE LIST, SIZE="+ruleList.size()+"    revSize="+reverseRuleList.size());
+    // for (LP2Rule r : ruleList)
+    // {
+    // TextRulerToolkit.log("Rule Value: "+r.getPriority()+"  peek: "+ruleList.peek().getPriority());
+    // }
+  }
+
+  public boolean contains(LP2Rule rule) {
+    return ruleList.contains(rule);
+  }
+
+  // returns the removed objects
+  public Collection<LP2Rule> cutToMaxSize() {
+    ArrayList<LP2Rule> result = new ArrayList<LP2Rule>();
+    while (ruleList.size() > maxSize) {
+      Object tail = reverseRuleList.peek();
+      ruleList.remove(tail);
+      reverseRuleList.remove(tail);
+      result.add((LP2Rule) tail);
+    }
+    return result;
+  }
+
+  public LP2Rule peek() {
+    return ruleList.peek();
+  }
+
+  public void remove(LP2Rule r) {
+    ruleList.remove(r);
+    reverseRuleList.remove(r);
+  }
+
+  public LP2Rule[] toArray() {
+    LP2Rule[] result = new LP2Rule[ruleList.size()];
+    int i = 0;
+    for (LP2Rule r : ruleList) {
+      result[i] = r;
+      i++;
+    }
+    return result;
+  }
+
+  protected void removeSubsumedRules() {
+    ArrayList<LP2Rule> removeList = new ArrayList<LP2Rule>();
+    LP2Rule[] rulesArray = toArray();
+    for (int index1 = 0; index1 < rulesArray.length - 1; index1++) {
+      LP2Rule rule1 = rulesArray[index1];
+      for (int index2 = index1 + 1; index2 < rulesArray.length; index2++) {
+        LP2Rule rule2 = rulesArray[index2];
+        if (rule1.getCoveringStatistics().getCoveredPositiveExamples().containsAll(
+                rule2.getCoveringStatistics().getCoveredPositiveExamples()))
+          removeList.add(rule2);
+      }
+
+    }
+    // if (TextRulerToolkit.DEBUG && removeList.size() > 0)
+    // TextRulerToolkit.log("[removeSubsumedRules] REMOVED "+removeList.size()+" RULES");
+    for (LP2Rule r : removeList)
+      remove(r);
+  }
+
+  public void printDebug() {
+    TextRulerToolkit.log("-------CURRENT BEST RULES:");
+    for (LP2Rule r : ruleList) {
+      TextRulerToolkit.log(r.getRuleString() + " " + r.getCoveringStatistics() + "  error="
+              + r.getErrorRate() + "  constraints=" + r.totalConstraintCount());
+    }
+  }
+
+  public int size() {
+    return ruleList.size();
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2CurrentBestRulesQueue.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2CurrentBestRulesQueue.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Plugin.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Plugin.java?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Plugin.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Plugin.java Mon Aug  1 14:21:12 2011
@@ -0,0 +1,54 @@
+package org.apache.uima.tm.textruler.lp2;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class LP2Plugin extends Plugin {
+
+  // The plug-in ID
+  public static final String PLUGIN_ID = "org.apache.uima.tm.textruler.lp2";
+
+  // The shared instance
+  private static LP2Plugin plugin;
+
+  /**
+   * The constructor
+   */
+  public LP2Plugin() {
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+   */
+  @Override
+  public void start(BundleContext context) throws Exception {
+    super.start(context);
+    plugin = this;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+   */
+  @Override
+  public void stop(BundleContext context) throws Exception {
+    plugin = null;
+    super.stop(context);
+  }
+
+  /**
+   * Returns the shared instance
+   * 
+   * @return the shared instance
+   */
+  public static LP2Plugin getDefault() {
+    return plugin;
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Plugin.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Plugin.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Rule.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Rule.java?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Rule.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Rule.java Mon Aug  1 14:21:12 2011
@@ -0,0 +1,107 @@
+package org.apache.uima.tm.textruler.lp2;
+
+import org.apache.uima.tm.textruler.core.TextRulerBasicLearner;
+import org.apache.uima.tm.textruler.core.TextRulerRuleItem;
+import org.apache.uima.tm.textruler.core.TextRulerSingleSlotRule;
+import org.apache.uima.tm.textruler.core.TextRulerStatisticsCollector;
+import org.apache.uima.tm.textruler.core.TextRulerTarget;
+import org.apache.uima.tm.textruler.core.TextRulerToolkit;
+import org.apache.uima.tm.textruler.core.TextRulerTarget.MLTargetType;
+
+public class LP2Rule extends TextRulerSingleSlotRule {
+
+  protected float errorRate;
+
+  protected boolean setIsPreFillerStartRule = false;
+
+  protected boolean isContextualRule = false;
+
+  public LP2Rule(TextRulerBasicLearner parentAlgorithm, TextRulerTarget target) {
+    super(parentAlgorithm, target);
+
+  }
+
+  // copy constructor:
+  protected LP2Rule(LP2Rule copyFrom) {
+    super(copyFrom);
+    errorRate = copyFrom.errorRate;
+    setIsPreFillerStartRule = copyFrom.setIsPreFillerStartRule;
+    isContextualRule = copyFrom.isContextualRule;
+  }
+
+  @Override
+  public LP2Rule copy() {
+    return new LP2Rule(this);
+  }
+
+  @Override
+  public void setCoveringStatistics(TextRulerStatisticsCollector c) {
+    super.setCoveringStatistics(c);
+    int p = c.getCoveredPositivesCount();
+    int n = c.getCoveredNegativesCount();
+    if (p < 1) {
+      TextRulerToolkit.log("ERROR, A RULE MAY NOT COVER ZERO POSITIVE EXAMPLES! WHAT'S WRONG ?");
+      TextRulerToolkit.log("\tRULE: " + getRuleString());
+      // make sure this rule is rated totally bad:
+      errorRate = Float.MAX_VALUE;
+    } else {
+      errorRate = ((float) n) / ((float) p);
+    }
+  }
+
+  public float getErrorRate() {
+    return errorRate;
+  }
+
+  public int totalConstraintCount() {
+    int result = 0;
+    // every item itself counts 1 (so a wildcard "ANY" item counts also as a
+    // constraint, since it says: HERE HAS TO BE A TOKEN!)
+    // and every constraint on that token also counts 1.
+    for (TextRulerRuleItem i : slotPattern.preFillerPattern)
+      result += 1 + ((LP2RuleItem) i).totalConstraintCount();
+    for (TextRulerRuleItem i : slotPattern.postFillerPattern)
+      result += 1 + ((LP2RuleItem) i).totalConstraintCount();
+    return result;
+  }
+
+  public int totalInnerConstraintCount() // counts only the constraints in the
+  // items, but does not count the
+  // items as a constraint themselves!
+  {
+    int result = 0;
+    for (TextRulerRuleItem i : slotPattern.preFillerPattern)
+      result += ((LP2RuleItem) i).totalConstraintCount();
+    for (TextRulerRuleItem i : slotPattern.postFillerPattern)
+      result += ((LP2RuleItem) i).totalConstraintCount();
+    return result;
+  }
+
+  public boolean isPreFillerStartRule() {
+    return setIsPreFillerStartRule;
+  }
+
+  public void setIsPreFillerStartRule(boolean flag) {
+    setIsPreFillerStartRule = flag;
+  }
+
+  public LP2RuleItem getMarkingRuleItem() {
+    if (target.type == MLTargetType.SINGLE_LEFT_BOUNDARY)
+      return (LP2RuleItem) slotPattern.postFillerPattern.get(0);
+    else
+      return (LP2RuleItem) slotPattern.preFillerPattern
+              .get(slotPattern.preFillerPattern.size() - 1);
+  }
+
+  public boolean isContextualRule() {
+    return isContextualRule;
+  }
+
+  public void setIsContextualRule(boolean flag) {
+    if (flag != isContextualRule) {
+      isContextualRule = flag;
+      setNeedsCompile(true);
+    }
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Rule.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2Rule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2RuleItem.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2RuleItem.java?rev=1152792&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2RuleItem.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2RuleItem.java Mon Aug  1 14:21:12 2011
@@ -0,0 +1,283 @@
+package org.apache.uima.tm.textruler.lp2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.tm.textruler.core.TextRulerAnnotation;
+import org.apache.uima.tm.textruler.core.TextRulerRule;
+import org.apache.uima.tm.textruler.core.TextRulerRuleItem;
+import org.apache.uima.tm.textruler.core.TextRulerSingleSlotRule;
+import org.apache.uima.tm.textruler.core.TextRulerToolkit;
+import org.apache.uima.tm.textruler.core.TextRulerWordConstraint;
+import org.apache.uima.tm.textruler.core.TextRulerTarget.MLTargetType;
+
+public class LP2RuleItem implements TextRulerRuleItem {
+
+  protected TextRulerWordConstraint wordConstraint;
+
+  protected MLLP2ContextConstraint contextConstraint;
+
+  protected List<MLLP2OtherConstraint> otherConstraints = new ArrayList<MLLP2OtherConstraint>();
+
+  public static class MLLP2ContextConstraint {
+    private String contextBoundaryName;
+
+    private int contextSize;
+
+    private boolean direction; // false = left; true = right;
+
+    public MLLP2ContextConstraint(int contextSize, LP2Rule parentRule) {
+      super();
+      this.contextSize = contextSize;
+      contextBoundaryName = TextRulerToolkit.getTypeShortName(parentRule.getTarget()
+              .getCounterPartBoundaryTarget().getSingleSlotTypeName());
+      direction = parentRule.getTarget().type == MLTargetType.SINGLE_LEFT_BOUNDARY ? true : false;
+    }
+
+    public MLLP2ContextConstraint(MLLP2ContextConstraint copyFrom) {
+      super();
+      contextBoundaryName = copyFrom.contextBoundaryName;
+      contextSize = copyFrom.contextSize;
+      direction = copyFrom.direction;
+    }
+
+    public MLLP2ContextConstraint copy() {
+      return new MLLP2ContextConstraint(this);
+    }
+
+    @Override
+    public String toString() {
+      return "NEAR(" + contextBoundaryName + ", 0," + contextSize + ","
+              + (direction ? "true" : "false") + ",true)";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      return toString().equals(((MLLP2ContextConstraint) o).toString());
+    }
+
+    @Override
+    public int hashCode() {
+      return toString().hashCode();
+    }
+
+  }
+
+  public static class MLLP2OtherConstraint {
+
+    TextRulerAnnotation tokenAnnotation;
+
+    TextRulerAnnotation constraintAnnotation;
+
+    boolean canBeAnchor;
+
+    Type type;
+
+    public MLLP2OtherConstraint(TextRulerAnnotation tokenAnnotation,
+            TextRulerAnnotation constraintAnnotation) {
+      this.tokenAnnotation = tokenAnnotation;
+      this.constraintAnnotation = constraintAnnotation;
+      this.type = constraintAnnotation.getType();
+      canBeAnchor = (tokenAnnotation.getBegin() == constraintAnnotation.getBegin())
+              && (tokenAnnotation.getEnd() == constraintAnnotation.getEnd());
+      // TODO is the matching END also a requirement ?
+    }
+
+    public boolean isTMBasicTypeTokenConstraint() {
+      return tokenAnnotation == constraintAnnotation;
+    }
+
+    public boolean canBeAnchorConstraint() {
+      return canBeAnchor;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      MLLP2OtherConstraint co = (MLLP2OtherConstraint) o;
+
+      return toString().equals(co.toString()) && (canBeAnchor == co.canBeAnchor);
+    }
+
+    @Override
+    public int hashCode() {
+      return toString().hashCode() * (canBeAnchor ? 2 : 1);
+    }
+
+    @Override
+    public String toString() {
+      return type.getShortName();
+    }
+
+    public MLLP2OtherConstraint copy() {
+      return new MLLP2OtherConstraint(tokenAnnotation, constraintAnnotation);
+    }
+
+  }
+
+  public LP2RuleItem(LP2RuleItem copyFrom) {
+    super();
+    if (copyFrom.wordConstraint != null)
+      wordConstraint = copyFrom.wordConstraint.copy();
+    if (copyFrom.contextConstraint != null)
+      contextConstraint = copyFrom.contextConstraint.copy();
+    for (MLLP2OtherConstraint c : copyFrom.otherConstraints)
+      otherConstraints.add(c.copy());
+  }
+
+  public LP2RuleItem() {
+    super();
+  }
+
+  public LP2RuleItem copy() {
+    return new LP2RuleItem(this);
+  }
+
+  @Override
+  public int hashCode() {
+    return toString().hashCode();
+  }
+
+  public boolean equals(TextRulerRuleItem o) {
+    return toString().equals(((LP2RuleItem) o).toString());
+  }
+
+  @Override
+  public String toString() {
+    return getStringForRuleString(null, null, 0, 0, 0, 0, 0);
+  }
+
+  public MLLP2OtherConstraint getTMBasicTypeTokenConstraint() {
+    for (MLLP2OtherConstraint c : otherConstraints)
+      if (c.isTMBasicTypeTokenConstraint())
+        return c;
+    return null;
+  }
+
+  public String getStringForRuleString(TextRulerRule rule, MLRuleItemType type,
+          int numberInPattern, int patternSize, int numberInRule, int ruleSize, int slotIndex) {
+
+    String result = "";
+    LP2Rule lp2Rule = (LP2Rule) rule;
+    boolean isMarkingItem = (rule != null)
+            && (((rule.getTarget().type == MLTargetType.SINGLE_RIGHT_BOUNDARY)
+                    && (type == MLRuleItemType.PREFILLER) && (numberInPattern == patternSize - 1)) || ((rule
+                    .getTarget().type == MLTargetType.SINGLE_LEFT_BOUNDARY)
+                    && (type == MLRuleItemType.POSTFILLER) && (numberInPattern == 0)));
+
+    ArrayList<String> constraints = new ArrayList<String>();
+
+    String anchor = null;
+
+    if (wordConstraint == null)
+      anchor = "ANY";
+    else {
+      if (wordConstraint.isRegExpConstraint()) {
+        anchor = wordConstraint.typeShortName();
+        constraints.add("REGEXP(\"" + wordConstraint + "\")");
+      } else
+        anchor = wordConstraint.toString();
+    }
+
+    if (isMarkingItem && lp2Rule.isContextualRule())
+      constraints.add("-IS(" + ((TextRulerSingleSlotRule) rule).getMarkName() + ")");
+
+    if (contextConstraint != null)
+      constraints.add(contextConstraint.toString());
+
+    MLLP2OtherConstraint anchorConstraint = null;
+    if (wordConstraint == null) {
+
+      // prefer the basic TextMarker constraint as the anchor
+      anchorConstraint = getTMBasicTypeTokenConstraint(); // returns null
+      // if we don't
+      // have one...
+
+      if (anchorConstraint == null) {
+        for (MLLP2OtherConstraint c : otherConstraints)
+          if (c.canBeAnchorConstraint()) {
+            anchorConstraint = c;
+            break;
+          }
+      }
+      for (MLLP2OtherConstraint oc : otherConstraints) {
+        if (oc != anchorConstraint) {
+          if (oc.canBeAnchorConstraint())
+            constraints.add("IS(" + oc + ")");
+          else
+            constraints.add("PARTOF(" + oc + ")");
+        }
+      }
+      if (anchorConstraint != null)
+        anchor = anchorConstraint.toString();
+    }
+
+    if (constraints.size() > 0) {
+      String cStr = "";
+      for (String constraintStr : constraints) {
+        if (cStr.length() > 0)
+          cStr += ", ";
+        cStr += constraintStr;
+      }
+      result += "{" + cStr;
+    }
+
+    if ((rule != null)
+            && (((rule.getTarget().type == MLTargetType.SINGLE_RIGHT_BOUNDARY)
+                    && (type == MLRuleItemType.PREFILLER) && (numberInPattern == patternSize - 1)) || ((rule
+                    .getTarget().type == MLTargetType.SINGLE_LEFT_BOUNDARY)
+                    && (type == MLRuleItemType.POSTFILLER) && (numberInPattern == 0)))) {
+      // result +=
+      // "(MARKONCE, "+((TextRulerSingleSlotRule)rule).getMarkName()+", "+(numberInRule+1);
+      if (constraints.size() == 0)
+        result += "{";
+      result += "->MARKONCE(" + ((TextRulerSingleSlotRule) rule).getMarkName() + ")";
+      if (lp2Rule.isContextualRule())
+        result += ", ASSIGN(redoContextualRules, true)";
+      result += "}";
+    } else {
+      if (constraints.size() != 0)
+        result += "}";
+    }
+    return anchor + result;
+  }
+
+  public void addOtherConstraint(MLLP2OtherConstraint c) {
+    if (!otherConstraints.contains(c))
+      otherConstraints.add(c);
+  }
+
+  public List<MLLP2OtherConstraint> getOtherConstraints() {
+    return otherConstraints;
+  }
+
+  public void setWordConstraint(TextRulerAnnotation tokenAnnotation) {
+    setWordConstraint(new TextRulerWordConstraint(tokenAnnotation));
+  }
+
+  public void setContextConstraint(MLLP2ContextConstraint c) {
+    contextConstraint = c;
+  }
+
+  public MLLP2ContextConstraint getContextConstraint() {
+    return contextConstraint;
+  }
+
+  public void setWordConstraint(TextRulerWordConstraint c) {
+    wordConstraint = c;
+  }
+
+  public TextRulerWordConstraint getWordConstraint() {
+    return wordConstraint;
+  }
+
+  public void removeConstraintWithName(String name) {
+    otherConstraints.remove(name);
+  }
+
+  public int totalConstraintCount() {
+    return otherConstraints.size() + (wordConstraint != null ? 1 : 0)
+            + (contextConstraint != null ? 1 : 0);
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2RuleItem.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textruler.lp2/src/main/java/org/apache/uima/tm/textruler/lp2/LP2RuleItem.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain