This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: Extracts entities from Internet Archive texts using the Alchemy API :) | |
(: Serializes disambiguated Entities to GeoJSON :) | |
xquery version "3.0"; | |
declare namespace csv = "http://basex.org/modules/json"; | |
declare function local:read-page($title as xs:string, $page as xs:integer) as item()? | |
{ | |
let $text := fn:string-join( | |
let $doc := fn:doc(fn:concat("geojson/", $title))//OBJECT[$page] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(:~ | |
: Converts an integer to a corresponding sequence of words | |
: @author Clifford Anderson | |
: @version 1.0 | |
: | |
:) | |
(: This function is adapted from a function by Nelson Wells :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Fibonacci Sequence :) | |
declare function local:fibo-numbers($num1 as xs:integer, $num2 as xs:integer, $limit as xs:integer) as xs:integer* { | |
if ($limit > 0) then ($num1, local:fibo-numbers($num2, $num1 + $num2, $limit -1)) | |
else $num1 | |
}; | |
declare function local:fibo-sequence($limit as xs:integer) as xs:integer* { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: Produces word lists with frequency per speaker :) | |
declare namespace tei="http://www.tei-c.org/ns/1.0"; | |
let $doc := fn:doc("db/shakespeare/Ado.xml") | |
for $character in fn:distinct-values($doc//tei:sp/tei:speaker/tei:w/text()) | |
let $bag := | |
for $speaker in $doc//tei:sp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words <- read.csv(file.choose(), header=FALSE) | |
leonato <- subset(words, V1=="LEONATO", select=c(V2, V3)) | |
pal <- brewer.pal(8, "Accent") | |
wordcloud(leonato$V2, leonato$V3, min.freq=3, colors=pal) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
(: HTTP GET request :) | |
let $url := 'http://www.rest.com' | |
return httpclient:get(xs:anyURI($url), fn:false(), ())/httpclient:body/html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
declare namespace tei="http://www.tei-c.org/ns/1.0"; | |
fn:collection("db/shakespeare")//tei:seriesStmt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
declare namespace tei="http://www.tei-c.org/ns/1.0"; | |
for $result in fn:collection("/db/shakespeare")//tei:ab | |
let $length := | |
if (fn:string-length($result) gt 20) then "long-phrase" | |
else "short-phrase" | |
group by $length | |
return element { $length } { count($result) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEI | |
TEI/teiHeader | |
TEI/teiHeader/encodingDesc | |
TEI/teiHeader/encodingDesc/editorialDecl | |
TEI/teiHeader/encodingDesc/editorialDecl/correction | |
TEI/teiHeader/encodingDesc/editorialDecl/correction/p | |
TEI/teiHeader/encodingDesc/editorialDecl/hyphenation | |
TEI/teiHeader/encodingDesc/editorialDecl/hyphenation/p | |
TEI/teiHeader/encodingDesc/editorialDecl/hyphenation/p/gi | |
TEI/teiHeader/encodingDesc/editorialDecl/interpretation |