0

hi i am trying to write a method to see whether the word 'not' appears before a positive or negative word then i want to +1 to the negative count and -1 from the negative count any idea how to do this, i already a 2 methods which count how many times the positive and negative words appear

// Gets the positive words and check for the word in the text  
while($check = mysql_fetch_assoc($pos)){
  $lower = mb_strtolower($check['word']);
 if(isset($cnt_r[$lower])){
	$good+= $cnt_r[$lower];
   	echo "<p>" . $check['word'] . "</p>";
    $review_text = preg_replace("/\b{$check['word']}\b/", "<span class=\"goodword\">{$check['word']}</span>" , $review_text);
	} 
}

// Gets the negative words and check for the word in the text 
while($check = mysql_fetch_assoc($neg)){
  $lower = mb_strtolower($check['word']);
 if(isset($cnt_r[$lower])){
	$bad+= $cnt_r[$lower];
  	echo "<p>" . $check['word'] . "</p>";
    $review_text = preg_replace("/\b{$check['word']}\b/", "<span class=\"badword\">{$check['word']}</span>" , $review_text);

	} 
 }

Edited by cr7489: n/a

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by cr7489
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.