|
a/src/qtgui/plaintorich.cpp |
|
b/src/qtgui/plaintorich.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.12 2006-11-08 13:04:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.13 2006-11-13 08:15:57 dockes Exp $ (C) 2005 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
50 |
// Out: begin and end byte positions of query terms in text
|
50 |
// Out: begin and end byte positions of query terms in text
|
51 |
vector<pair<int, int> > tboffs;
|
51 |
vector<pair<int, int> > tboffs;
|
52 |
// Out: first term found in text
|
52 |
// Out: first term found in text
|
53 |
string firstTerm;
|
53 |
string firstTerm;
|
54 |
|
54 |
|
55 |
vector int
|
|
|
56 |
myTextSplitCB(const list<string>& its) {
|
55 |
myTextSplitCB(const list<string>& its) {
|
57 |
for (list<string>::const_iterator it = its.begin(); it != its.end();
|
56 |
for (list<string>::const_iterator it = its.begin(); it != its.end();
|
58 |
it++) {
|
57 |
it++) {
|
59 |
string s;
|
58 |
string s;
|
60 |
Rcl::dumb_string(*it, s);
|
59 |
Rcl::dumb_string(*it, s);
|
|
... |
|
... |
97 |
|
96 |
|
98 |
// We first use the text splitter to break the text into words,
|
97 |
// We first use the text splitter to break the text into words,
|
99 |
// and compare the words to the search terms, which yields the
|
98 |
// and compare the words to the search terms, which yields the
|
100 |
// query terms positions inside the text
|
99 |
// query terms positions inside the text
|
101 |
myTextSplitCB cb(terms);
|
100 |
myTextSplitCB cb(terms);
|
102 |
TextSplit splitter(&cb, true);
|
101 |
TextSplit splitter(&cb, TextSplit::TXTS_ONLYSPANS);
|
103 |
// Note that splitter returns the term locations in byte, not
|
102 |
// Note that splitter returns the term locations in byte, not
|
104 |
// character offset
|
103 |
// character offset
|
105 |
splitter.text_to_words(in);
|
104 |
splitter.text_to_words(in);
|
106 |
|
105 |
|
107 |
if (firstTerm)
|
106 |
if (firstTerm)
|