To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / common / EditDistance.h
History | View | Annotate | Download (531 Bytes)
| 1 |
|
|---|---|
| 2 |
#ifndef _EDIT_DISTANCE_H_
|
| 3 |
#define _EDIT_DISTANCE_H_
|
| 4 |
|
| 5 |
#include <alloca.h> |
| 6 |
|
| 7 |
#include <QString> |
| 8 |
|
| 9 |
namespace ClassicalData {
|
| 10 |
|
| 11 |
class EditDistance |
| 12 |
{
|
| 13 |
public:
|
| 14 |
enum TranspositionMode {
|
| 15 |
NoTransposition, |
| 16 |
RestrictedTransposition |
| 17 |
}; |
| 18 |
|
| 19 |
EditDistance(TranspositionMode tm = RestrictedTransposition) : |
| 20 |
m_transpositionMode(tm) { }
|
| 21 |
|
| 22 |
int calculate(QString a, QString b, int threshold = 0); |
| 23 |
|
| 24 |
private:
|
| 25 |
TranspositionMode m_transpositionMode; |
| 26 |
int m_editPenalty;
|
| 27 |
int m_suffixPenalty;
|
| 28 |
bool m_normalise;
|
| 29 |
}; |
| 30 |
|
| 31 |
} |
| 32 |
|
| 33 |
#endif
|
| 34 |
|
| 35 |
|