• Stars
    star
    118
  • Rank 299,923 (Top 6 %)
  • Language
    C++
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

THU Chinese Keyphrase Extraction Toolkit

THUCKE: 中文关键词抽取工具包

目录

项目介绍

THUCKE(THU Chinese Keyphrase Extraction)由清华大学自然语言处理与社会人文计算实验室研制推出的中文关键词抽取工具包。采用WAM(Word Alignment Model)模型,引入翻译的方法,将关键词和正文作为翻译对,使用IBM-Model1进行训练,获得“关键词-正文词”翻译概率表,综合该翻译概率表和TFIDF方法,进行关键词抽取。 训练语料采用网易新闻最近的新闻近40000条,并且我们将不断更新语料库,训练新的模型,在模型下载界面可以选择不同版本模型。

编译安装:

在当前目录执行make,编译完成会在当前目录生成可执行文件thucke

使用方法

1.下载模型文件(下载地址):

将模型下载并解压到./res/,解压后目录结构应为:

- res
  - thucke_models
  - thulac_models

2.参数介绍:

参数 解析
-i 需要提取关键词的文本文件路径
-n 需要提取关键词的最大个数
-m 模型文件路径

3.运行示例:

3.1 准备抽取文本

使用演示文本test1.txt或test2.txt,或者使用自己的文本替换该文件内容

3.2.运行工具

执行./thucke -i ./test1.txt -n 5 -m ./res

3.3 输出结果为json格式

{
  "result": [
    {
      "keyword": "财政",
      "score": 1000
    },
    {
      "keyword": "企业",
      "score": 875
    },
    {
      "keyword": "政策",
      "score": 625
    },
    {
      "keyword": "减税",
      "score": 541
    },
    {
      "keyword": "支出",
      "score": 374
    }
  ],
  "timeuse": 0.10199,
  "info": "success",
  "status": 0
}

3.4 结果内容介绍:

key value
result 返回结果:keyword(关键词),score(对应评分,结果按评分排序,最高分1000))
timeuse 运行时间/s,仅为关键词抽取时间,不包括模型加载时间
status 返回状态码
info 状态码注释

与其它关键词抽取工具结果对比

我们与其它常见的关键词抽取工具(jieba)进行对比,采用了两篇新闻作为抽取文本,抽取的结果对比如下:

1.测试文本test1.txt

THUCKE 评分(最高1000) jieba-TFIDF 评分(最高1) jieba-TextRank 评分(最高1)
耳机 1000 耳机 0.2455 耳机 1.0
辐射 521 蓝牙 0.2163 蓝牙 0.7364
人体 391 苹果 0.1688 苹果 0.7210
表示 376 AirPods 0.1488 表示 0.5163
使用 318 iPhone7 0.1339 使用 0.4901
iPhone7 318 辐射 0.1067 没有 0.4808
手机 304 Plus 0.1042 辐射 0.4750
AirPods 289 无线耳机 0.1042 传送 0.3215
电波 217 健康 0.0743 人体 0.3186
研究 202 传送 0.0722 问题 0.2980

2.测试文本test2.txt

THUCKE 评分(最高1000) jieba-TFIDF 评分(最高1) jieba-TextRank 评分(最高1)
财政 1000 减税 0.2445 经济 1.0
企业 875 财政政策 0.1313 减税 0.8912
政策 625 企业 0.1033 企业 0.8254
减税 541 税收收入 0.0968 增长 0.6250
支出 374 经济 0.0875 增加 0.5322
增长 291 数据 0.0780 扩大 0.4892
税收 250 降费 0.0731 税收 0.4434
政府 250 负担 0.07198 数据 0.4217
增加 250 税收 0.0698 财政 0.4134
扩大 208 税率 0.0693 财政政策 0.4092

THUCKE工程介绍

  - Makefile //makefile配置文件
  - README.md //文档
  - head //头文件
    - thulac //thulac分词和词性标注相关头文件
    - thucke //thucke关键词抽取相关头文件
        - articleSpliter.h //输入文本分割相关
        - keyword.h //关键词相关
        - trie.h //trie树相关
  - res //资源文件,主要是模型文件放置目录
  - src //源代码存放目录
      - thucke.cpp //主程序入口,如需进行任何形式的改造,从此文件开始
      - keywordLoad.cpp //模型加载
      - articleSpliter.cpp //输入文本切分预处理
      - thulac_segment.cpp //分词和词性标注
      - keywordExtract.cpp //关键词抽取核心算法实现 
      - trie.cpp //trie搜索树实现
  - test1.txt //测试文本1
  - test2.txt //测试文本2

