svcore
1.9
TextMatcher.h
Go to the documentation of this file.
1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3
/*
4
Sonic Visualiser
5
An audio file viewer and annotation editor.
6
Centre for Digital Music, Queen Mary, University of London.
7
This file copyright 2008 QMUL.
8
9
This program is free software; you can redistribute it and/or
10
modify it under the terms of the GNU General Public License as
11
published by the Free Software Foundation; either version 2 of the
12
License, or (at your option) any later version. See the file
13
COPYING included with this distribution for more information.
14
*/
15
16
#ifndef _TEXT_MATCHER_H_
17
#define _TEXT_MATCHER_H_
18
19
#include <QString>
20
#include <QStringList>
21
#include "
XmlExportable.h
"
22
23
#include <map>
24
26
27
class
TextMatcher
28
{
29
public
:
30
TextMatcher
();
31
virtual
~TextMatcher
();
32
33
struct
Match
34
{
35
QString
key
;
// This field is not used by TextMatcher
36
int
score
;
37
typedef
std::map<QString, QString>
FragmentMap
;
// text type -> fragment
38
FragmentMap
fragments
;
39
40
Match
() :
score
(0) { }
41
Match
(
const
Match
&m) :
42
key
(m.
key
),
score
(m.
score
),
fragments
(m.
fragments
) { }
43
44
bool
operator<
(
const
Match
&m)
const
;
// sort by score first
45
};
46
47
void
test
(Match &match,
// existing match record to be augmented
48
QStringList keywords,
// search terms
49
QString text,
// to search within
50
QString textType,
// key to use for fragment map
51
int
score);
// relative weight for hits within this text type
52
53
};
54
55
56
#endif
TextMatcher::Match::score
int score
Definition:
TextMatcher.h:36
TextMatcher::Match::Match
Match()
Definition:
TextMatcher.h:40
TextMatcher::Match::FragmentMap
std::map< QString, QString > FragmentMap
Definition:
TextMatcher.h:37
TextMatcher::test
void test(Match &match, QStringList keywords, QString text, QString textType, int score)
Definition:
TextMatcher.cpp:27
TextMatcher::Match::fragments
FragmentMap fragments
Definition:
TextMatcher.h:38
TextMatcher
A rather eccentric interface for matching texts in differently-scored fields.
Definition:
TextMatcher.h:27
TextMatcher::Match::Match
Match(const Match &m)
Definition:
TextMatcher.h:41
TextMatcher::Match::key
QString key
Definition:
TextMatcher.h:35
TextMatcher::~TextMatcher
virtual ~TextMatcher()
Definition:
TextMatcher.cpp:22
TextMatcher::Match
Definition:
TextMatcher.h:33
XmlExportable.h
TextMatcher::Match::operator<
bool operator<(const Match &m) const
Definition:
TextMatcher.cpp:103
TextMatcher::TextMatcher
TextMatcher()
Definition:
TextMatcher.cpp:18
base
TextMatcher.h
Generated by
1.8.15