Last active
June 11, 2017 20:34
-
-
Save fergusq/d7cd280b011b08f282311b2c9b8a741f to your computer and use it in GitHub Desktop.
A script for downloading category word lists from wiktionary
This file contains 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
{ toRödaObj := require("json").jsonToRödaObj } | |
getadjs cat, token { | |
obj := toRödaObj(json([loadResourceLines("https://en.wiktionary.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:"..cat.."&cmlimit=500&format=json&cmcontinue="..token)]&" ")) | |
for adj in obj["query"]["categorymembers"] do | |
STDOUT.push adj["title"], "\n" | |
done | |
return obj["continue"]["cmcontinue"] if [obj["continue"]?] else return "" | |
} | |
main cat { | |
token := "" | |
while true do | |
token = getadjs(cat, token) | |
break if [ token = "" ] | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment