25.12.2013 Views

Tamino XQuery User Guide - Software AG Documentation

Tamino XQuery User Guide - Software AG Documentation

Tamino XQuery User Guide - Software AG Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Text Retrieval<br />

for $a in input()/patient<br />

where $a/name = "Maier"<br />

return $a/name<br />

or you can use tf:containsText:<br />

for $a in input()/patient<br />

where tf:containsText($a/name, "Maier")<br />

return $a/name<br />

Unfortunately, there are at least four variants of the name which are all pronounced :<br />

"Maier", "Mayer", "Meier", and "Meyer". Instead of constructing long Boolean expressions that try<br />

to cover all existing homophones, you can use tf:phonetic in the scope of one of the search<br />

functions:<br />

for $a in input()/patient<br />

where tf:containsText($a/name, tf:phonetic("Maier"))<br />

return $a/name<br />

This query will return all patients whose names sound like .<br />

<strong>Tamino</strong> uses a set of rules to determine phonetic equivalency. There are rules pre-defined, which<br />

are explained in more detail in the reference documentation to tf:phonetic. These rules are suitable<br />

for German and English, but you can create your own set of rules. See the section Rules for Searches<br />

Using Phonetic Values and Stemming below.<br />

Note: You can not use tf:phonetic standalone, but only in the context of one of the following<br />

functions: tf:containsText, tf:containsAdjacentText, tf:containsNearText,<br />

tf:createAdjacentTextReference, tf:createNearTextReference,<br />

tf:createTextReference. This means that the result of calling this function in another<br />

context is unspecified and might change in a future <strong>Tamino</strong> version.<br />

Stemming<br />

A corpus with text in an inflecting language such as English or German often contains words in<br />

inflected forms: nouns are declined and verbs are conjugated: "The nightingales were singing in<br />

the trees." If you want to search for all occurrences of the verb "to sing" or of the nouns "nightingale"<br />

and "tree", you need to know how these words are inflected and derived. One method is to reduce<br />

any inflected form to its word stem. It is the stem to which morphemes are attached to construct<br />

a certain grammatical form: So "were" + "sing" + "-ing" indicates the past continuous tense of the<br />

verb "to sing".<br />

92<br />

<strong>XQuery</strong> <strong>User</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!