com.hankcs.hanlp.suggest.scorer
类 BaseScorer<T extends ISentenceKey>

java.lang.Object
  继承者 com.hankcs.hanlp.suggest.scorer.BaseScorer<T>
类型参数:
T - 这是储存器map中key的类型,具有相同key的句子会存入同一个entry
所有已实现的接口:
IScorer
直接已知子类:
EditDistanceScorer, IdVectorScorer, PinyinScorer

public abstract class BaseScorer<T extends ISentenceKey>
extends Object
implements IScorer

基本打分器

作者:
hankcs

字段摘要
 double boost
          权重
protected  Map<T,Set<String>> storage
          储存
 
构造方法摘要
BaseScorer()
           
 
方法摘要
 void addSentence(String sentence)
          输入一个候选句子
 Map<String,Double> computeScore(String outerSentence)
          计算分值
protected abstract  T generateKey(String sentence)
          生成能够代表这个句子的键
 void removeAllSentences()
          清空该推荐器中的所有句子
 BaseScorer setBoost(double boost)
          设置权重
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

storage

protected Map<T extends ISentenceKey,Set<String>> storage
储存


boost

public double boost
权重

构造方法详细信息

BaseScorer

public BaseScorer()
方法详细信息

setBoost

public BaseScorer setBoost(double boost)
设置权重

参数:
boost -
返回:

addSentence

public void addSentence(String sentence)
从接口 IScorer 复制的描述
输入一个候选句子

指定者:
接口 IScorer 中的 addSentence

generateKey

protected abstract T generateKey(String sentence)
生成能够代表这个句子的键

参数:
sentence -
返回:

computeScore

public Map<String,Double> computeScore(String outerSentence)
从接口 IScorer 复制的描述
计算分值

指定者:
接口 IScorer 中的 computeScore
参数:
outerSentence - 外部句子
返回:
key为分值x,value为分值等于x的一系列句子

removeAllSentences

public void removeAllSentences()
从接口 IScorer 复制的描述
清空该推荐器中的所有句子

指定者:
接口 IScorer 中的 removeAllSentences


Copyright © 2014–2015 鐮佸啘鍦�/a>. All rights reserved.