williamh69 Posted May 5, 2014 Share Posted May 5, 2014 Hi guys, thank so much for all your help. I have this question: I have a two tables one is a content text, and the other one there are the stop words. I would like to match my content with those stop words and echo them, before submit to db. content stopwords content_id words content any suggestion thank you Quote Link to comment https://forums.phpfreaks.com/topic/288255-echo-stop-words-before-enter-to-db/ Share on other sites More sharing options...
ginerjm Posted May 5, 2014 Share Posted May 5, 2014 huh? wassa a stop word? Quote Link to comment https://forums.phpfreaks.com/topic/288255-echo-stop-words-before-enter-to-db/#findComment-1478262 Share on other sites More sharing options...
williamh69 Posted May 5, 2014 Author Share Posted May 5, 2014 Some search engines don't record extremely common words in order to save space or to speed up searches. These are known as "stop words." Quote Link to comment https://forums.phpfreaks.com/topic/288255-echo-stop-words-before-enter-to-db/#findComment-1478263 Share on other sites More sharing options...
ginerjm Posted May 5, 2014 Share Posted May 5, 2014 ok - so what do you want to do? Look for stop words in the input and echo them back to the user? Why? Quote Link to comment https://forums.phpfreaks.com/topic/288255-echo-stop-words-before-enter-to-db/#findComment-1478265 Share on other sites More sharing options...
williamh69 Posted May 5, 2014 Author Share Posted May 5, 2014 no,,, look for the stop words in the text, echo them back, (so like this you can delete manually or using any function to erase it) before enter to database. Quote Link to comment https://forums.phpfreaks.com/topic/288255-echo-stop-words-before-enter-to-db/#findComment-1478267 Share on other sites More sharing options...
williamh69 Posted May 5, 2014 Author Share Posted May 5, 2014 i found this class to use it <?php class Cleaner { var $stopwords = array(" find ", " about ", " me ", " ever ", " each ", " update ", " delete ", " add ", " insert ", " where ", " i ", " a ", " my ");//you need to extend this big time. var $symbols = array('/','\\','\'','"',',','.','<','>','?',';',':','[',']','{','}','|','=','+', '-','_',')','(','*','&','^','%','$','#','@','!','~','`'); function parseString($string) { $string = ' '.$string.' '; $string = $this->removeStopwords($string); $string = $this->removeSymbols($string); return $string; } function removeStopwords($string) { for ($i = 0; $i < sizeof($this->stopwords); $i++) { $string = str_replace($this->stopwords[$i],' ',$string); } return trim($string); } function removeSymbols($string) { for ($i = 0; $i < sizeof($this->symbols); $i++) { $string = str_replace($this->symbols[$i],' ',$string); } return trim($string); } } Quote Link to comment https://forums.phpfreaks.com/topic/288255-echo-stop-words-before-enter-to-db/#findComment-1478268 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.