Search in sources :

Example 1 with TriaFrequency

use of com.hankcs.hanlp.corpus.occurrence.TriaFrequency in project HanLP by hankcs.

the class DemoOccurrence method main.

public static void main(String[] args) {
    Occurrence occurrence = new Occurrence();
    occurrence.addAll("在计算机音视频和图形图像技术等二维信息算法处理方面目前比较先进的视频处理算法");
    occurrence.compute();
    Set<Map.Entry<String, TermFrequency>> uniGram = occurrence.getUniGram();
    for (Map.Entry<String, TermFrequency> entry : uniGram) {
        TermFrequency termFrequency = entry.getValue();
        System.out.println(termFrequency);
    }
    Set<Map.Entry<String, PairFrequency>> biGram = occurrence.getBiGram();
    for (Map.Entry<String, PairFrequency> entry : biGram) {
        PairFrequency pairFrequency = entry.getValue();
        if (pairFrequency.isRight())
            System.out.println(pairFrequency);
    }
    Set<Map.Entry<String, TriaFrequency>> triGram = occurrence.getTriGram();
    for (Map.Entry<String, TriaFrequency> entry : triGram) {
        TriaFrequency triaFrequency = entry.getValue();
        if (triaFrequency.isRight())
            System.out.println(triaFrequency);
    }
}
Also used : TermFrequency(com.hankcs.hanlp.corpus.occurrence.TermFrequency) TriaFrequency(com.hankcs.hanlp.corpus.occurrence.TriaFrequency) PairFrequency(com.hankcs.hanlp.corpus.occurrence.PairFrequency) Occurrence(com.hankcs.hanlp.corpus.occurrence.Occurrence) Map(java.util.Map)

Aggregations

Occurrence (com.hankcs.hanlp.corpus.occurrence.Occurrence)1 PairFrequency (com.hankcs.hanlp.corpus.occurrence.PairFrequency)1 TermFrequency (com.hankcs.hanlp.corpus.occurrence.TermFrequency)1 TriaFrequency (com.hankcs.hanlp.corpus.occurrence.TriaFrequency)1 Map (java.util.Map)1