【關(guān)于 KeyBERT 】 那些你不知道的事
論文:Sharma, P., & Li, Y. (2019). Self-Supervised Contextual Keyword and Keyphrase Retrieval with Self-Labelling.
論文地址:https://www.preprints.org/manuscript/201908.0073/download/final_file
論文代碼:https://github.com/MaartenGr/KeyBERT
作者:楊夕
項(xiàng)目地址:https://github.com/km1994/nlp_paper_study
個(gè)人介紹:大佬們好,我叫楊夕,該項(xiàng)目主要是本人在研讀頂會(huì)論文和復(fù)現(xiàn)經(jīng)典論文過程中,所見、所思、所想、所聞,可能存在一些理解錯(cuò)誤,希望大佬們多多指正。
【關(guān)于 KeyBERT 】 那些你不知道的事
一、摘要
二、動(dòng)機(jī)
三、論文方法
四、實(shí)踐
4.1 安裝
4.2 KeyBERT 調(diào)用
4.3 語(yǔ)料預(yù)處理
4.4 利用 KeyBert 進(jìn)行關(guān)鍵詞提取
參考
一、摘要
In this paper we propose a novel self-supervised approach of keywords and keyphrases retrieval and extraction by an end-to-end deep learning approach, which is trained by contextually self-labelled corpus.
Our proposed approach is novel to use contextual and semantic features to extract the keywords and has outperformed the state of the art.
Through the experiment the proposed approach has been proved to be better in both semantic meaning and quality than the existing popular algorithms of keyword extraction.
In addition, we propose to use contextual features from bidirectional transformers to automatically label short-sentence corpus with keywords and keyphrases to build the ground truth. This process avoids the human time to label the keywords and do not need any prior knowledge. To the best of our knowledge, our published dataset in this paper is a fine domain-independent corpus of short sentences with labelled keywords and keyphrases in the NLP community.
論文創(chuàng)新點(diǎn):將 預(yù)訓(xùn)練模型 Bert 應(yīng)用于 關(guān)鍵詞提取
二、動(dòng)機(jī)
文本數(shù)據(jù)量增長(zhǎng),關(guān)鍵詞提取 能有效捕獲 文檔或句子 中的關(guān)鍵信息;
上下文語(yǔ)義信息對(duì)于關(guān)鍵詞提取的重要性(the word ‘bank’ could mean a banking organisation, or it could mean river bank. Thus, context is an important aspect. );
傳統(tǒng)的關(guān)鍵詞提取方法在短文本上性能低下;
三、論文方法
介紹:end2end 的關(guān)鍵詞提取方法(注:end2end 表示可以對(duì)無標(biāo)注數(shù)據(jù)自標(biāo)注);
思路:
Domain-independent corpus collection;
corpus cleaning;
corpus self-labelling;
keyword extraction model training by bidirectional LSTM.
The self labelling stage extracted contextual features from the text by leveraging Bidirectional Transformer Encoders, and outperforms the keyword labels obtained from some of the approaches discussed above, such as RAKE [11] and TextRank [14].
四、實(shí)踐
4.1 安裝
pip install keybert
4.2 KeyBERT 調(diào)用
from keybert import KeyBERT
import jieba
model = KeyBERT('distiluse-base-multilingual-cased/')
4.3 語(yǔ)料預(yù)處理
doc = "剛剛,理論計(jì)算機(jī)科學(xué)家、UT Austin 教授、量子計(jì)算先驅(qū) Scott Aaronson 因其「對(duì)量子計(jì)算的開創(chuàng)性貢獻(xiàn)」被授予 2020 年度 ACM 計(jì)算獎(jiǎng)。在獲獎(jiǎng)公告中,ACM 表示:「量子計(jì)算的意義在于利用量子物理學(xué)定律解決傳統(tǒng)計(jì)算機(jī)無法解決或無法在合理時(shí)間內(nèi)解決的難題。Aaronson 的研究展示了計(jì)算復(fù)雜性理論為量子物理學(xué)帶來的新視角,并清晰地界定了量子計(jì)算機(jī)能做什么以及不能做什么。他在推動(dòng)量子優(yōu)越性概念發(fā)展的過程起到了重要作用,奠定了許多量子優(yōu)越性實(shí)驗(yàn)的理論基礎(chǔ)。這些實(shí)驗(yàn)最終證明量子計(jì)算機(jī)可以提供指數(shù)級(jí)的加速,而無需事先構(gòu)建完整的容錯(cuò)量子計(jì)算機(jī)。」 ACM 主席 Gabriele Kotsis 表示:「幾乎沒有什么技術(shù)擁有和量子計(jì)算一樣的潛力。盡管處于職業(yè)生涯的早期,但 Scott Aaronson 因其貢獻(xiàn)的廣度和深度備受同事推崇。他的研究指導(dǎo)了這一新領(lǐng)域的發(fā)展,闡明了它作為領(lǐng)先教育者和卓越傳播者的可能性。值得關(guān)注的是,他的貢獻(xiàn)不僅限于量子計(jì)算,同時(shí)也在諸如計(jì)算復(fù)雜性理論和物理學(xué)等領(lǐng)域產(chǎn)生了重大影響。」"
doc = " ".join(jieba.cut(doc))
doc
>>>
'剛剛 , 理論 計(jì)算機(jī) 科學(xué)家 、 UT Austin 教授 、 量子 計(jì)算 先驅(qū) Scott Aaronson 因 其 「 對(duì) 量子 計(jì)算 的 開創(chuàng)性 貢獻(xiàn) 」 被 授予 2020 年度 ACM 計(jì)算 獎(jiǎng) 。在 獲獎(jiǎng) 公告 中 , ACM 表示 :「 量子 計(jì)算 的 意義 在于 利用 量子 物理學(xué) 定律 解決 傳統(tǒng) 計(jì)算機(jī)無法 解決 或 無法 在 合理 時(shí)間 內(nèi) 解決 的 難題 。Aaronson 的 研究 展示 了 計(jì)算 復(fù)雜性 理論 為 量子 物理學(xué) 帶來 的 新視角 , 并 清晰 地 界定 了 量子 計(jì)算機(jī) 能 做 什么 以及 不能 做 什么 。他 在 推動(dòng) 量子 優(yōu)越性 概念 發(fā)展 的 過程 起到 了 重要 作用 , 奠定 了 許多 量子 優(yōu)越性 實(shí)驗(yàn) 的 理論 基礎(chǔ) 。這些 實(shí)驗(yàn) 最終 證明 量子 計(jì)算機(jī) 可以 提供 指數(shù) 級(jí) 的 加速 , 而 無需 事先 構(gòu)建 完整 的 容錯(cuò) 量子 計(jì)算機(jī) 。」 ACM 主席 Gabriele Kotsis 表示 :「 幾乎 沒有 什么 技術(shù) 擁有 和 量子 計(jì)算 一樣 的 潛力 。盡管 處于 職業(yè)生涯 的 早期 , 但 Scott Aaronson 因 其 貢獻(xiàn) 的 廣度 和 深度 備受 同事 推崇 。他 的 研究 指導(dǎo) 了 這 一新 領(lǐng)域 的 發(fā)展 , 闡明 了 它 作為 領(lǐng)先 教育者 和 卓越 傳播者 的 可能性 。值得 關(guān)注 的 是 , 他 的 貢獻(xiàn) 不僅 限于 量子 計(jì)算 , 同時(shí) 也 在 諸如 計(jì)算 復(fù)雜性 理論 和 物理學(xué) 等 領(lǐng)域 產(chǎn)生 了 重大 影響 。」'
4.4 利用 KeyBert 進(jìn)行關(guān)鍵詞提取
model.extract_keywords(doc, keyphrase_ngram_range=(1, 1))
# docs:待提取關(guān)鍵詞 的 文檔
# keyphrase_ngram_range:提取的短語(yǔ),的詞匯長(zhǎng)度
# stop_words
# top_n:提取 的 關(guān)鍵詞 數(shù)量
>>>
['計(jì)算', '計(jì)算機(jī)無法', '量子', '計(jì)算機(jī)', '物理學(xué)']
參考
Sharma, P., & Li, Y. (2019). Self-Supervised Contextual Keyword and Keyphrase Retrieval with Self-Labelling
KeyBERT github


