Purpose: Testing alternative ways of testing for presence/absence
Author: Chris Wallace
| XQuery |
let $stopwords := ("a","and","in","the","or","over")
let $input-string := 'a quick brown fox jumps over the lazy dog'
let $input-words := tokenize($input-string, '\s+')
return
( for $i in 1 to 1000
for $word in $input-words
return true()
)[1]
|
|---|---|
| Output |
true |
| Elapsed Time (ms) | 27 |
| XQuery |
let $stopwords :=
<words>
<word>a</word>
<word>and</word>
<word>in</word>
<word>the</word>
<word>or</word>
<word>over</word>
</words>
let $input-string := 'a quick brown fox jumps over the lazy dog'
let $input-words := tokenize($input-string, '\s+')
return
( for $i in 1 to 1000
for $word in $input-words
return $stopwords/word = $word
)[1]
|
|---|---|
| Output |
true |
| Elapsed Time (ms) | 176 |
| XQuery |
let $stopwords :=
<words>
<word>a</word>
<word>and</word>
<word>in</word>
<word>the</word>
<word>or</word>
<word>over</word>
</words>
let $input-string := 'a quick brown fox jumps over the lazy dog'
let $input-words := tokenize($input-string, '\s+')
return
( for $i in 1 to 1000
for $word in $input-words
return some $stopword in $stopwords/word
satisfies ($stopword eq $word)
)[1]
|
|---|---|
| Output |
true |
| Elapsed Time (ms) | 275 |
| XQuery |
let $stopwords := ("a","and","in","the","or","over")
let $input-string := 'a quick brown fox jumps over the lazy dog'
let $input-words := tokenize($input-string, '\s+')
return
( for $i in 1 to 1000
for $word in $input-words
return $stopwords = $word
)[1]
|
|---|---|
| Output |
true |
| Elapsed Time (ms) | 47 |
| XQuery |
let $stopwordstring := ' a and in the or over '
let $input-string := 'a quick brown fox jumps over the lazy dog'
let $input-words := tokenize($input-string, '\s+')
return
( for $i in 1 to 1000
for $word in $input-words
let $wordx := concat(" ",$word," ")
return contains($stopwordstring, $wordx) ) [1]
|
|---|---|
| Output |
true |
| Elapsed Time (ms) | 79 |
| XQuery |
let $stopwords :=
<words>
<word>a</word>
<word>and</word>
<word>in</word>
<word>the</word>
<word>or</word>
<word>over</word>
</words>
let $stopwordsx := $stopwords/word
let $input-string := 'a quick brown fox jumps over the lazy dog'
let $input-words := tokenize($input-string, '\s+')
return
( for $i in 1 to 1000
for $word in $input-words
return $stopwordsx = $word
)[1]
|
|---|---|
| Output |
true |
| Elapsed Time (ms) | 136 |
| XQuery |
let $stopwords :=
<words>
<word>a</word>
<word>and</word>
<word>in</word>
<word>the</word>
<word>or</word>
<word>over</word>
</words>
let $stopwordsx := $stopwords/word/text()
let $input-string := 'a quick brown fox jumps over the lazy dog'
let $input-words := tokenize($input-string, '\s+')
return
( for $i in 1 to 1000
for $word in $input-words
return $stopwordsx = $word
)[1]
|
|---|---|
| Output |
true |
| Elapsed Time (ms) | 60 |
| XQuery |
let $stopwords :=
<words>
<word>a</word>
<word>and</word>
<word>in</word>
<word>the</word>
<word>or</word>
<word>over</word>
</words>
let $stopwordsx := $stopwords/word/string(.)
let $input-string := 'a quick brown fox jumps over the lazy dog'
let $input-words := tokenize($input-string, '\s+')
return
( for $i in 1 to 1000
for $word in $input-words
return $stopwordsx = $word
)[1]
|
|---|---|
| Output |
true |
| Elapsed Time (ms) | 51 |
| XQuery |
let $stopwords := doc("/db/Wiki/UnitTest2/stopwords.xml")//word/string(.)
let $input-string := 'a quick brown fox jumps over the lazy dog'
let $input-words := tokenize($input-string, '\s+')
return
( for $i in 1 to 1000
for $word in $input-words
return $stopwords = $word
)[1]
|
|---|---|
| Output |
true |
| Elapsed Time (ms) | 47 |