Ik heb mijn Auto Keyword Generator af. Met een beetje hulp van sommigen van jullie. Ik denk ik deel hem hier dan hebben jullie er misschien nog wat aan.
edit test hem op: http://aldi.xs4all.nl/~koen/autokey/keywordgen2.php
edit test hem op: http://aldi.xs4all.nl/~koen/autokey/keywordgen2.php
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
| <? //---------------------------------------------------------- // Functie GetKeywords(url) //---------------------------------------------------------- // // Input: // url : Web site adress eg: http://www.slashdot.org //---------------------------------------------------------- // // Returns // true : Keywords for this url as a comma seperated list //---------------------------------------------------------- function GetKeywords($url) { if(!$url) { // If no URL is given stop. exit(); } // Get given URL $content_array = file($url); $parsestring = implode("", $content_array); $size = strlen($content); // Convert line brakes to spaces $parsestring = ereg_replace("[ \r\n\f\t\v]+\\|[ \r\n\f\t\v]+", " ", $parsestring); // Filter out comments, <style> and <script> $parsestring = preg_replace("<!--.*-->",' ',$parsestring); $parsestring = preg_replace("/<(script)[^>]*>.+<\/(script)[^>]*>/is",' ',$parsestring); $parsestring = preg_replace("/<(style)[^>]*>.+<\/(style)[^>]*>/is",' ',$parsestring); // Filter out html-tags $parsestring = strtolower( $parsestring ); $parsestring = strip_tags( $parsestring ); // Re-encode characters $trans_tbl = get_html_translation_table (HTML_ENTITIES); $trans_tbl = array_flip ($trans_tbl); $parsestring = strtr ($parsestring, $trans_tbl); // Piano's -> Piano $parsestring = preg_replace("/[a-zA-Z](){1}[a-zA-Z]/",'',$parsestring); $parsestring = preg_replace("/(){1}[a-zA-Z]/",'',$parsestring); // Filter " ' entities $parsestring = preg_replace("/()[1-9](;)/",'',$parsestring); // Filter nasty characters $ugly_characters = array(".",",","<",">","/","?",";",":","\'","\"","\\","|","[","{","]","}"," -","- ","--","_","=","+","!","@","#","$","%","^","&","*","(",")","»","'","\""); foreach( $ugly_characters as $character ) { $parsestring = str_replace ($character, " ", $parsestring); } // Filter numbers $parsestring = preg_replace ('/[\s][^a-zA-Z]*[\d][^a-zA-Z]*[\s]/', "", $parsestring); // Separate words $parsestring = preg_replace ('/[\s]+/', ";", $parsestring); // Filter small words $parsestring = preg_replace ('/;[a-zA-Z\s]{1,2};/', ";", $parsestring); $parsestring = preg_replace ('/;[\s\r\n\f\t\v]+;/', ";", $parsestring); $wordsarray = explode(";", $parsestring); // Now we have a nice words array... sort ( $wordsarray ); // Just sort it... // Read in the bad words! $filename = "./badwords.inc.php"; $fd = fopen ($filename, "r"); $badwords = fread ($fd, filesize ($filename)); fclose ($fd); // Make an array out of it $badwordsarray = split(" ",$badwords); // Check if bad, else count for ($i=0; $i<count($wordsarray); $i++) { $word = $wordsarray[$i]; if (strlen( $word ) > 2) // Is the word longe than 2 chars? { if( !in_array ($word, $badwordsarray)) // Is it a bad word? (thanx tomaske) { if ($freqarray[$word]) { $freqarray[$word] += 1; } else { $freqarray[$word]=1; } } } } // Sort by count arsort($freqarray); array_splice ($freqarray, 20); while (list($key, $val) = each($freqarray)) { $pagecontents .= "[$key] => $val<br>"; $keys .= $key.", "; } chop($keys); return keys; } ?> |
[ Voor 34% gewijzigd door Verwijderd op 21-11-2002 23:51 ]