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
#!/usr/bin/env python3 | |
# Usage: ./run_bert.py test.txt | |
# Output: test.txt.bert | |
import sys | |
import requests | |
from pprint import pprint |
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
#!/bin/env python3 | |
import requests | |
import sys | |
import os | |
if len(sys.argv) < 2: | |
print("Usage: fetch_article.py ddd:010618043:mpeg21:a0339, or fetch_article <FILE>.txt") | |
sys.exit(-1) |
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
#!/usr/bin/env python3 | |
import requests | |
from lxml import etree | |
OAI_BASEURL = 'http://services.kb.nl/mdo/oai' | |
SRU_BASEURL = 'http://jsru.kb.nl/sru/sru' | |
EXAMPLE = "http://resolver.kb.nl/resolve?urn=ddd:010018364:mpeg21:a0232:ocr" | |
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
#!/usr/bin/env python | |
import random | |
import pygame | |
from pygame.locals import * | |
import time | |
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
#!/usr/bin/env python3 | |
# -*- encoding: utf-8 -*- | |
import os | |
import requests | |
import feedparser | |
import lxml.html | |
import datetime |
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
#!/usr/bin/env python3 | |
import requests | |
from lxml import etree | |
OAI_BASEURL = 'http://services.kb.nl/mdo/oai' | |
SRU_BASEURL = 'http://jsru.kb.nl/sru/sru' | |
EXAMPLE = "http://resolver.kb.nl/resolve?urn=ddd:010018364:mpeg21:a0232:ocr" | |
def get_paper_date_sru(identifier=EXAMPLE): |
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
#!/usr/bin/env python3 | |
import os | |
import json | |
from SPARQLWrapper import SPARQLWrapper, JSON | |
def load_brinkman(): | |
if not os.path.isfile("brinkman.json"): | |
sparql = SPARQLWrapper("http://data.bibliotheken.nl/sparql") |
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
#!/usr/bin/env python | |
import json | |
import os | |
import time | |
import urllib | |
import sys | |
from lxml import etree as ET | |
from pprint import pprint |
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
In [4]: from nltk import NaiveBayesClassifier as nbc | |
...: from nltk.tokenize import word_tokenize | |
...: from itertools import chain | |
...: | |
...: training_data = [('I love this sandwich.', 'pos'), | |
...: ('This is an amazing place!', 'pos'), | |
...: ('I feel very good about these beers.', 'pos'), | |
...: ('This is my best work.', 'pos'), |
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
#!/usr/bin/env bash | |
# | |
# Update the baseurl for new files. | |
# | |
# http://wiki.dbpedia.org/dataset-categories/dbpedia-release | |
# | |
DUMP_DATE="current" | |
if [ ! -d "$DUMP_DATE" ]; then |