niubbone Posted June 21, 2010 Share Posted June 21, 2010 Hi community,I'm almost sure you can do this, and i think it may be a bit hard, so it's just an idea more than a real project. I was wondering if it's possible to open any kind of file in txt format (also by renaming them .txt) and check into them full lenght deep for the largest recursive string.The main idea behind this is:1)Do some exercise with strings.2)While doing point 1, creating a very rough compression algorithm to compress files.So the idea behind this is this:For example i have a txt file like this:abcdedf34rf4rg45gt4kkkefglo6ssas-èàpoªבᇖ㱠݊abcderhukty45tttttttr4tttrtrr4fqqf657kkksdfgvrtg56h67i8ok,poòèàè+ùuylktttttttr4tttfvtyh87i795tr653And so on. I colored some recursive strings you can find in the file. The idea is to open any file, scan the given file for the largest recursive string, then convert it to a shorter one and substitute it to the original one.Example: tttttttr4ttt would become a random charachters set(maybe done with Chr(Random(1,500,1) or just decided by me) like 12XY. So all the tttttttr4ttt would be replaced with 12XY and the file would be smaller. Decompressing would be the opposite. All the corrispondences (12XY would be stored in the file or in a ini file and deleted after decompressing is done. Is this possible/worth a try? Link to comment Share on other sites More sharing options...
jchd Posted June 21, 2010 Share Posted June 21, 2010 You are confusing "recursion" and "repetition". Anyway, try by "simply" follow your agenda and imagine a general algorithm able to determine the string with will be the first best candidate for compression (most repeated and largest). Hint: in your example string, if abcde is repeated 5 times or more, it becomes a better choice than tttttttr4ttt which is only there twice. That itself would be a very good exercise. Then find out how you could go through the whole file by making such substitutions one after the other. Then estimate the complexity of your algorithm. Then study a classical scheme (eg. ZLW) and find avenues of improvement. You'll learn a lot. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
UEZ Posted June 21, 2010 Share Posted June 21, 2010 Here are some examples about compression: http://www.autoitscript.com/forum/index.php?showtopic=112273 http://www.autoitscript.com/forum/index.php?showtopic=77988 http://www.autoitscript.com/forum/index.php?showtopic=87441 http://www.autoitscript.com/forum/index.php?showtopic=113794 BR, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
niubbone Posted June 24, 2010 Author Share Posted June 24, 2010 Thanks. On my way to learning. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now