public Set<T> getSpecs() throws OperationException { return new DummySet<T>(); } }
/** * Optionally called before {@link #train(Vector)}, to force the training algorithm to * avoid values smaller than <tt>minimumValue</tt> to the parameters. * @param minimumValue * @param notRestricted */ public void restrict(double minimumValue, Set<Integer> notRestricted) { this.restricted = true; this.restrictionMinimumValue = minimumValue; if (null==notRestricted) { this.notRestricted = new DummySet<Integer>(); } else { this.notRestricted = notRestricted; } }
/** * Optionally called before {@link #train(Vector)}, to force the training algorithm to * avoid values smaller than <tt>minimumValue</tt> to the parameters. * @param minimumValue * @param notRestricted */ public void restrict(double minimumValue, Set<Integer> notRestricted) { this.doConstrain = true; this.constrainValueForConstrainedFeatures = minimumValue; if (null==notRestricted) { this.notConstrainedFeatures = new DummySet<Integer>(); } else { this.notConstrainedFeatures = shiftSet(notRestricted); this.notConstrainedFeatures.add(0); } }
@Override protected ImmutableSet<LexicalRule> getRulesNotInCache(String lhsLemma, PartOfSpeech lhsPos) throws RuleBaseException { lhsLemma = lhsLemma.trim(); if (lhsLemma.length()==0) return new ImmutableSetWrapper<LexicalRule>(new DummySet<LexicalRule>()); try { statement.setString(1, lhsLemma); ResultSet resultSet = statement.executeQuery(); Set<LexicalRule> setRules = new LinkedHashSet<LexicalRule>(); while (resultSet.next()) { String right = resultSet.getString(RIGHT_COLUMN); double score = E_MINUS_1; if (!USE_CONSTANT_SCORE) { score = resultSet.getDouble(SCORE_COLUMN); } setRules.add(new LexicalRule(lhsLemma, lhsPos, right, lhsPos, score)); } return new ImmutableSetWrapper<LexicalRule>(setRules); } catch(SQLException e) { throw new RuleBaseException("Failed due to SQL exception.",e); } }
@Override public ImmutableSet<ChainOfLexicalRules> getRules(String lhsLemma, PartOfSpeech lhsPos) throws RuleBaseException { if (null==this.rules) throw new RuleBaseException("Rules were not set!"); try { CanonicalLemmaAndPos lemmaAndPos = new CanonicalLemmaAndPos(lhsLemma, lhsPos); ImmutableSet<ChainOfLexicalRules> ret = null; if (rules.containsKey(lemmaAndPos)) { ret = rules.get(lemmaAndPos); } if (null==ret) { ret = new ImmutableSetWrapper<ChainOfLexicalRules>(new DummySet<ChainOfLexicalRules>()); } return ret; } catch(TeEngineMlException e) { throw new RuleBaseException("Failed to fetch rules",e); } }
public ImmutableSet<String> getAllowedDatasetNames() throws TeEngineMlException { if (null==this.teSystemEnvironment.getFeatureVectorStructureOrganizer().getDynamicGlobalFeatures()) { return new ImmutableSetWrapper<String>(new DummySet<String>()); } else { return this.teSystemEnvironment.getFeatureVectorStructureOrganizer().getDynamicGlobalFeatures().keySet(); } }
@Override public ImmutableSet<V> get(K key) { ImmutableSet<V> ret = null; if (this.bidirectionalMap!=null) { Set<V> set = null; if (this.bidirectionalMap.leftContains(key)) { V value = this.bidirectionalMap.leftGet(key); set = new SingleItemSet<V>(value); } else { set = new DummySet<V>(); } ret = new ImmutableSetWrapper<V>(set); } else { ret = this.valueSetMap.get(key); } return ret; }