• Stars
    star
    199
  • Rank 195,330 (Top 4 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

TextRank算法提取关键词的Java实现

TextRank

TextRank算法提取关键词与自动摘要的Java实现

注意

TextRank已经集成到HanLP中,本项目不再维护。

TextRankKeyword提取关键词

  • 调用方法
public static void main(String[] args)
{
    String content = "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。";
    System.out.println(new TextRankKeyword().getKeyword("", content));
}
  • 算法详解 TextRank是在Google的PageRank算法启发下,针对文本里的句子设计的权重算法,目标是自动摘要。 详见《TextRank算法提取关键词的Java实现》
  • 关于分词 分词不是TextRank关注的重点,项目中的警告是分词库发出,不影响功能。

TextRankSummary自动摘要

  • 调用方法
 public static void main(String[] args)
 {
    String document = "算法可大致分为基本算法、数据结构的算法、数论算法、计算几何的算法、图的算法、动态规划以及数值分析、加密算法、排序算法、检索算法、随机化算法、并行算法、厄米变形模型、随机森林算法。\n" +
                "算法可以宽泛的分为三类,\n" +
                "一,有限的确定性算法,这类算法在有限的一段时间内终止。他们可能要花很长时间来执行指定的任务,但仍将在一定的时间内终止。这类算法得出的结果常取决于输入值。\n" +
                "二,有限的非确定算法,这类算法在有限的时间内终止。然而,对于一个(或一些)给定的数值,算法的结果并不是唯一的或确定的。\n" +
                "三,无限的算法,是那些由于没有定义终止定义条件,或定义的条件无法由输入的数据满足而不终止运行的算法。通常,无限算法的产生是由于未能确定的定义终止条件。";
    System.out.println(TextRankSummary.getTopSentenceList(document, 3));
 }
  • 算法详解 通过句子的相关程度(BM25相关度)决定票的权重,迭代投票得出最终权重。 详见[《TextRank算法自动摘要的Java实现》][2]

TODO

  • 自然语言处理任重道远,本项目只是对TextRank的一份简明实现,效果和性能请自行评估。

  • 我写了[一系列入门笔记][3],欢迎NLP领域的朋友[前来交流、指导我的学习][3]。

  • 事实上,我正在开发一个完备的汉语处理包,目前能够提供分词、词性标注、命名实体识别、关键字提取、短语提取、自动摘要、自动推荐等功能,未来可能开源并逐步实现依存关系、句法树等功能,敬请期待。

    [2]: http://www.hankcs.com/nlp/textrank-algorithm-java-implementation-of-automatic-abstract.html [3]: http://www.hankcs.com/category/nlp/

More Repositories

1

HanLP

中文分词 词性标注 命名实体识别 依存句法分析 成分句法分析 语义依存分析 语义角色标注 指代消解 风格转换 语义相似度 新词发现 关键词短语提取 自动摘要 文本分类聚类 拼音简繁转换 自然语言处理
Python
33,040
star
2

pyhanlp

中文分词
Python
3,091
star
3

AhoCorasickDoubleArrayTrie

An extremely fast implementation of Aho Corasick algorithm based on Double Array Trie.
Java
937
star
4

CS224n

CS224n: Natural Language Processing with Deep Learning Assignments Winter, 2017
Python
668
star
5

Viterbi

An implementation of HMM-Viterbi Algorithm 通用的维特比算法实现
Java
368
star
6

multi-criteria-cws

Simple Solution for Multi-Criteria Chinese Word Segmentation
Python
299
star
7

hanlp-lucene-plugin

HanLP中文分词Lucene插件,支持包括Solr在内的基于Lucene的系统
Java
295
star
8

LDA4j

A Java implemention of LDA(Latent Dirichlet Allocation)
Java
194
star
9

TreebankPreprocessing

Python scripts preprocessing Penn Treebank and Chinese Treebank
Python
162
star
10

ID-CNN-CWS

Source codes and corpora of paper "Iterated Dilated Convolutions for Chinese Word Segmentation"
Python
136
star
11

MainPartExtractor

主谓宾提取器的Java实现(对斯坦福的代码失去兴趣,不再维护)
Java
135
star
12

neural_net

反向传播神经网络及应用
Python
82
star
13

udacity-deep-learning

Assignments for Udacity Deep Learning class with TensorFlow in PURE Python, not IPython Notebook
Python
66
star
14

AveragedPerceptronPython

Clone of "A Good Part-of-Speech Tagger in about 200 Lines of Python" by Matthew Honnibal
Python
49
star
15

text-classification-svm

The missing SVM-based text classification module implementing HanLP's interface
Java
47
star
16

MaxEnt

这是一个最大熵的简明Java实现,提供提供训练与预测接口。训练算法采用GIS训练算法,附带示例训练集和一个天气预测的Demo。
Java
45
star
17

IceNAT

IceNAT
Java
32
star
18

BERT-token-level-embedding

Generate BERT token level embedding without pain
Python
28
star
19

sub-character-cws

Sub-Character Representation Learning
Python
25
star
20

HanLPAndroidDemo

HanLP Android Demo
Java
21
star
21

maxent_iis

最大熵-IIS(Improved Iterative Scaling)训练算法的Java实现
Java
18
star
22

gohanlp

Golang RESTful Client for HanLP
Go
13
star
23

DeepBiaffineParserMXNet

An experimental implementation of biaffine parser using MXNet
Python
10
star
24

iparser

Yet another dependency parser, integrated with tokenizer, tagger and visualization tool.
Python
10
star
25

OpenCC-to-HanLP

无损转换OpenCC词典为HanLP格式
Python
9
star
26

tmsvm

Python
1
star
27

bolt_splits

Split Broad Operational Language Translation corpus into train/dev/test set
Python
1
star