本篇內(nèi)容介紹了“readability怎么使用”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
成都網(wǎng)站設(shè)計、網(wǎng)站制作,成都做網(wǎng)站公司-創(chuàng)新互聯(lián)建站已向成百上千企業(yè)提供了,網(wǎng)站設(shè)計,網(wǎng)站制作,網(wǎng)絡(luò)營銷等服務(wù)!設(shè)計與技術(shù)結(jié)合,多年網(wǎng)站推廣經(jīng)驗,合理的價格為您打造企業(yè)品質(zhì)網(wǎng)站。
readability文本可讀性的公式最初都是為英語開發(fā)而來,所以目前僅支持英文文本數(shù)據(jù)。
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怎么使用”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!