Mercurial > dedupe
diff EditDistance.hpp @ 78:9744ec195be3
Encapsulate EditDistance with caching.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Thu, 10 Oct 2013 01:07:52 +0200 |
| parents | e5fa379d4030 |
| children |
line wrap: on
line diff
--- a/EditDistance.hpp Sat Feb 16 19:00:54 2013 +0100 +++ b/EditDistance.hpp Thu Oct 10 01:07:52 2013 +0200 @@ -1,40 +1,13 @@ #ifndef EDITDISTANCE_HPP #define EDITDISTANCE_HPP -#include "DBCache.hpp" - -template<typename Value> -struct InsertRegulator<OrderedPair<UniqueString>, Value > -{ - uint n; - void start() - { - n = 0; - HuffmanString::getSet().setAutoRebuild(false); - } - - static void finish() - { - HuffmanString::getSet().rebuild(); - HuffmanString::getSet().setAutoRebuild(true); - } - - void next() - { - if (++n == 2048) - HuffmanString::getSet().rebuild(); - } -}; +#include <QtCore/QString> class EditDistance { -protected: - typedef DBCache<OrderedPair<UniqueString>, int, true> cacheType; public: static int Compute(QString a, QString b, bool removeDiacritics = false); static void removeDiacriticsNoCopy(QString& in); static QString removeDiacritics(const QString& in); - - static cacheType* cache; }; #endif //EDITDISTANCE_HPP
