您好,登錄后才能下訂單哦!
本篇內容介紹了“readability怎么使用”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
readability文本可讀性的公式最初都是為英語開發而來,所以目前僅支持英文文本數據。
pip install readability
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting readability
Downloading https://mirrors.aliyun.com/pypi/packages/26/70/6f8750066255d4d2b82b813dd2550e0bd2bee99d026d14088a7b977cd0fc/readability-0.3.1.tar.gz (34 kB)
Building wheels for collected packages: readability
Building wheel for readability (setup.py) ... [?25ldone
[?25h Created wheel for readability: filename=readability-0.3.1-py3-none-any.whl size=35459 sha256=e920a8d6510bd1211df79a944ff03c94f2fea220ae4e5f430e930a52d75595ee
Stored in directory: /Users/thunderhit/Library/Caches/pip/wheels/90/29/a7/726a69748065b8c306b4a935ac2c57e9bc492cb23f355c8e03
Successfully built readability
Installing collected packages: readability
Successfully installed readability-0.3.1
import readability
text = 'Note that tokens are separated by spaces and sentences by newlines.'
results = readability.getmeasures(text, lang='en')
results
OrderedDict([('readability grades',
OrderedDict([('Kincaid', 7.442500000000003),
('ARI', 5.825624999999999),
('Coleman-Liau', 9.532550312500003),
('FleschReadingEase', 55.95250000000002),
('GunningFogIndex', 10.700000000000001),
('LIX', 39.25),
('SMOGIndex', 9.70820393249937),
('RIX', 2.5),
('DaleChallIndex', 9.954550000000001)])),
('sentence info',
OrderedDict([('characters_per_word', 4.9375),
('syll_per_word', 1.6875),
('words_per_sentence', 8.0),
('sentences_per_paragraph', 2.0),
('type_token_ratio', 0.9375),
('characters', 79),
('syllables', 27),
('words', 16),
('wordtypes', 15),
('sentences', 2),
('paragraphs', 1),
('long_words', 5),
('complex_words', 3),
('complex_words_dc', 6)])),
('word usage',
OrderedDict([('tobeverb', 2),
('auxverb', 0),
('conjunction', 1),
('pronoun', 2),
('preposition', 2),
('nominalization', 1)])),
('sentence beginnings',
OrderedDict([('pronoun', 1),
('interrogative', 0),
('article', 0),
('subordination', 0),
('conjunction', 0),
('preposition', 0)]))])
返回的信息包括
results['readability grades']
OrderedDict([('Kincaid', 7.442500000000003),
('ARI', 5.825624999999999),
('Coleman-Liau', 9.532550312500003),
('FleschReadingEase', 55.95250000000002),
('GunningFogIndex', 10.700000000000001),
('LIX', 39.25),
('SMOGIndex', 9.70820393249937),
('RIX', 2.5),
('DaleChallIndex', 9.954550000000001)])
results['readability grades']['Kincaid']
7.442500000000003
“readability怎么使用”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。