Re: [basex-talk] thesaurus URILiteral vs node

2021-06-01 Thread Liam R. E. Quin
On Tue, 2021-06-01 at 12:21 +0200, Christian Grün wrote:
> Hi Liam,
> 
> I have added ft:thesaurus, 

You really are beyond the awesome.
Thank you so much!  I hope to have a  chance to experiment kater this
month, but if there's a gap i'll look much sooner.

Liam


-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org



Re: [basex-talk] thesaurus URILiteral vs node

2021-06-01 Thread Christian Grün
Hi Liam,

I have added ft:thesaurus, and I have revised our documentation [1,2].
I think that the new function may contribute to a more sophisticated
search code written in XQuery.

The implementation is still subject to change; I’m looking forward to
your feedback.
Christian

[1] https://files.basex.org/releases/latest/
[2] https://docs.basex.org/wiki/Full-Text_Module#ft%3Athesaurus


On Mon, May 31, 2021 at 10:52 PM Liam R. E. Quin  wrote:
>
> On Mon, 2021-05-31 at 15:05 +0200, Christian Grün wrote:
> >
> >   let $thes := ...
> >   let $term := 'happy'
> >   let $relation := 'RT'
> >   let $levels := 1 to 10
> >   let $terms := ft:thesaurus($thes, $term, $relation, $levels)
> >   return 'lucky' contains text { $terms }
> >
> > Do you think that could be helpful?
>
> Yes.  I'm also  very open to other ways of solving the real request,
> which is handling a more complex query language, with
>   "a (b|with spaces here|c) d"
> matching "a b d", "a with spaces d", "a c d"
>
> I could also do it by expanding the query into constant strings of
> course, and maybe if there's no other demand for this, that's the thing
> to do.
>
> Thanks for looking at it some more!
>
> Liam
>
> --
> Liam Quin, https://www.delightfulcomputing.com/
> Available for XML/Document/Information Architecture/XSLT/
> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
> Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org
>


Re: [basex-talk] thesaurus URILiteral vs node

2021-05-31 Thread Liam R. E. Quin
On Mon, 2021-05-31 at 15:05 +0200, Christian Grün wrote:
> 
>   let $thes := ...
>   let $term := 'happy'
>   let $relation := 'RT'
>   let $levels := 1 to 10
>   let $terms := ft:thesaurus($thes, $term, $relation, $levels)
>   return 'lucky' contains text { $terms }
> 
> Do you think that could be helpful?

Yes.  I'm also  very open to other ways of solving the real request,
which is handling a more complex query language, with
  "a (b|with spaces here|c) d"
matching "a b d", "a with spaces d", "a c d"

I could also do it by expanding the query into constant strings of
course, and maybe if there's no other demand for this, that's the thing
to do.

Thanks for looking at it some more!

Liam

-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org



Re: [basex-talk] thesaurus URILiteral vs node

2021-05-31 Thread Christian Grün
Hi Liam,

I spent some more time with the XQFT thesaurus specification, and I
decided it would be too invasive to make the thesaurus input fully
dynamic. There are simply too many rules and optimizations that depend
on a static source.

It would certainly be easier to define a new helper function in the
Full-Text Module instead. The returned strings could then be used as
input for the FT expressions:

  let $thes := ...
  let $term := 'happy'
  let $relation := 'RT'
  let $levels := 1 to 10
  let $terms := ft:thesaurus($thes, $term, $relation, $levels)
  return 'lucky' contains text { $terms }

Do you think that could be helpful?
Christian


On Thu, May 27, 2021 at 5:35 PM Liam R. E. Quin  wrote:
>
> On Thu, 2021-05-27 at 14:35 +0200, Christian Grün wrote:
> > Hi Liam,
> >
> > That would certainly be possible. The major challenge will be to make
> > it effiicent.
>
> Thank you for replying!
>
> It might be that i can solve my need  differently - i want to implement
> a Google-search-like syntax for a Web site -
>   "very tall (boy|youth|young man) wearing (green|lemon)"
> (where "..." indicates a phrase search)
>
> One way might be to create the multiplicative expansion of every
> combination and search for those, maybe only in text containing "very
> tall" and "wearing" where constant strings are supplied.
>
> I had thought another way might be to create a thesaurus making
> boy, youth, young man, be synonyms, and apply that to the search, but
> then found i needed to write out a thesaurus file for every such query.
>
>
> --
> Liam Quin, https://www.delightfulcomputing.com/
> Available for XML/Document/Information Architecture/XSLT/
> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
> Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org
>


Re: [basex-talk] thesaurus URILiteral vs node

2021-05-27 Thread Liam R. E. Quin
On Thu, 2021-05-27 at 14:35 +0200, Christian Grün wrote:
> Hi Liam,
> 
> That would certainly be possible. The major challenge will be to make
> it effiicent.

Thank you for replying!

It might be that i can solve my need  differently - i want to implement
a Google-search-like syntax for a Web site -
  "very tall (boy|youth|young man) wearing (green|lemon)"
(where "..." indicates a phrase search)

One way might be to create the multiplicative expansion of every
combination and search for those, maybe only in text containing "very
tall" and "wearing" where constant strings are supplied.

I had thought another way might be to create a thesaurus making
boy, youth, young man, be synonyms, and apply that to the search, but
then found i needed to write out a thesaurus file for every such query.


-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org



Re: [basex-talk] thesaurus URILiteral vs node

2021-05-27 Thread Christian Grün
Hi Liam,

That would certainly be possible. The major challenge will be to make
it effiicent. Most of the XQFT arguments have been designed to be
static, and if we allow something like…

  $text contains text { $term } using thesaurus $node

…the value of $node might change with every iteration. That’s
definitely something that can be solved as well, it’s just more effort
than simply extending the parser: The supplied source should only be
reevaluated if the source has really changed; otherwise, performance
will suffer.

I’ve already come across similar patterns at other places, such as in
predicates that contain absolute paths (and that shouldn’t be fully
evaluated either every time they are processed):

  //a[ . = //b ]

I’ll have some more thoughts.
Christian


On Thu, May 27, 2021 at 5:34 AM Liam R. E. Quin  wrote:
>
> What would be involved in extending BaseX's full text to allow a
> thesaurus to be supplied as a node instead of a URI?
>
> I want to construct one on the fly, and using file:write() seems
> excessive.
>
> Liam
>
> --
> Liam Quin, https://www.delightfulcomputing.com/
> Available for XML/Document/Information Architecture/XSLT/
> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
> Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org
>


[basex-talk] thesaurus URILiteral vs node

2021-05-26 Thread Liam R. E. Quin
What would be involved in extending BaseX's full text to allow a
thesaurus to be supplied as a node instead of a URI?

I want to construct one on the fly, and using file:write() seems
excessive.

Liam

-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org