@Override protected ImmutableSet<LexicalRule> getRulesNotInCache(String lhsLemma, PartOfSpeech lhsPos) throws RuleBaseException { try { List< ? extends eu.excitementproject.eop.common.component.lexicalknowledge.LexicalRule< ? extends RuleInfo>> rulesFromResource = realLexicalResource.getRulesForLeft(lhsLemma, lhsPos); Set<LexicalRule> ret = new LinkedHashSet<LexicalRule>(); if (rulesFromResource != null) { for (eu.excitementproject.eop.common.component.lexicalknowledge.LexicalRule< ? extends RuleInfo> ruleFromResource : rulesFromResource) { double confidence = 0.0; if (Constants.LEXICAL_RESOURCES_USE_CONSTANT_SCORE_FOR_ALL_RULES) { confidence = Constants.LEXICAL_RESOURCE_CONSTANT_SCORE_WHEN_USING_CONSTANT_SCORE; } else { confidence = ruleFromResource.getConfidence(); } if ((confidence <= 0) || (confidence >= 1)) throw new RuleBaseException( "Bad confidence for rule from " + this.realLexicalResource.getClass().getSimpleName() + ". The confidene is: " + String.format("%-4.4f", confidence)); ret.add( new LexicalRule( ruleFromResource.getLLemma(), ruleFromResource.getLPos(), ruleFromResource.getRLemma(), ruleFromResource.getRPos(), confidence)); } } return new ImmutableSetWrapper<LexicalRule>(ret); } catch (LexicalResourceException e) { throw new RuleBaseException("Lexical resource failure. See nested exception.", e); } }