Hi,
I asked the same question two days ago, but i have not received an answer
that could really help me on my way... So i'll try again, this time with
the help of a little PHP code, and soms explanations
while($myrow = mysql_fetch_row($result)) # as long as there are texts in
the database
{
$text = $myrow[0]; # variabele text contains the text
$array = array(); # variabele array is an empty array
$modText = strtolower($text); #modify text: string to lower case
$array = split(" ",$modText); #split text after empty space to create array
of words
# i would like a similar function that removes interpuntuation like "." etc.
# all i want remaining in the array are the separate words, all in lower
case
sort($array); # sort array elements in alphabetical order
$num = count($array); # count the number of elements in the array
for ($c=0; $c<=$num; $c++) #as long as function has nog reached past last
element in array
{
$wordInText = $array[$c]; #array element is word in text
echo "$wordInText<br>"; #print word in text
}
# i would like a function that pushes this word into a second array.
# before pushing, it has to check whether or not the same word is already
in the array.
# if it is: do not push word into array, but add "1" to the number of occurrences
of that word
# if it is not: push this new word into array
# all of this has to result into a word - frequency array (content analysis
of free text)
# question 1: how do i produce such an array?
# question 2: how do i get the two elements (word and number of occurrences)
# together out of the array and print them to the screen?
# f.e.: the word "computer" occurred two times in this text.
}
I do hope there is someone out there who can help me with this problem, and
help me fast....
Thnx in advance!!
Dore.
+++++++++++++++++++++++++++++++++++
N Dore van Hoorn
S s1000454 AlfaInformatica-RuG
E [EMAIL PROTECTED]
W http://www.let.rug.nl/~s1000454
+++++++++++++++++++++++++++++++++++
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php