THUCKE模型介绍

  1. THUCKE采用WAM方法,将新闻标题和新闻内容作为翻译对,生成“标题词语”-“内容词语”翻译概率矩阵,综合该词语翻译概率矩阵和tfidf,对给定文本进行关键词抽取,算法详细情况请查看“相关论文”部分;
  2. 训练语料采用从网易新闻爬取的最近一段时间的新闻数据大概40000条,因此该关键词抽取模型对于新闻类文本效果较好;
  3. 下载的模型除了thucke关键词抽取模型之外,还包含thulac分词词性标注模型,thulac同为thunlp推出的中文词法分析工具包,具有分词和词性标注功能;
  4. THUCKE将一直不断更新训练数据,生成最新的模型,同时保留旧模型,可以根据需要进行下载。

开源协议

  1. THUCKE面向国内外大学、研究所、企业以及个人用于研究目的免费开放源代码。

  2. 如有机构或个人拟将THUCKE用于商业目的,请发邮件至[email protected]洽谈技术许可协议。

  3. 欢迎对该工具提出任何宝贵意见和建议,请发邮件至[email protected]提出意见和建议。

  4. 如果您在THUCKE基础上发表论文或取得科研成果,请您在发表论文和申报成果时声明“使用了清华大学THUCKE”,并按如下格式引用:

    • Zhiyuan Liu, Xinxiong Chen, Maosong Sun. A Simple Word Trigger Method for Social Tag Suggestion. The Conference on Empirical Methods in Natural Language Processing (EMNLP 2011).

相关论文

  • Zhiyuan Liu, Xinxiong Chen, Maosong Sun. A Simple Word Trigger Method for Social Tag Suggestion. The Conference on Empirical Methods in Natural Language Processing (EMNLP 2011).[pdf]
  • Zhiyuan Liu, Xinxiong Chen, Yabin Zheng, Maosong Sun. Automatic Keyphrase Extraction by Bridging Vocabulary Gap. The 15th Conference on Computational Natural Language Learning (CoNLL 2011).[pdf]

作者

  • Zhipeng Guo(郭志芃,本科生), Yunshan Ma(马云山,本科生), Zhiyuan Liu(刘知远,助理教授), Maosong Sun(孙茂松,教授)

More Repositories

1

GNNPapers

Must-read papers on graph neural networks (GNN)
15,490
star
2

WantWords

An open-source online reverse dictionary.
JavaScript
6,933
star
3

OpenPrompt

An Open-Source Framework for Prompt-Learning.
Python
4,323
star
4

OpenNRE

An Open-Source Package for Neural Relation Extraction (NRE)
Python
4,322
star
5

PromptPapers

Must-read papers on prompt-based tuning for pre-trained language models.
4,059
star
6

OpenKE

An Open-Source Package for Knowledge Embedding (KE)
Python
3,813
star
7

PLMpapers

Must-read Papers on pre-trained language models.
3,161
star
8

NRLPapers

Must-read papers on network representation learning (NRL) / network embedding (NE)
TeX
2,524
star
9

UltraChat

Large-scale, Informative, and Diverse Multi-round Chat Data (and Models)
Python
2,225
star
10

THULAC-Python

An Efficient Lexical Analyzer for Chinese
Python
1,997
star
11

OpenNE

An Open-Source Package for Network Embedding (NE)
Python
1,683
star
12

KRLPapers

Must-read papers on knowledge representation learning (KRL) / knowledge embedding (KE)
TeX
1,532
star
13

TAADpapers

Must-read Papers on Textual Adversarial Attack and Defense
Python
1,505
star
14

ERNIE

Source code and dataset for ACL 2019 paper "ERNIE: Enhanced Language Representation with Informative Entities"
Python
1,408
star
15

KB2E

Knowledge Graph Embeddings including TransE, TransH, TransR and PTransE
C++
1,360
star
16

NREPapers

Must-read papers on neural relation extraction (NRE)
TeX
1,028
star
17

OpenDelta

A plug-and-play library for parameter-efficient-tuning (Delta Tuning)
Python
991
star
18

WebCPM

Official codes for ACL 2023 paper "WebCPM: Interactive Web Search for Chinese Long-form Question Answering"
HTML
977
star
19

OpenCLaP

Open Chinese Language Pre-trained Model Zoo
977
star
20

RCPapers

Must-read papers on Machine Reading Comprehension
890
star
21

ToolLearningPapers

865
star
22

NRE

Neural Relation Extraction, including CNN, PCNN, CNN+ATT, PCNN+ATT
C++
812
star
23

THULAC

An Efficient Lexical Analyzer for Chinese
C++
790
star
24

FewRel

A Large-Scale Few-Shot Relation Extraction Dataset
Python
727
star
25

THUOCL

THUOCL(THU Open Chinese Lexicon)中文词库
697
star
26

Chinese_Rumor_Dataset

中文谣言数据
693
star
27

OpenAttack

An Open-Source Package for Textual Adversarial Attack.
Python
682
star
28

DocRED

Dataset and codes for ACL 2019 DocRED: A Large-Scale Document-Level Relation Extraction Dataset.
Python
609
star
29

OpenHowNet

Core Data of HowNet and OpenHowNet Python API
Python
608
star
30

TensorFlow-TransX

An implementation of TransE and its extended models for Knowledge Representation Learning on TensorFlow
Python
514
star
31

LegalPapers

Must-read Papers on Legal Intelligence
465
star
32

CAIL

Chinese AI & Law Challenge
449
star
33

OpenMatch

An Open-Source Package for Information Retrieval.
Python
447
star
34

BERT-KPE

Python
443
star
35

Fast-TransX

An Efficient implementation of TransE and its extended models for Knowledge Representation Learning
C++
401
star
36

TensorFlow-Summarization

Python
390
star
37

Few-NERD

Code and data of ACL 2021 paper "Few-NERD: A Few-shot Named Entity Recognition Dataset"
Python
385
star
38

SOS4NLP

Survey of Surveys for Natural Language Processing (SOS4NLP)
327
star
39

THULAC-Java

An Efficient Lexical Analyzer for Chinese
Java
325
star
40

BMCourse

The repo for Tsinghua summer course: Interdisciplinary Seminar on Big Models
Python
321
star
41

InfLLM

The code of our paper "InfLLM: Unveiling the Intrinsic Capacity of LLMs for Understanding Extremely Long Sequences with Training-Free Memory"
Python
287
star
42

NSC

Neural Sentiment Classification
Python
286
star
43

LLaVA-UHD

LLaVA-UHD: an LMM Perceiving Any Aspect Ratio and High-Resolution Images
Python
276
star
44

DeltaPapers

Must-read Papers of Parameter-Efficient Tuning (Delta Tuning) Methods on Pre-trained Models.
273
star
45

Chinese_NRE

Source code for ACL 2019 paper "Chinese Relation Extraction with Multi-Grained Information and External Linguistic Knowledge"
Python
268
star
46

PL-Marker

Source code for "Packed Levitated Marker for Entity and Relation Extraction"
Python
255
star
47

LEGENT

Open Platform for Embodied Agents
Python
250
star
48

SE-WRL

Improved Word Representation Learning with Sememes
C
197
star
49

SCPapers

Must-read Papers on Sememe Computation
196
star
50

THUCTC

An Efficient Chinese Text Classifier
Java
196
star
51

KnowledgeablePromptTuning

kpt code
Python
192
star
52

CANE

Source code and datasets of "CANE: Context-Aware Network Embedding for Relation Modeling"
Python
191
star
53

JointNRE

Joint Neural Relation Extraction with Text and KGs
Python
187
star
54

HATT-Proto

Code and dataset of AAAI2019 paper Hybrid Attention-Based Prototypical Networks for Noisy Few-Shot Relation Classification
Python
185
star
55

LegalPLMs

Source code and checkpoints for legal pre-trained language models.
Python
169
star
56

NLP-THU

NLP Course Material & QA
168
star
57

KernelGAT

The source codes for Fine-grained Fact Verification with Kernel Graph Attention Network.
Python
161
star
58

PTR

Prompt Tuning with Rules
Python
155
star
59

EntityDuetNeuralRanking

Entity-Duet Neural Ranking Model
Python
153
star
60

OOP-THU

OOP Course Material & QA
149
star
61

OpenBackdoor

An open-source toolkit for textual backdoor attack and defense (NeurIPS 2022 D&B, Spotlight)
Python
148
star
62

Auto_CLIWC

Code for Chinese LIWC Lexicon Expansion via Hierarchical Classification of Word Embeddings with Sememe Attention (AAAI18)
Python
142
star
63

attribute_charge

The source code of our COLING'18 paper "Few-Shot Charge Prediction with Discriminative Legal Attributes".
Python
128
star
64

