![]() |
Remove duplicates from text array?
Hi guys,
How can I remove duplicates from a text (.txt) file that contain list of Arabic words consider that these words in Arabic alphabet not in Latin alphabet but they are in the (UTF-8) Encodeing? Please help me I am in a project to provide a spell checker for Arabic in the hunspell project. It is under GPL too. Thanks, Mohammad Alhobayyeb |
Duplicate words?
PHP Code:
-m |
Duplicate words?
PHP Code:
-m edit: Btw this method is assuming each word is on its own line. You may have to get a little more complex if they're all on the same line or delimited in a different way. |
Hi,
It is very good, but see what I faced: Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 4097 bytes) in /var/www/test/test.php on line 8 is there any way to check for duplicates from a file or from a MySQL table instead of array? |
Up!up!up!up!
|
In MySQL you could write a query like the following:
sql Code:
This will get you a list of the `fieldwithdupes` in `atable` and the number of times that they are repeated. You could adapt this query to your needs. |
I think he wants to select only the distinct words. In which case, this query would work perfectly:
Code:
SELECT DISTINCT(word) FROM table_name GROUP BY word |
| All times are GMT. The time now is 06:43 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0