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/bash | |
# | |
# /etc/rc.d/init.d/<servicename> | |
servicename="<servicename" | |
script="/home/root/servicename.sh" | |
case "$1" in | |
start) | |
echo -n "Starting $servicename service: " |
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
works to merge: | |
https://openlibrary.org/authors/OL6028427A/Akademii%CD%A1a_nauk_SSSR._Arkheograficheskai%CD%A1a_komissii%CD%A1a | |
https://openlibrary.org/works/OL16107163W/Sochineniia%EF%B8%A0_%EF%B8%A1 | |
This seems to be the main work: https://openlibrary.org/works/OL623490W/Sochinenii%EF%B8%A0a%EF%B8%A1 |
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
from olclient.openlibrary import OpenLibrary | |
import json | |
ol = OpenLibrary() | |
DEBUG=True | |
def get_editions_from_work(olid): | |
if DEBUG: | |
print olid | |
editions = [e.olid for e in ol.Work.get(olid).editions] |
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
from unicodedata import normalize | |
def norm(s): | |
return normalize('NFC', s) | |
def is_nfc(s): | |
norm = normalize('NFC', s) | |
print "%s => %s" % (s, norm) | |
return s == norm |
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
#People with more than one OLID | |
#https://query.wikidata.org/#%23People%20with%20more%20than%20one%20OLID%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fcount%0AWHERE%0A%7B%0A%20%20%7B%0A%20%20%20%20SELECT%20%3Fitem%20%28COUNT%28DISTINCT%20%3Folid%29%20AS%20%3Fcount%29%20WHERE%20%7B%0A%20%20%20%20%20%20%3Fitem%20wdt%3AP31%20wd%3AQ5%20.%0A%20%20%20%20%20%20%3Fitem%20wdt%3AP648%20%3Folid%20.%0A%0A%20%20%20%20%7D%0A%20%20%20%20GROUP%20BY%20%3Fitem%0A%20%20%7D%0A%20%20FILTER%20%28%20%3Fcount%20%3E%201%20%29%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fcount%29%20%3FitemL | |
SELECT ?item ?itemLabel ?count | |
WHERE | |
{ | |
{ | |
SELECT ?item (COUNT(DISTINCT ?olid) AS ?count) WHERE { | |
?item wdt:P31 wd:Q5 . | |
?item wdt:P648 ?olid . |
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
> | |
++ > + > | |
+++++ + > ++++ > | |
+++++ + > +++++ +++++ ++ > | |
+++++ ++ > ++ > | |
+++++ + > +++++ +++++ +++++ > | |
+++++ ++ > +++++ ++ > | |
++ > > | |
++ > +++++ +++++ ++ > | |
+++++ + > +++++ +++++ +++++ > |
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
# Steps to merge a number of Kite Runner editions and works: | |
from catharbot import catharbot | |
bot = catharbot.CatharBot() | |
def merge_unique_lists(lists, hash_fn=None): | |
""" | |
Combine unique lists into a new unique list. Preserves ordering. | |
""" | |
result = [] |
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
from catharbot import catharbot | |
bot = catharbot.CatharBot() | |
# Work In Progress | |
# uses the 'merging' branch of Catharbot, https://github.com/hornc/catharbot/tree/merging | |
def extract_olid(olid): | |
"""Convert a string like '/authors/OL1412764A' to just 'OL1412764A'""" | |
return olid.split('/')[-1] | |
def remove_editions(duplicates, docs): |
OlderNewer