On Wed, Jul 20, 2011 at 8:16 PM, Ryan Mckenzie <ryan / souliss.com> wrote:
>
> Ok, taking on board all what has been said so far... this is what I'm
> hoping to achieve (short term help needed as I am a beginner) is take a
> list of strings from a text file

Check File#read (either "ri File#read" on the command line, or on
ruby-doc.org). The gist:

data =3D File.read "myfile"

> and run through each string and split it in as many combinations as possi=
ble

There's a lot of splitting possible!

Though, I guess you want to split a sentence into its words, correct?

Either way, String#split is what you want (probably 'A string".split("
")', which splits the string at spaces).

>, then count all the occurences of each new strings that are split and pro=
vide them in the console as an
> output.

Well, once you split your string, you get an Array of chunks (or
tokens, if you prefer): ["A", "string"]. So the question is: Do you
want to get every possible combination, or a subset of these
combinations (as in the example provided in your OP)?

--=20
Phillip Gawlowski

phgaw.posterous.com | twitter.com/phgaw | gplus.to/phgaw

A method of solution is perfect if we can forsee from the start,
and even prove, that following that method we shall attain our aim.
=A0 =A0 =A0 =A0 =A0 =A0 =A0 -- Leibniz