Mercurial > hg > classical
diff common/EditDistance.h @ 11:98047b91b09d classical-rdf
* Add "proper" composer name matching from user input. Needs to be faster
though
author | Chris Cannam |
---|---|
date | Thu, 18 Feb 2010 18:16:43 +0000 |
parents | |
children | a1d67e136c30 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/EditDistance.h Thu Feb 18 18:16:43 2010 +0000 @@ -0,0 +1,41 @@ + +#ifndef _EDIT_DISTANCE_H_ +#define _EDIT_DISTANCE_H_ + +#include <alloca.h> + +#include <QString> + +namespace ClassicalData { + +class EditDistance +{ +public: + enum TranspositionMode { + NoTransposition, + RestrictedTransposition + }; + + EditDistance(TranspositionMode tm = RestrictedTransposition, + int editPenalty = 1, + int suffixPenalty = 1, + bool normalise = true) : + m_transpositionMode(tm), + m_editPenalty(editPenalty), + m_suffixPenalty(suffixPenalty), + m_normalise(normalise) { } + + int calculate(QString a, QString b); + +private: + TranspositionMode m_transpositionMode; + int m_editPenalty; + int m_suffixPenalty; + bool m_normalise; +}; + +} + +#endif + +