ConceptFlow

Python
119
star
65

CAIL2018

Python
112
star
66

Neural-Snowball

Code and dataset of AAAI2020 Paper Neural Snowball for Few-Shot Relation Learning
Python
112
star
67

KR-EAR

Knowledge Representation Learning with Entities, Attributes and Relations
C++
111
star
68

ChatEval

Codes for our paper "ChatEval: Towards Better LLM-based Evaluators through Multi-Agent Debate"
Python
109
star
69

MultiRD

Code and data of the AAAI-20 paper "Multi-channel Reverse Dictionary Model"
Python
106
star
70

TransNet

Source code and datasets of IJCAI2017 paper "TransNet: Translation-Based Network Representation Learning for Social Relation Extraction".
Jupyter Notebook
103
star
71

RE-Context-or-Names

Bert-based models(BERT, MTB, CP) for relation extraction.
Python
101
star
72

AGE

Source code and dataset for KDD 2020 paper "Adaptive Graph Encoder for Attributed Graph Embedding"
Python
99
star
73

TopJudge

Python
97
star
74

Prompt-Transferability

On Transferability of Prompt Tuning for Natural Language Processing
Python
97
star
75

GEAR

Source code for ACL 2019 paper "GEAR: Graph-based Evidence Aggregating and Reasoning for Fact Verification"
Python
95
star
76

HNRE

Hierarchical Neural Relation Extraction
Python
95
star
77

LEVEN

Source code and dataset for ACL2022 Findings Paper "LEVEN: A Large-Scale Chinese Legal Event Detection dataset"
Python
94
star
78

SememePSO-Attack

Code and data of the ACL 2020 paper "Word-level Textual Adversarial Attacking as Combinatorial Optimization"
Python
86
star
79

HMEAE

Source code for EMNLP-IJCNLP 2019 paper "HMEAE: Hierarchical Modular Event Argument Extraction".
Python
85
star
80

XQA

Dataset and baseline for ACL 2019 paper "XQA: A Cross-lingual Open-domain Question Answering Dataset"
Python
84
star
81

ERICA

Source code for ACL 2021 paper "ERICA: Improving Entity and Relation Understanding for Pre-trained Language Models via Contrastive Learning"
Python
83
star
82

CLAIM

78
star
83

TKRL

Representation Learning of Knowledge Graphs with Hierarchical Types (IJCAI-2016)
C++
76
star
84

TLNN

Source code for EMNLP-IJCNLP 2019 paper "Event Detection with Trigger-Aware Lattice Neural Network".
Python
75
star
85

NeuIRPapers

Must-read Papers on Neural Information Retrieval
72
star
86

MMDW

Max-margin DeepWalk
Java
71
star
87

KV-PLM

Source code for "A Deep-learning System Bridging Molecule Structure and Biomedical Text with Comprehension Comparable to Human Professionals"
Python
71
star
88

KNET

Neural Entity Typing with Knowledge Attention
Python
69
star
89

SelectiveMasking

Source code for "Train No Evil: Selective Masking for Task-Guided Pre-Training"
Python
68
star
90

MoEfication

Python
66
star
91

Adv-ED

Source code and dataset for NAACL 2019 paper "Adversarial Training for Weakly Supervised Event Detection".
Python
66
star
92

CorefBERT

Source code for EMNLP 2020 paper "Coreferential Reasoning Learning for Language Representation"
Python
65
star
93

ConversationQueryRewriter

Code and Data for SIGIR 2020 Paper "Few-Shot Generative Conversational Query Rewriting"
Roff
63
star
94

Ouroboros

Ouroboros: Speculative Decoding with Large Model Enhanced Drafting (EMNLP 2024 main)
Python
62
star
95

MuGNN

Source code for ACL2019 paper "Multi-Channel Graph Neural Network for Entity Alignment".
Python
61
star
96

sememe_prediction

Codes for Lexical Sememe Prediction via Word Embeddings and Matrix Factorization (IJCAI 2017).
Python
60
star
97

DIAG-NRE

Source code for ACL 2019 paper "DIAG-NRE: A Neural Pattern Diagnosis Framework for Distantly Supervised Neural Relation Extraction".
Python
59
star
98

topical_word_embeddings

Topical Word Embeddings
Python
57
star
99

QuoteR

Official code and data of the ACL 2022 paper "QuoteR: A Benchmark of Quote Recommendation for Writing"
Python
57
star
100

paragraph2vec

Paragraph Vector Implementation
Python
56
star