Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created December 21, 2015 08:35
Show Gist options
  • Select an option

  • Save ableasdale/cf43e91d98767c4cbd5b to your computer and use it in GitHub Desktop.

Select an option

Save ableasdale/cf43e91d98767c4cbd5b to your computer and use it in GitHub Desktop.
Tokenize a large file of individual strings (line by line) and create an XQuery sequence
xquery version "1.0-ml";
(: Take the 3esl.txt file and create a sequence of words :)
declare variable $file := xdmp:document-get("https://path-to-your/3esl.txt");
let $words := for $i in fn:tokenize($file,"\r?\n")
return concat('"',$i, '"')
return string-join($words,",")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment