Mercurial > hg > classical
view common/Matcher.h @ 33:84d6acb6b3ba
* Bit more work on track composer identification
author | Chris Cannam |
---|---|
date | Mon, 22 Mar 2010 16:41:01 +0000 |
parents | 8bed05455706 |
children | 271cbaf6e8d9 |
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ #ifndef _CLASSICAL_DATA_MATCHER_H_ #define _CLASSICAL_DATA_MATCHER_H_ #include <dataquay/Uri.h> #include <QHash> namespace ClassicalData { class Composer; class NamedEntity; class Guess { public: Guess(float c, NamedEntity *e) : m_confidence(c), m_entity(e) { } float confidence() const { return m_confidence; } void setConfidence(float c) { m_confidence = c; } NamedEntity *entity() { return m_entity; } void setEntity(NamedEntity *e) { m_entity = e; } bool operator<(const Guess &g) const { return (confidence() > g.confidence()); } private: float m_confidence; NamedEntity *m_entity; }; typedef QList<Guess> GuessList; class Matcher { public: // Results are guaranteed to be returned in order from most to // least confident virtual GuessList match(QString text, int maxResults, float threshold = 0.f) const = 0; }; class ComposerTypingQuickMatcher : public Matcher { public: ComposerTypingQuickMatcher(QList<Composer *> cl); virtual GuessList match(QString text, int maxResults, float threshold = 0.f) const; private: QList<Composer *> m_composers; }; class ComposerTypingThoroughMatcher : public Matcher { public: ComposerTypingThoroughMatcher(QList<Composer *> cl); virtual GuessList match(QString text, int maxResults, float threshold = 0.f) const; private: QList<Composer *> m_composers; }; class ComposerFullTextMatcher : public Matcher { public: ComposerFullTextMatcher(QList<Composer *> cl); virtual GuessList match(QString text, int maxResults, float threshold = 0.f) const; private: QList<Composer *> m_composers; }; } Q_DECLARE_METATYPE(ClassicalData::Guess*); #endif