split string into words

by alexts
4 replies
Hi,

I have following string:

"ilikewarriorforum"

How do i detect english words and split them into array that would contain the following:

Array
(
[0] => i
[1] => like
[2] => warrior
[3]=> forum
)

Can someone point me to the right direction.
I code in PHP
Any help would be appreciated.
#split #string #words
  • Profile picture of the author mojojuju
    There was a discussion about this once before and it seemed a lot of people were interested in it. I wish I could find it. I do remember that nobody here came up with an effective way of doing what you're asking.

    One of the problems is that a text string may have more than one combination of words. I suppose things would be made easier if the words to find in the string came from a very limited dictionary.

    Anyhow, I hope somebody else chimes in..
    Signature

    :)

    {{ DiscussionBoard.errors[3098235].message }}
  • Profile picture of the author phpbbxpert
    Which is also using a dictionary.
    No mater how you look at tackling this in any coding language it is going to require a dictionary of words to match against. And even then you would probably need an algorithm for checking against another list of common multiples that would be used together in a string.
    {{ DiscussionBoard.errors[3098746].message }}

Trending Topics