ft:mark
Thursday, 2 July 2015 · 3 messages · last reply 5 Jul 2015
LJ
Lars Johnsen2 Jul 2015 18:13 #
The full text function
ft:mark() puts a mark around each of the words that occur in a match, starting from the first matching word to the last, including stop words, except for punctuation characters. Is it possible to check for the kind of characters (or strings) that ft:mark() will skip when marking matches? Or, would it be possible to ask ft:mark() to put one marker for the whole match?
The case I am using it for is to get the sequence of matching words within a match, and sometimes, for long strings, there may be several sequences. A contiguous sequence of marked elements maybe assumed to make up a match, while non contiguous do not. One marker around the match solves the problem, as would detecting characters that are never marked.
Regards
Lars G Johnsen
National Library of NorwayCG
Christian Grün5 Jul 2015 15:19 #
Hi Lars,
I guess it was due to the internal XQFT representation of match positions that adjacent matches are marked one by one, and it's probably difficult to change this without too much additional effort.
However, you can use XQuery for transforming your result; see e.g. the attached XQuery code. I must confess I didn't spend too much time on it (right now, it's simply too hot around here...), so I'm looking for revised versions ;)
Christian
Quoted text · Lars Johnsen · 17 lines
On Thu, Jul 2, 2015 at 6:13 PM, Lars Johnsen <yoonsen at gmail.com> wrote: > The full text function ft:mark() puts a mark around each of the words that > occur in a match, starting from the first matching word to the last, > including stop words, except for punctuation characters. Is it possible to > check for the kind of characters (or strings) that ft:mark() will skip when > marking matches? Or, would it be possible to ask ft:mark() to put one marker > for the whole match? > > The case I am using it for is to get the sequence of matching words within a > match, and sometimes, for long strings, there may be several sequences. A > contiguous sequence of marked elements maybe assumed to make up a match, > while non contiguous do not. One marker around the match solves the problem, > as would detecting characters that are never marked. > > Regards > Lars G Johnsen > National Library of Norway
LJ
Lars Johnsen5 Jul 2015 17:10 #
Thanks for XQuery code! I will try to integrate it with our own efforts, and let you know how it goes.
Lars
2015-07-05 15:19 GMT+02:00 Christian Grün <christian.gruen at gmail.com>:
Quoted text · Christian Grün · 38 lines
> Hi Lars, > > I guess it was due to the internal XQFT representation of match > positions that adjacent matches are marked one by one, and it's > probably difficult to change this without too much additional effort. > > However, you can use XQuery for transforming your result; see e.g. the > attached XQuery code. I must confess I didn't spend too much time on > it (right now, it's simply too hot around here...), so I'm looking for > revised versions ;) > > Christian > > > On Thu, Jul 2, 2015 at 6:13 PM, Lars Johnsen <yoonsen at gmail.com> wrote: > > The full text function ft:mark() puts a mark around each of the words > that > > occur in a match, starting from the first matching word to the last, > > including stop words, except for punctuation characters. Is it possible > to > > check for the kind of characters (or strings) that ft:mark() will skip > when > > marking matches? Or, would it be possible to ask ft:mark() to put one > marker > > for the whole match? > > > > The case I am using it for is to get the sequence of matching words > within a > > match, and sometimes, for long strings, there may be several sequences. A > > contiguous sequence of marked elements maybe assumed to make up a match, > > while non contiguous do not. One marker around the match solves the > problem, > > as would detecting characters that are never marked. > > > > Regards > > Lars G Johnsen > > National Library of Norway >
Written for BaseX 8.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery