note 32426 deleted from function.preg-split by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 12:35:29 +0000 |
| Subject: | note 32426 deleted from function.preg-split by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57494@lists.php.net to get a copy of this message | ||
Note Submitter: chris@mad-teaparty.com
----
I normally use this to create a word index from any kind of text:
// e.g. we have a text in British English
setlocale(LC_ALL, "en_UK");
$words = preg_split("/[^[:alpha:]]+/", $text, -1, PREG_SPLIT_NO_EMPTY);
You may also walk through this array and erase all small and common words/auxiliaries (e.g.
"and", "while", "his", "them").