[BC] Abstract format

Hello,

Initially this PR should simply abstract format to be able to introduce other formatters that save learned data not in file, but somewhere else (e.g. db, apc, memcached, etc). But ended up with complete rewrite of the whole project (in comparison to the size of the project itself). Thus it includes a lot of breaking changes. Hopefully it has a change for merge.

If this PR is merged I'm planning to build a bundle based on this lib.

Regards,
Alex