com.hankcs.hanlp.corpus.dictionary
类 TFDictionary

java.lang.Object
  继承者 com.hankcs.hanlp.corpus.dictionary.SimpleDictionary<TermFrequency>
      继承者 com.hankcs.hanlp.corpus.dictionary.TFDictionary
所有已实现的接口:
ISaveAble

public class TFDictionary
extends SimpleDictionary<TermFrequency>
implements ISaveAble

词频词典

作者:
hankcs

嵌套类摘要
 
从类 com.hankcs.hanlp.corpus.dictionary.SimpleDictionary 继承的嵌套类/接口
SimpleDictionary.Filter<V>
 
构造方法摘要
TFDictionary()
           
TFDictionary(String delimeter)
           
 
方法摘要
 void add(String key)
           
static int combine(String... path)
          合并多个词典
 int combine(TFDictionary dictionary, int limit, boolean add)
          合并自己(主词典)和某个词频词典
 int getFrequency(String key)
          获取频次
protected  Map.Entry<String,TermFrequency> onGenerateEntry(String line)
          由参数构造一个词条
 boolean saveKeyTo(String path)
          仅仅将值保存到文件
 boolean saveTxtTo(String path)
          将自己以文本文档的方式保存到磁盘
 TreeSet<TermFrequency> values()
          按照频率从高到低排序的条目
 
从类 com.hankcs.hanlp.corpus.dictionary.SimpleDictionary 继承的方法
add, combine, entrySet, get, keySet, load, remove, size
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

TFDictionary

public TFDictionary(String delimeter)

TFDictionary

public TFDictionary()
方法详细信息

onGenerateEntry

protected Map.Entry<String,TermFrequency> onGenerateEntry(String line)
从类 SimpleDictionary 复制的描述
由参数构造一个词条

指定者:
SimpleDictionary<TermFrequency> 中的 onGenerateEntry
返回:

combine

public int combine(TFDictionary dictionary,
                   int limit,
                   boolean add)
合并自己(主词典)和某个词频词典

参数:
dictionary - 某个词频词典
limit - 如果该词频词典试图引入一个词语,其词频不得超过此limit(如果不需要使用limit功能,可以传入Integer.MAX_VALUE)
add - 设为true则是词频叠加模式,否则是词频覆盖模式
返回:
词条的增量

combine

public static int combine(String... path)
合并多个词典

参数:
path - 多个词典的路径,第一个是主词典。主词典与其他词典的区别详见com.hankcs.hanlp.corpus.dictionary.TFDictionary#combine(com.hankcs.hanlp.corpus.dictionary.TFDictionary, int, boolean)
返回:
词条的增量

getFrequency

public int getFrequency(String key)
获取频次

参数:
key -
返回:

add

public void add(String key)

saveTxtTo

public boolean saveTxtTo(String path)
从接口 ISaveAble 复制的描述
将自己以文本文档的方式保存到磁盘

指定者:
接口 ISaveAble 中的 saveTxtTo
参数:
path - 保存位置,包含文件名,不一定包含后缀
返回:
是否成功

saveKeyTo

public boolean saveKeyTo(String path)
仅仅将值保存到文件

参数:
path -
返回:

values

public TreeSet<TermFrequency> values()
按照频率从高到低排序的条目

返回:


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