Friday, February 5, 2010

How to split a paragraph to individual words?

I need to split a large document to individual words so that I can use them to make a dictionary (not in English).


For Ex:


above sentence in,


I


need


to


split


a


large


document...........and so on





Is this possible from MS word or is there any other software to do this?


Thanks in advanceHow to split a paragraph to individual words?
I can write a PHP script real easy for ya to do that.





%26lt;?php


$theString = ';I need to split a large document to individual words so that I can use them to make a dictionary.';;


$stringArray = explode('; ';,$theString);


foreach($stringArray as $tmp_part)


{


echo $tmp_part . ';
';;


}


?%26gt;





That will give you the desired effect printed out to your browser.





Have fun,


ChadHow to split a paragraph to individual words?
Probably the easiest way is to highlight the entire text, then do a Find And Replace.





In the ';Search for'; box, press your space bar twice. You have just asked Word to search for every occurance of a double space (like at the end of a sentance). In the ';Replace with'; box, press your space bar. You have now formatted your entire document so that all the words have only 1 space between them.





Go back to Find and Replace and in the Find box, enter a space. In the Replace box, press your %26lt;Enter%26gt; key.





Since there is a space between every word, it will now replace that space with a new paragraph, thus leaving your document in the form you show above.





Now if you want to be REALLY tricky, you can highlight all your text and do a ';Sort by'; on it, thus putting all the words in alphabetical order if you desire.
In MS word I would say use Edit -%26gt; find/replace and replace all spaces with return or new paragraph or whatever you want to call it. You might have to copy two lines after hitting return in the document and paste that into the replace field.
Do this:





1. Press CTRL/H.


2. In the Find What text box, put a single space.


3. Click in the Replace With text box and insert the characters ^p or click the Special button and select Paragraph Mark.


4. Click Replace All.





Hope that helps.

No comments:

Post a Comment