![]() |
making sentances into words...
is there a way to let's say load up a .txt file with a bunch of lines of text and extract all the words as a list 1 word per line ? and maybe eliminate any words larger then 2-3 characters?
|
and maybe eliminate any words larger then 2-3 characters? That is going to make it a pretty short list.
|
Quote:
|
this kind of problem is first year computer science stuff, shouldn't be too hard to find a script example out there
|
Good luck to you :)
|
Quote:
and but or if may yes to too she he and randomize them to make sentences? |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
PHP Code:
|
Quote:
|
Quote:
|
Quote:
|
/www is the root directory which means it would be localhost/test.php
|
edit the filename to the one of the txt you already have.
make sure the file is in the same directory as your php script. |
Quote:
|
Quote:
|
Is the wampserver icon in the system tray all white? You only need Apache running. Click the icon, goto Apache, Restart Service
|
Quote:
|
Quote:
|
Click wampserver icon, goto Config Files, goto php.ini
Search for "memory_limit" and change the value from 8M to 128M (You may have to restart the Apache service again) |
Quote:
morning, stay same room keep watch shifts, never more than three asleep time. Hirschel asked. believe. doesn't have windows. angry Cyr's put-down, Jubal said, windows? What does that matter? killer said. still ruling other possibilities. Besides looking each you, don't want have guard windows. Hirschel said, suppose to be : morning stay same room etc etc |
If you right click and View Source it will not be on one line. Otherwise, replace "\n" with "<br>" for html output.
Revised code to remove extra chars. PHP Code:
|
everything worked.... thanks for your help man you rock :bowdown:)
|
btw do you have icq/skype? i might need more small scripts (next one i wont be asking for free :) )
|
np.
Just post your problems on GFY, it gives some of us something to do besides look at boobies on an "adult" message board. |
One more revision that will give you a listing of unique words (no duplicates).
PHP Code:
|
Quote:
|
btw that latest code you gave gives me this error "Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\test3.php on line 13" maybe file too big ?
|
yah, i down sized file like 10x smaller, and it worked.... :winkwink:
|
You know, if you have 6gb of RAM you can use it all. Change the memory_limit to 512MB or 1024MB.
|
Quote:
|
Yes, that too. I usually set my localhost to 300 seconds (5 minutes).
|
Quote:
|
one more thing, in php.ini should it be
memory_limit = 1024M OR memory_limit = 1024 does it need to have M at the end ? thx :winkwink: |
I am not 100% sure but I believe it works on a system like "100K", "100M", "100G", so the "M" would be necessary. Sorry I'm a programmer not a system admin. :)
|
Quote:
|
hey ProG, anyway you can make me another simple script? to check for any empty lines and lines that start with 0-9 or some weird symbols (such as -,---,===,%---, etc, etc) and remove those lines ? :) basically to remove any empty lines and lines that start with anything other then a valid character (a-z or A-Z)
|
Quote:
if I understand what you are asking for, this will do it nicely: Code:
<?php |
also note that I used <br> for html output instead of \n so if you need it for your text file use then you should change that part
|
Good luck!
|
im not sure that something like that is exist
|
Quote:
|
Sentances?
Might wanna incorporate a spell checker into this thing too.. Sorry.. had to be said.. :) |
Quote:
|
learn word and will be easy
|
Quote:
|
Quote:
|
Quote:
|
All times are GMT -7. The time now is 04:00 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc