PyTextRank---文本關鍵字(keywords)的自動取出
1 引言
從文本中抽取出關鍵字是自然語言處理NLP的一個重要應用領域。在《文本摘要生成的確定過程和隨機過程》中曾經討論過兩種摘要的產生方法。不幸的是, Gensim從4.0版本開始,移除了summarization模塊(目前的安裝版本是V4.0.1),因此不能再使用gensim產生摘要和關鍵字。作為一種代替,我們使用PyTextRank庫來取出關鍵字。
2 PyTextRank簡介
PyTextRank是TextRank的一個Python實現,而TextRank是一種基于圖的關鍵詞和句子的提取算法, 它類似于谷歌的頁面排名算法。作為spaCy管道的擴展,用于基于圖的自然語言處理以及相關知識圖譜實踐以及文本提取短語和簡要總結。PyTextRank目前安裝的版本是V3.1.1. 這個庫的主要用途包括:短語提取---即關鍵字提取, 從文本文件中獲取排名靠前的短語; 對文本文件進行低成本的提取總結, 即產生摘要; 幫助從非結構化的文本中推斷出概念,使之成為更多的結構化表述, 即生成有意義的核心句子.
3 提取關鍵字
下面的例子顯示如何使用PyTextRank從一段文本中提取關鍵字. 這段文本取自Mandalawi M.A.等人(2019)的論文摘要. 該論文的題目是: Modelling and Analyses of Rock Bridge Fracture and Step-Path Failure in Open-Pit Mine Rock Slope(露天礦邊坡巖橋斷裂和階梯狀破壞的模擬與分析). 在原始的論文中, 作者給出的關鍵字有: Rock bridges, Rock slope stability, Tensile cracks, Shear cracks.
按照排名順序, 使用程序抽出的關鍵字結果如下, 在這里略去了字符長度小于14的關鍵字:
intact rock bridges
pre-existing discontinuities
different pre-existing discontinuities
steeper dip angles
slope stability
Proposed slope models
crack initiation
less steep rock bridge angles
instability mode
Tensile fracture
neigh boring structures
the rock bridge angle
Larger structures
the intact rock bridges
the intact rock fracturing hypothesis
Step-path failure
step-path failure
man-made and natural rock slopes
consequently reduced slope instability
Major joint plane spacing
Rock Bridge Fracture
shear and tensile failure
two selected slope simulations
the rock masses
the slope surface
relative deformations
Open-Pit Mine Rock Slope
explicit large-scale structures
the Handlebar Hill open - pit mine
the extension cracks
the propagation
much higher potential
the progressively cracks development
four joint-net distributions
The continuum finite element method
these fractures
The empirical models
這些抽取的關鍵字可以作為連接其它文檔的基礎.
工程師必備
- 項目客服
- 培訓客服
- 平臺客服
TOP




















