What is Keyword Density and how to create a script in PHP?

前端 未结 5 1392
天命终不由人
天命终不由人 2020-12-08 17:52

I am working on a project where I have to find out the keyword density of thepage on the basis of URL of that page. I googled a lot but no help and scripts were found, I fou

5条回答
  •  北海茫月
    2020-12-08 18:33

    If the given keyword is "elephant walks", the keyword density would be how often the term "elephant walks" appears on any given web page in relation to other text. As VirtuosiMedia said, this is (broadly) useless information.

    To measure it, you must strip all mark up from the text, count the words while keeping track of how often the keyword(s) appear.

    At that point, you will know, xx.xx % of all words in this text are keywords. xx.xx % of the time , the key word(s) are used next to each other, therefore my keyword density for "elephant walks" is xx

    Again, the only reason this is useful is to demonstrate pattern matching and string functions in php.

提交回复
热议问题