(:changer le nom du fichier xml pour extraire les mêmes patrons à partir d'autres rubriques:) for $elt in doc("udpipe-3246.txt.xml")//item let $patron := (:pour le patron NOUN ADP NOUN ADP :) if ( ($elt/following-sibling::item[1]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="NOUN") and ($elt/following-sibling::item[2]/a[4]/text()="ADP") and ($elt/following-sibling::item[3]/a[4]/text()="NOUN") and ($elt/following-sibling::item[4]/a[4]/text()="ADP")) then ( concat("NOUN ADP NOUN ADP"," ",$elt/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()," ",$elt/following-sibling::item[4]/a[2]/text()) ) else if ( ($elt/following-sibling::item[2]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="NOUN") and ($elt/following-sibling::item[1]/a[4]/text()="ADP") and ($elt/following-sibling::item[3]/a[4]/text()="NOUN") and ($elt/following-sibling::item[4]/a[4]/text()="ADP") ) then ( concat("NOUN ADP NOUN ADP"," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()," ",$elt/following-sibling::item[4]/a[2]/text()) ) else if ( ($elt/following-sibling::item[3]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="NOUN") and ($elt/following-sibling::item[1]/a[4]/text()="ADP") and ($elt/following-sibling::item[2]/a[4]/text()="NOUN") and ($elt/following-sibling::item[4]/a[4]/text()="ADP") ) then ( concat("NOUN ADP NOUN ADP"," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()," ",$elt/following-sibling::item[4]/a[2]/text()) ) else if (($elt/a[4]/text()="NOUN") and ($elt/following-sibling::item[1]/a[4]/text()="ADP") and ($elt/following-sibling::item[2]/a[4]/text()="NOUN") and ($elt/following-sibling::item[3]/a[4]/text()="ADP") ) then ( concat("NOUN ADP NOUN ADP"," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()) ) (:pour le patron VERB DET NOM :) else if (($elt/a[4]/text()="VERB") and ($elt/following-sibling::item[1]/a[4]/text()="DET") and ($elt/following-sibling::item[2]/a[4]/text()="NOUN") ) then ( concat("VERB DET NOUN "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()) ) else if ( ($elt/following-sibling::item[1]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="VERB") and ($elt/following-sibling::item[2]/a[4]/text()="DET") and ($elt/following-sibling::item[3]/a[4]/text()="NOUN") ) then ( concat("VERB DET NOUN "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()) ) else if ( ($elt/following-sibling::item[2]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="VERB") and ($elt/following-sibling::item[1]/a[4]/text()="DET") and ($elt/following-sibling::item[3]/a[4]/text()="NOUN") ) then ( concat("VERB DET NOUN "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()) ) (:pour le patron NOM ADJ :) else if (($elt/a[4]/text()="NOUN") and ($elt/following-sibling::item[1]/a[4]/text()="ADJ")) then ( concat("NOUN ADJ "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()) ) else if ( ($elt/following-sibling::item[1]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="NOUN") and ($elt/following-sibling::item[2]/a[4]/text()="ADJ")) then ( concat("NOUN ADJ "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()) ) (:pour le patron ADJ NOM :) else if (($elt/a[4]/text()="ADJ") and ($elt/following-sibling::item[1]/a[4]/text()="NOUN")) then ( concat("ADJ NOUN "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()) ) else if ( ($elt/following-sibling::item[1]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="ADJ") and ($elt/following-sibling::item[2]/a[4]/text()="NOUN")) then ( concat("ADJ NOUN "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()) ) (:pour le patron VERB PREP NOM :) else if (($elt/a[4]/text()="VERB") and ($elt/following-sibling::item[1]/a[4]/text()="ADP") and ($elt/following-sibling::item[2]/a[4]/text()="NOUN") ) then ( concat("VERB ADP NOUN "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()) ) else if ( ($elt/following-sibling::item[1]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="VERB") and ($elt/following-sibling::item[2]/a[4]/text()="ADP") and ($elt/following-sibling::item[3]/a[4]/text()="NOUN") ) then ( concat("VERB ADP NOUN "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()) ) else if ( ($elt/following-sibling::item[2]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="VERB") and ($elt/following-sibling::item[1]/a[4]/text()="ADP") and ($elt/following-sibling::item[3]/a[4]/text()="NOUN") ) then ( concat("VERB ADP NOUN "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()) ) (:pour le patron PROPN VERB ADV :) else if (($elt/a[4]/text()="PROPN") and ($elt/following-sibling::item[1]/a[4]/text()="VERB") and ($elt/following-sibling::item[2]/a[4]/text()="ADV") ) then ( concat("PROPN VERB ADV "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()) ) else if ( ($elt/following-sibling::item[1]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="PROPN") and ($elt/following-sibling::item[2]/a[4]/text()="VERB") and ($elt/following-sibling::item[3]/a[4]/text()="ADV") ) then ( concat("PROPN VERB ADV "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()) ) else if ( ($elt/following-sibling::item[2]/a[1][contains(text(),'-')]) and ($elt/a[4]/text()="PROPN") and ($elt/following-sibling::item[1]/a[4]/text()="VERB") and ($elt/following-sibling::item[3]/a[4]/text()="ADV") ) then ( concat("PROPN VERB ADV "," ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()) ) else ( " " ) where $patron != " " order by $patron return string-join(($patron), " ")