[Much revised web site flux@modeemi.fi**20091001192503] { hunk ./ganame.html 5 + hunk ./ganame.html 8 -

Ganame - A Genetic Algorithm -Based File Renaming Tool

-

So should it be called AGABFRT instead? AGABaFiReT? - -

Author: Erkki Seppälä <flux@modeemi.fi>, aka flux (on IRCNet, FreeNode). +

+ +
+

Ganame - A Genetic Algorithm -Based File Renaming Tool

+

So should it be called AGABFRT instead? AGABaFiReT?

hunk ./ganame.html 22 -

Ganame is a small toy that turned out to have some slight - real-world usage potential also. The use case is this: you want to - rename a bunch of files with some pattern, but you don't know how - to express this pattern; perhaps you haven't yet mastered the Perl - regular expressions and the s//-operator, or a certain detail of - them has slipped your mind. Here Ganame comes into rescue: you - provide it a set of examples and it tries to figure out the - pattern in them. +

Author: Erkki Seppälä <flux@modeemi.fi>, aka flux (on IRCNet, FreeNode).

hunk ./ganame.html 24 -

Mind you, the pattern cannot be particularly complex, atleast - not at the moment. Basically characters can be skipped, spaces can - be converted to underscores and vice versa, the same with - uppercase and lowercase, and changes in case and a fixed set of - separators can be detected. It can also detect added strings, and - infact without sufficient examples (ie. only one) it can easily - diverge to using those. Also simple mappings are handled. +

Ganame is a small toy that turned out to have some slight + real-world usage potential also. The use case is this: you want to + rename a bunch of files with some pattern, but you don't know how + to express this pattern; perhaps you haven't yet mastered the Perl + regular expressions and the s//-operator, or a certain detail of + them has slipped your mind. Here Ganame comes into rescue: you + provide it a set of examples and it tries to figure out the + pattern in them.

hunk ./ganame.html 33 -

I just want to try it out, now!

- -

Okay. So I put a demo form up. - I put in a limit of handling only one request concurrently, but - it appears the host I'm running it is faster than my laptop, so - it is practically instantaneous anyway. I hope the load doesn't - become a problem. +

Mind you, the pattern cannot be particularly complex, atleast + not at the moment. Basically characters can be skipped, spaces can + be converted to underscores and vice versa, the same with + uppercase and lowercase, and changes in case and a fixed set of + separators can be detected. It can also detect added strings, and + infact without sufficient examples (ie. only one) it can easily + diverge to using those. Also simple mappings are handled.

hunk ./ganame.html 41 -

It doesn't work!

+

I just want to try it out, now!

+ +

Okay. So I put a demo form up. + I put in a limit of handling only one request concurrently, but + it appears the host I'm running it is faster than my laptop, so + it is practically instantaneous anyway. I hope the load doesn't + become a problem.

hunk ./ganame.html 49 -

Could happen. After all, it's basically just randomly evaluating - predetermined rules if they fit. If you find it's giving wrong - results, try giving it more examples. +

It doesn't work!

hunk ./ganame.html 51 -

License

+

Could happen. After all, it's basically just randomly evaluating + predetermined rules if they fit. If you find it's giving wrong + results, try giving it more examples.

hunk ./ganame.html 55 - The software is licensed under - the BSD - license without the advertising clause. +

Downloading

hunk ./ganame.html 57 - The software uses these two modules for core functionality: + Ganame is available from its Darcs repository. + +

Building

hunk ./ganame.html 61 -

levenstein.ml originates from - Berke Durak's O'Caml software page and it is - apparently under Public Domain, although the page isn't quite - exact about it. +

To build it, you will + need O'Caml compiler (atleast + 3.10.x due to ocamlbuild), findlib, + and ExtLib + (in Ubuntu apt-get install ocaml-nox ocaml-findlib + libextlib-ocaml-dev). After that you may run:

hunk ./ganame.html 68 -

genepool.mli and - genepool.ml originate from - Alex - Rubinsteyn's GenePool which is licensed under LGPL v3. It is also - slightly modified to allow custom comparison of fitness. +

% ocamlbuild ganame.native
hunk ./ganame.html 70 -

Downloading

+

You may install the binary with:

hunk ./ganame.html 72 - Ganame is available from its Darcs repository. - -

Building

+
% sudo install ganame.native /usr/local/bin/ganame
hunk ./ganame.html 74 -

To build it, you will - need O'Caml compiler (atleast - 3.10.x due to ocamlbuild), findlib, - and ExtLib - (in Ubuntu apt-get install ocaml-nox ocaml-findlib - libextlib-ocaml-dev). After that you may run: +

Or perhaps you want to install it to ~/bin instead.

hunk ./ganame.html 76 -
% ocamlbuild ganame.native
+

Using

hunk ./ganame.html 78 -

You may install the binary with: +

% ganame IMG_1234.JPG=img_1234.JPG -- *.JPG
hunk ./ganame.html 80 -
% sudo install ganame.native /usr/local/bin/ganame
+

In this instance and by luck in my test with a previous version, this produced the following plan:

+ +

Until(Separator,MapCopy(Lowercase)),Until(Separator,Copy),Until(ChangeCase,Copy),Until(ChangeCase,Copy)

hunk ./ganame.html 84 -

Or perhaps you want to install it to ~/bin instead. +

Note that it didn't figure out that the . is a separator and it + could've been used instead of detecting 'changed case' (numbers + are considered to be lowercase at the moment).

hunk ./ganame.html 88 -

Using

+

After running it (it will finish in at most 10 seconds; slower + or more heavily loaded hosts may get worse results), it will first + list the renames it would perform and then interactively ask, if + you wish to commit. If you just want to see what kind of plan it + would produce, you may omit the -- and the file names.

hunk ./ganame.html 94 -
% ganame IMG_1234.JPG=img_1234.JPG -- *.JPG
+

Acknowledgements

hunk ./ganame.html 96 -

In this instance and by luck in my test with a previous version, this produced the following plan: - -

Until(Separator,MapCopy(Lowercase)),Until(Separator,Copy),Until(ChangeCase,Copy),Until(ChangeCase,Copy) +

I would've never tried this out if I hadn't read the + book Essentials + of Metaheuristics (well, atleast the first few + chapters..). It's a very practical-oriented good read.

hunk ./ganame.html 101 -

Note that it didn't figure out that the . is a separator and it - could've been used instead of detecting 'changed case' (numbers - are considered to be lowercase at the moment). +

License

hunk ./ganame.html 103 -

After running it (it will finish in at most 10 seconds; slower - or more heavily loaded hosts may get worse results), it will first - list the renames it would perform and then interactively ask, if - you wish to commit. If you just want to see what kind of plan it - would produce, you may omit the -- and the file names. + The software is licensed under + the BSD + license without the advertising clause. hunk ./ganame.html 107 -

Acknowledgements

+ The software uses these two modules for core functionality: hunk ./ganame.html 109 -

I would've never tried this out if I hadn't read the - book Essentials - of Metaheuristics (well, atleast the first few - chapters..). It's a very practical-oriented good read. +

levenstein.ml originates from + Berke Durak's O'Caml software page and it is + apparently under Public Domain, although the page isn't quite + exact about it.

hunk ./ganame.html 114 +

genepool.mli and + genepool.ml originate from + Alex + Rubinsteyn's GenePool which is licensed under LGPL v3. It is also + slightly modified to allow custom comparison of fitness.

+
addfile ./layout.css hunk ./layout.css 1 +body, html { + background-color: #2caad2; + color: black; + font-family: sans-serif; +} + +h1 { + font-family: courier; + font-size: 150%; + text-align: center; +} + +h2 { + font-family: courier; + font-size: 120%; + margin: 10px 1em; +} + +.command { + font-family: courier; + font-weight: bold; + font-color: #ffffff; +} + +a:link { + color: darkblue; +} + +#content { + float:right; + clear:none; + margin: 0 auto; + width:85%; +} + +#sidebar { + float:left; + clear:none; + margin: 5em 1em; + padding: 0; + text-align: center; +} + +#sidebar a { + display: block; +} }