Can you check if the following code in TextRulerAnnotation (constructor)
is used:
if (consideredFeatures != null) {
for (String string : consideredFeatures) {
Feature feature = afs.getType().getFeatureByBaseName(string);
if (feature != null && feature.getRange().isPrimitive()) {
String valueAsString = afs.getFeatureValueAsString(feature);
if(feature.getRange().getName().equals(UIMAConstants.TYPE_STRING)) {
valueAsString = "\""+valueAsString+"\"";
}
featureMap.put(string, valueAsString);
}
}
}
Here, the features values are stored in the map.
On 10.06.2013 12:48, Sondes Bannour wrote:
> I already added this code but i think the problem is here:
>
> List<TextRulerSlotPattern> patterns = rule.getPatterns();
> for (TextRulerSlotPattern eachPattern : patterns) {
> for (TextRulerRuleItem item : eachPattern.fillerPattern) {
> if (item instanceof WhiskRuleItem) {
> WhiskRuleItem wri = (WhiskRuleItem) item;
> WhiskRule proposedRule = rule;
> TextRulerWordConstraint wordConstraint =
> wri.getWordConstraint();
> for (String eachFeature : consideredFeatures) {
> if (wordConstraint != null) {
> * Map<String, String> featureMap =
> wordConstraint.getTokenAnnotation().getFeatureMap();*
> String stringValue = featureMap.get(eachFeature);
> if (stringValue != null &&
> !wri.getActivatedFeatures().contains(eachFeature)) {
> wri.activateFeature(eachFeature);
> WhiskRule proposedRuleF = proposedRule.copy();
> wri.deactivateFeature(eachFeature);
> proposedRuleF.setNeedsCompile(true);
> if (!rulesToTest.contains(proposedRuleF)) {
> rulesToTest.add(proposedRuleF);
> }
> }
> }
> }
>
> this featureMap is always empty.
>
> Best,
> Sondes
>