php function to detect if the string text is meaningful text [duplicate]

泪湿孤枕 提交于 2019-12-25 19:05:59

问题


Possible Duplicate:
Is there any way to detect strings like putjbtghguhjjjanika?
php check if the string is real

I want to make a php function that handle a text string and path it to a special algorithm to detect if this text is meaningful or not, and rate the text from 0 to 100% readability score.

For example:

"skjg askjf akdjf akdjf " will take about 30%. "Hello guys" 90%. "ahdkjshdkjshdkljshdlksjdh" 10% or less.

I hope that make sense.


回答1:


Here is something to check out: https://github.com/DaveChild/Text-Statistics

This project describes itself as:

The PHP Text Statistics class will help you to indentify issues with your website content, especially with readability. It allows you to measure the readability of text using common scoring systems, including:

  • Flesch Kincaid Reading Ease
  • Flesch Kincaid Grade Level
  • Gunning Fog Score
  • Coleman Liau Index
  • SMOG Index
  • Automated Reability Index

The code that generates the statistics is in a simple class structure. There are also several unit test classes to ensure that changes made don't break existing functionality. There is also a live version of this tool.



来源:https://stackoverflow.com/questions/7788981/php-function-to-detect-if-the-string-text-is-meaningful-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!