readability怎么使用
本篇内容介绍了“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)]))])
返回的信息包括
readability grades可读性指标 sentence info 句子信息 word usage 词语使用 sentence beginnings句子开始
可读性指标
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)])
可读性Kincaid指标
results['readability grades']['Kincaid']
7.442500000000003
“readability怎么使用”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!
本文名称:readability怎么使用
文章来源:http://pwwzsj.com/article/pgejej.html