public class TermFrequencyCounter extends KeywordExtractor implements Collection<TermFrequency>
defaultSegment| Constructor and Description |
|---|
TermFrequencyCounter() |
TermFrequencyCounter(Segment segment,
boolean filterStopWord)
构造
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(List<Term> termList) |
void |
add(String document) |
boolean |
add(TermFrequency termFrequency) |
boolean |
addAll(Collection<? extends TermFrequency> c) |
Collection<TermFrequency> |
all()
所有词汇的频次
|
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
static List<String> |
getKeywordList(String document,
int size)
提取关键词(线程安全)
|
List<String> |
getKeywords(List<Term> termList,
int size)
提取关键词(非线程安全)
|
boolean |
isEmpty() |
Iterator<TermFrequency> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
Collection<TermFrequency> |
top(int N)
取前N个高频词
|
String |
toString() |
filter, getKeywords, getKeywords, getSegment, setSegment, shouldIncludeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCode, parallelStream, removeIf, spliterator, streampublic TermFrequencyCounter(Segment segment, boolean filterStopWord)
filterStopWord - 是否过滤停用词segment - 分词器public TermFrequencyCounter()
public void add(String document)
public Collection<TermFrequency> top(int N)
N - public Collection<TermFrequency> all()
public int size()
size in interface Collection<TermFrequency>public boolean isEmpty()
isEmpty in interface Collection<TermFrequency>public boolean contains(Object o)
contains in interface Collection<TermFrequency>public Iterator<TermFrequency> iterator()
iterator in interface Iterable<TermFrequency>iterator in interface Collection<TermFrequency>public Object[] toArray()
toArray in interface Collection<TermFrequency>public <T> T[] toArray(T[] a)
toArray in interface Collection<TermFrequency>public boolean add(TermFrequency termFrequency)
add in interface Collection<TermFrequency>public boolean remove(Object o)
remove in interface Collection<TermFrequency>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<TermFrequency>public boolean addAll(Collection<? extends TermFrequency> c)
addAll in interface Collection<TermFrequency>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<TermFrequency>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<TermFrequency>public void clear()
clear in interface Collection<TermFrequency>public List<String> getKeywords(List<Term> termList, int size)
getKeywords in class KeywordExtractortermList - size - public static List<String> getKeywordList(String document, int size)
document - 文档内容size - 希望提取几个关键词Copyright © 2014–2021 码农场. All rights reserved.