let's go deeply and explore this function:
- download this zip file that contain the script.
- you can edit it with any PHP editor you want, for me i use notepad++ or PHP designer 2007.
- open the file with the editor:
- you will find a comment block telling you how to use this script. for us we will talk about how it works.
- the name of our function is "keyword_extract" it takes a variable $text that contain the text you want to extract keywords from it.
- First line is used to convert the text lowercase state.
- the 2 next lines declare a string that contain all punctuations and explode them using the explode function.
- a foreach loop used to replace each punctuation exploded before with a space character so it will not affect the result.
- declare a $commonWords variable that contain all the common words like "that,this,.." that we will not use in keywords.
- than a block of code used to compare the words available in the text to the common words if it's one of it it will not be counted and will be dumped. if it's not a common word it will be counted.
- each word that is counted more than 3 times, it will be used as a keyword, in the $keyword array.
- from line 89 to line 97:
- first line declare an array and give it array_count_values($keywords) that will take a count for each word in the keywords array.
- arsort($keywords): will sort the array with the index next to it. (count)
- foreach loop will output the result in a clear format. each keyword repeated more than 3 times, will be counted as keyword.
- the output give you the ability to show each keyword how much is repeated in GOOGLE and wordpot.
so be happy and enjoy the script :)
download here
http://www.ziddu.com/download/3537305/keyword_extract.zip.html
6 comments:
Hi i thanks PHP-mag.net for taking this article and publishing it at there website and magazine.:)
you can view it here
Is there any where to download this function as it seems to have been deleted from those sites?
sorry for this inconvinience i have just edited the links:
you can downloaded from megaupload:
http://www.megaupload.com/?d=8GW418FZ
Nice blog. Thats all.
nice information bro...
thanks
Post a Comment