Added vectorization, document ranking, similarity functions. Refactored existing arch. [unit tests=yes]