I have written the following code: for tumbling window $s in ("this", "is", "an", "example", "." , "this", "is", "another", "[", "example", ".", "]", "Another", "example", ".") start $a when fn:true() end $b next $r when ($b = "." and $r = "]") or $b = "." return <s>{$s}</s> which returns: <s>this is an example .</s> <s>this is another [ example .</s> <s>] Another example .</s> but I am looking for <s>this is an example .</s> <s>this is another [ example . ]</s> <s>Another example .</s> I am playing around with if-clauses, but I am wondering whether there is a more direct way to force the end of a sentence at "]" when it is preceded by "." or at "." when there is no following "]". Thanks. Ciao, Giuseppe
Buon giorno, there as is a “previous” clause in a window, which binds to the previous value. With this you can simply express what you verbalized in XQuery: for tumbling window $s in ("this", "is", "an", "example", "." , "this", "is", "another", "[", "example", ".", "]", "Another", "example", ".") start $a when fn:true() end $b previous $prev next $r when ($b = "]" and $prev = ".") or ($b = "." and $r != "]") return <s>{$s}</s> Hope that helps Dirk Senacor Technologies Aktiengesellschaft - Sitz: Eschborn - Amtsgericht Frankfurt am Main - Reg.-Nr.: HRB 110482 Vorstand: Matthias Tomann (Vorsitzender), Marcus Purzer - Aufsichtsratsvorsitzender: Daniel Grözinger On 3. Apr 2019, at 10:51, Giuseppe G. A. Celano <celano@informatik.uni-leipzig.de<mailto:celano@informatik.uni-leipzig.de>> wrote: I have written the following code: for tumbling window $s in ("this", "is", "an", "example", "." , "this", "is", "another", "[", "example", ".", "]", "Another", "example", ".") start $a when fn:true() end $b next $r when ($b = "." and $r = "]") or $b = "." return <s>{$s}</s> which returns: <s>this is an example .</s> <s>this is another [ example .</s> <s>] Another example .</s> but I am looking for <s>this is an example .</s> <s>this is another [ example . ]</s> <s>Another example .</s> I am playing around with if-clauses, but I am wondering whether there is a more direct way to force the end of a sentence at "]" when it is preceded by "." or at "." when there is no following "]". Thanks. Ciao, Giuseppe
Thanks. I was close :) Dr. Giuseppe G. A. Celano DFG-project leader <http://gepris.dfg.de/gepris/projekt/408121292> Universität Leipzig Institute of Computer Science, NLP Augustusplatz 10 Tel: +4934132223 04109 Leipzig Deutschland E-mail: celano@informatik.uni-leipzig.de <mailto:celano@informatik.uni-leipzig.de> Web site 1: http://asv.informatik.uni-leipzig.de/en/staff/Giuseppe_Celano <http://asv.informatik.uni-leipzig.de/en/staff/Giuseppe_Celano> Web site 2: https://sites.google.com/site/giuseppegacelano/ <https://sites.google.com/site/giuseppegacelano/>
On Apr 3, 2019, at 10:59 AM, Kirsten, Dirk <Dirk.Kirsten@senacor.com> wrote:
for tumbling window $s in ("this", "is", "an", "example", "." , "this", "is", "another", "[", "example", ".", "]", "Another", "example", ".") start $a when fn:true() end $b previous $prev next $r when ($b = "]" and $prev = ".") or ($b = "." and $r != "]") return <s>{$s}</s>
participants (2)
-
Giuseppe G. A. Celano -
Kirsten, Dirk