Version: 9.15.0
SUIT_tools::SUIT_SentenceMatcher Class Reference

Approximate string matcher, treats strings as sentences composed of words. More...

#include <SUIT_SentenceMatcher.h>

Public Member Functions

 SUIT_SentenceMatcher ()
 
void setUseExactWordOrder (bool theOn)
 
void setUseFuzzyWords (bool theOn)
 
void setCaseSensitive (bool theOn)
 
bool isCaseSensitive () const
 
void setQuery (QString theQuery)
 
const QString & getQuery () const
 
double match (const QString &theInputString) const
 
QString toString () const
 For debug. More...
 

Static Private Member Functions

static bool makePermutatedSentences (const QStringList &theWords, QList< QStringList > &theSentences)
 
static void makeFuzzyWords (const QStringList &theWords, QStringList &theFuzzyWords)
 
static int matchWithSentenceIgnoreEndings (const QString &theInputString, const QStringList &theSentence, bool theCaseSensitive)
 
static int matchWithSentencesIgnoreEndings (const QString &theInputString, const QList< QStringList > &theSentences, bool theCaseSensitive)
 
static int matchAtLeastOneWord (const QString &theInputString, const QStringList &theWords, bool theCaseSensitive)
 
static int match (const QString &theInputString, const QStringList &theSentence, bool theCaseSensitive)
 
static int match (const QString &theInputString, const QList< QStringList > &theSentences, bool theCaseSensitive)
 

Private Attributes

bool myUseExactWordOrder
 
bool myUseFuzzyWords
 
bool myIsCaseSensitive
 
QString myQuery
 
QStringList myWords
 
QList< QStringList > myPermutatedSentences
 
QStringList myFuzzyWords
 
QList< QStringList > myFuzzyPermutatedSentences
 

Detailed Description

Approximate string matcher, treats strings as sentences composed of words.

Constructor & Destructor Documentation

◆ SUIT_SentenceMatcher()

SUIT_tools::SUIT_SentenceMatcher::SUIT_SentenceMatcher ( )

Default config: Exact word order = false; Fuzzy words = true; Case sensitive = false; Query = ""; // matches nothing.

References myIsCaseSensitive, myUseExactWordOrder, and myUseFuzzyWords.

Member Function Documentation

◆ getQuery()

const QString& SUIT_tools::SUIT_SentenceMatcher::getQuery ( ) const
inline

◆ isCaseSensitive()

bool SUIT_tools::SUIT_SentenceMatcher::isCaseSensitive ( ) const
inline

◆ makeFuzzyWords()

void SUIT_tools::SUIT_SentenceMatcher::makeFuzzyWords ( const QStringList &  theWords,
QStringList &  theFuzzyWords 
)
staticprivate

◆ makePermutatedSentences()

bool SUIT_tools::SUIT_SentenceMatcher::makePermutatedSentences ( const QStringList &  theWords,
QList< QStringList > &  theSentences 
)
staticprivate

◆ match() [1/3]

double SUIT_tools::SUIT_SentenceMatcher::match ( const QString &  theInputString) const
Returns
match metrics. The metrics >= 0. INF means mismatch. The class is unable to differentiate exact match with some approximate matches!

References myFuzzyPermutatedSentences, myFuzzyWords, myIsCaseSensitive, myPermutatedSentences, myQuery, myUseExactWordOrder, myUseFuzzyWords, and myWords.

◆ match() [2/3]

int SUIT_tools::SUIT_SentenceMatcher::match ( const QString &  theInputString,
const QList< QStringList > &  theSentences,
bool  theCaseSensitive 
)
staticprivate
Returns
number of characters in matched words. The number >= 0.

References matchAtLeastOneWord(), and matchWithSentencesIgnoreEndings().

◆ match() [3/3]

int SUIT_tools::SUIT_SentenceMatcher::match ( const QString &  theInputString,
const QStringList &  theSentence,
bool  theCaseSensitive 
)
staticprivate
Returns
number of characters in matched words. The number >= 0.

References matchAtLeastOneWord(), and matchWithSentenceIgnoreEndings().

◆ matchAtLeastOneWord()

int SUIT_tools::SUIT_SentenceMatcher::matchAtLeastOneWord ( const QString &  theInputString,
const QStringList &  theWords,
bool  theCaseSensitive 
)
staticprivate
Returns
number of characters in matched words. The number >= 0.

◆ matchWithSentenceIgnoreEndings()

int SUIT_tools::SUIT_SentenceMatcher::matchWithSentenceIgnoreEndings ( const QString &  theInputString,
const QStringList &  theSentence,
bool  theCaseSensitive 
)
staticprivate
Returns
number of characters in matched words. The number >= 0.

◆ matchWithSentencesIgnoreEndings()

int SUIT_tools::SUIT_SentenceMatcher::matchWithSentencesIgnoreEndings ( const QString &  theInputString,
const QList< QStringList > &  theSentences,
bool  theCaseSensitive 
)
staticprivate
Returns
number of characters in matched words. The number >= 0.

References matchWithSentenceIgnoreEndings().

◆ setCaseSensitive()

void SUIT_tools::SUIT_SentenceMatcher::setCaseSensitive ( bool  theOn)

References myIsCaseSensitive.

◆ setQuery()

void SUIT_tools::SUIT_SentenceMatcher::setQuery ( QString  theQuery)

◆ setUseExactWordOrder()

void SUIT_tools::SUIT_SentenceMatcher::setUseExactWordOrder ( bool  theOn)

◆ setUseFuzzyWords()

void SUIT_tools::SUIT_SentenceMatcher::setUseFuzzyWords ( bool  theOn)

◆ toString()

QString SUIT_tools::SUIT_SentenceMatcher::toString ( ) const

Member Data Documentation

◆ myFuzzyPermutatedSentences

QList<QStringList> SUIT_tools::SUIT_SentenceMatcher::myFuzzyPermutatedSentences
private

◆ myFuzzyWords

QStringList SUIT_tools::SUIT_SentenceMatcher::myFuzzyWords
private

◆ myIsCaseSensitive

bool SUIT_tools::SUIT_SentenceMatcher::myIsCaseSensitive
private

◆ myPermutatedSentences

QList<QStringList> SUIT_tools::SUIT_SentenceMatcher::myPermutatedSentences
private

◆ myQuery

QString SUIT_tools::SUIT_SentenceMatcher::myQuery
private

◆ myUseExactWordOrder

bool SUIT_tools::SUIT_SentenceMatcher::myUseExactWordOrder
private

◆ myUseFuzzyWords

bool SUIT_tools::SUIT_SentenceMatcher::myUseFuzzyWords
private

◆ myWords

QStringList SUIT_tools::SUIT_SentenceMatcher::myWords
private

The documentation for this class was generated from the following files: