Skip to content

Instantly share code, notes, and snippets.

Avatar

Clifford Anderson CliffordAnderson

View GitHub Profile
@CliffordAnderson
CliffordAnderson / vandyCite.js
Last active Aug 17, 2020
Zotero converter for Wikidata Quick Statements
View vandyCite.js
{
"translatorID": "51e5355d-9974-484f-80b9-f84d2b55782e",
"label": "VandyCite QuickStatements",
"creator": "Philipp Zumstein and Chris Benda",
"target": "txt",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 2,
@CliffordAnderson
CliffordAnderson / teams-web-scraping.xqy
Created Aug 6, 2020
Web scraping for Summer Teams
View teams-web-scraping.xqy
(: Web Scraper for Summer Projects :)
declare option output:method "csv";
declare option output:csv "header=yes, separator=comma";
let $doc := fetch:text("https://www.library.vanderbilt.edu/projects") => html:parse()
let $mainContent := $doc//section[@id="maincontent"]
for $project in $mainContent//div[@class="media-body"]
let $projectName := $project/h3[@class="media-heading"]/text()
let $projectParticipants := $project//span[text()="Members"]/following-sibling::text()
@CliffordAnderson
CliffordAnderson / New.csv
Created Apr 7, 2020 — forked from davidamichelson/New
Data To Concatenate
View New.csv
Headword Syriaca_URI Map_1 Map_2 Map_3 Map_4 Map_5 Map_6 Map_7 Map_8 Map_9 Map_10 Map_11 Map_12 Map_13 Map_14
Abila syriaca.org/place/4355 1 4
Abivard syriaca.org/place/4222 9
Abr Shahr syriaca.org/place/4220 9 10
Acre|Akko syriaca.org/place/14 1 2 5
View spark-session-nlp.scala
val pbp = spark.read.format("csv").load("Desktop/pbp.csv")
pbp.show
pbp.printSchema
val bp = pbp.withColumnRenamed("_c0", "article").withColumnRenamed("_c1", "journal").withColumnRenamed("_c2", "volume").withColumnRenamed("_c3", "issue").withColumnRenamed("_c4", "date").withColumnRenamed("_c5", "pages").withColumnRenamed("_c6", "url").withColumnRenamed("_c7", "text")
bp.printSchema
View BP.xqy
xquery version "3.1";
let $docs := fn:collection("bpp-quarterly")
let $csv := element csv {
for $doc in $docs/Record
return
<record>
<title>{$doc/RecordTitle/text()}</title>
<publication>{$doc/Publication/Title/text()}</publication>
<volume>{$doc/Volume/text()}</volume>
View 2010-tv-news.md
View csv-to-jsonl.xqy
xquery version "3.1";
declare namespace xpf = "http://www.w3.org/2005/xpath-functions";
(: Converts a CSV into JSONL, i.e. one JSON object per line :)
let $csv := fetch:text("https://gist.githubusercontent.com/CliffordAnderson/588774dd0fa7d7bb616abd8da478fe76/raw/33395bdb6fce8d215464738f8681b66b130159e9/books.csv") => csv:parse(map { 'header': true() })
for $record in $csv/csv/record
let $key-values :=
for $entry in $record/*
return
@CliffordAnderson
CliffordAnderson / artists.json
Created Oct 27, 2019
Artist Networks from WIkidata
View artists.json
[
{
"artist": "http://www.wikidata.org/entity/Q30160536",
"artistLabel": "František Podešva",
"influenced_by": "http://www.wikidata.org/entity/Q2104325",
"influenced_byLabel": "Jan Preisler"
},
{
"artist": "http://www.wikidata.org/entity/Q63478",
"artistLabel": "Jonah Bokaer",
@CliffordAnderson
CliffordAnderson / ubahn.html
Created Oct 27, 2019
Sample neovis.js page
View ubahn.html
<!doctype html>
<html>
<head>
<title>Neovis.js Simple Example</title>
<style type="text/css">
html, body {
font: 16pt arial;
}
#viz {