help needed to assign score to words

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Rahul Dev
Forum Newbie
Posts: 18
Joined: Thu Dec 09, 2010 4:54 am

help needed to assign score to words

Post by Rahul Dev »

Hello guys, i need some help in assigning a score to a word according to its occurrence in a group of sentences.

<?php
$words="Hello how are you";
$word_array = explode(" ", $words);

$paragraph="Hello! I am fine. How about you? You look good.";
$sencetences = strtok($paragraph, ".!?");
?>

now i'm trying to assign a score to each word in $words e.g Hello=1, how=1, are=0, you=2.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: help needed to assign score to words

Post by VladSun »

You have series of related posts here... I'm wondering what are you trying to do?
It seems to me that you want to implement the FULL TEXT search functionality in PHP.
Read this first :

http://dev.mysql.com/doc/refman/5.5/en/ ... earch.html
http://devzone.zend.com/article/1304

Notice the http://dev.mysql.com/doc/refman/5.5/en/ ... words.html - most of your posts here are related to the problem solved there.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply