Go package providing tools for working with Library of Congress data.

go-libraryofcongress

Go package providing tools for working with Library of Congress data.

Documentation

Go Reference

Tools

$> make cli
go build -mod vendor -o bin/parse-lcnaf cmd/parse-lcnaf/main.go
go build -mod vendor -o bin/parse-lcsh cmd/parse-lcsh/main.go

parse-lcnaf

parse-lcnaf is a command-line tool to parse the Library of Congress lcnaf.both.ndjson (or lcnaf.both.ndjson.zip) Name Authority file and output CSV-encoded name authority ID and (English) label data.

For example:

$> ./bin/parse-lcnaf ~/Downloads/lcnaf.both.ndjson.zip > lcnaf.csv

Time passes...
More time passes...
Time keeps on slipping slipping in to the future...

$> wc -l lcnaf.csv
 11024368 lcnaf.csv

$> cat lcnaf.csv
id,label
n90699999,"Birkan, Kaarin"
n85299999,"Devorin, Lonyah"
no2007099999,"Graham, Sean"
n94099999,Tampa Joe
n98099999,"McGoggan, Graham"
n79099999,"Brockmann, Lester C."
no2018099999,"Neefe, Christian Gottlob, 1748-1798. Veränderungen über den Priestermarsch aus Mozarts Zauberflöte"
n2003099999,"Halstenberg, Friedrich"
no2019099999,"Colling, Anton"
n88299999,"Herring, Jackson R."
... and so on

Notes

  • Person with empty labels are ignored.
  • It is assumed that you have downloaded and uncompressed the lcnaf.both.ndjson file from the Library of Congress' servers. Future releases may support fetching this file directly.
  • This tool will work with the compressed and uncompressed version of lcnaf.both.ndjson. Keep in mind that compressed file is already 7GB and expands to an uncompressed 55GB.
  • This tool creates a temporary SQLite database (in the operating system's "temp" directory to track duplicate records. This is necessary because tracking duplicate IDs in memory tend to cause out-of-memory errors. The temporary SQLite database is removed when the tool exits.

parse-lcsh

parse-lcsh is a command-line tool to parse the Library of Congress Subject Headings (lcsh.both.ndjson) Subject Headings file and output CSV-encoded subject heading ID and (English) label data.

For example:

$> ./bin/parse-lcsh /usr/local/data/loc/lcsh.both.ndjson | less
id,label
sh98007138,Sports tournaments
sh85133899,Tennis--Tournaments
sh85133890,Tennis
sh91004781,Federation Cup
sh99005024,History
sh2009114899,Anarchism--Italy--History--20th century
sh2002012476,20th century
sh85004812,Anarchism
sh2008122899,Kitchens--Planning
sh85072576,Kitchens
sh2002006228,Planning
sh88001899,"Humorous poetry, Russian"
sh85116005,Russian poetry
sh85116022,Russian wit and humor
sh2008123899,Integrated circuits--Amateurs' manuals
sh99001292,Amateurs' manuals
sh85067117,Integrated circuits
sh85065604,Indians of South America--Ecuador--Antiquities
sh85040894,Ecuador--Antiquities
sh2005006899,Valdivian culture
... and so on

Notes

  • Subject headings with empty labels are ignored.
  • It is assumed that you have downloaded and uncompressed the lcsh.both.ndjson file from the Library of Congress' servers. Future releases may support fetching this file directly.
  • This tool will work with the compressed and uncompressed version of lcsh.both.ndjson.

See also

Owner
San Francisco International Airport Museum
San Francisco International Airport Museum
Similar Resources

Generic tools for go 1.18+

Gtools Generic tools for go 1.18+ FT (func tools) Provide func tools over iterators Iterators for functions like Filter, Map, Reduce, etc solve 3 main

Jan 12, 2022

Mixin-sticker - Mixin sticker tools for golang

mixin-sticker mixin sticker bot spider python3 spider.py usage: spider.py [-h] [

Jan 4, 2022

An interactive menu for Magisk's module installer with tools to alter Android

JD's Toolbox I'll update this with some details later, just getting the source code out for now... LICENSE The source code for JD's Toolbox is release

Jan 24, 2022

Various Dungeons and Dragons Tools. Written in go as an aid to learning the language.

dnd_tools Various Dungeons and Dragons Tools. Written in go as an aid to learning the language. Some tools are generic, while others will target eithe

Jan 28, 2022

Set of scripts & tools for converting between numbers and major system encoded words.

Set of scripts & tools for converting between numbers and major system encoded words.

major-system-converter Set of scripts & tools for converting between numbers and major system encoded words. Uses phonetics instead of letters to conv

Aug 9, 2022

A Go library for reading sensor data from the Adafruit SCD-40 and SCD-41

A Go module for reading CO2, temperature, and humidity data from the Sesirion SCD4x family of sensors. Example sensors are the Adafruit SCD-40 and Adafruit SCD-41. The former was used during the development of this module.

Dec 23, 2022

Library to work with MimeHeaders and another mime types. Library support wildcards and parameters.

Mime header Motivation This library created to help people to parse media type data, like headers, and store and match it. The main features of the li

Nov 9, 2022

Random fake data and struct generator for Go.

Faker Random fake data and struct generator for Go. More than 100 generator functions Struct generator Unique data generator Builtin types support Eas

Oct 3, 2022

Golang beautify data display for Humans

Golang beautify data display for Humans English 简体中文 Install # Stable version go get -u -v gopkg.in/ffmt.v1 # Latest version go get -u -v github.com/

Dec 22, 2022
Comments
  • Extract concordances

    Extract concordances

    > go run -mod vendor cmd/emit/main.go /usr/local/data/loc/lcsh.both.ndjson | grep -B 5 -A 5 wikidata | less
    
        {
          "@id": "http://id.worldcat.org/fast/1043464",
          "madsrdf:authoritativeLabel": "\"Ocean Ranger (Drilling rig)\" "
        },
        {
          "@id": "http://www.wikidata.org/entity/Q1772356",
          "madsrdf:authoritativeLabel": "\"Ocean Ranger\" "
        },
        {
          "@id": "http://id.loc.gov/authorities/subjects/sh85094386",
          "@type": ["skos:Concept", "madsrdf:Authority", "madsrdf:Topic"],
    --
    --
          "madsrdf:hasBroaderAuthority": {
            "@id": "http://id.loc.gov/authorities/subjects/sh85094386"
          },
          "madsrdf:hasCloseExternalAuthority": [
            {
              "@id": "http://www.wikidata.org/entity/Q1772356"
            },
            {
              "@id": "http://id.worldcat.org/fast/1043464"
            }
          ],
    --
    --
          "madsrdf:hasBroaderAuthority": {
            "@id": "http://id.loc.gov/authorities/subjects/sh85035599"
          },
          "madsrdf:hasCloseExternalAuthority": [
            {
              "@id": "http://www.wikidata.org/entity/Q1595414"
            },
            {
              "@id": "http://id.worldcat.org/fast/1252780"
            }
          ],
    --
    
  • Missing

    Missing "broader" subject headings

    $> go run -mod vendor cmd/parse-lcsh/main.go -include-all /usr/local/data/loc/lcsh.both.ndjson > lcsh.csv
    $> grep sh85015274 lcsh.csv 
    sh85015274,Boeing 727 (Jet transports),,,
    

    Compared with:

    https://id.loc.gov/authorities/subjects/sh85015274.html

  • Extract geo information

    Extract geo information

    go run -mod vendor cmd/emit/main.go /usr/local/data/loc/lcsh.both.ndjson | grep -A 5 '"@type": "madsrdf:GeographicElement",'
    
    ...
        },
    --
          "@type": "madsrdf:GeographicElement",
          "madsrdf:elementValue": {
            "@language": "en",
            "@value": "Sadang River (Celebes, Indonesia)"
          }
        },
    --
          "@type": "madsrdf:GeographicElement",
          "madsrdf:elementValue": {
            "@language": "en",
            "@value": "Indonesia"
          }
        }
    --
          "@type": "madsrdf:GeographicElement",
          "madsrdf:elementValue": {
            "@language": "en",
            "@value": "Spain"
          }
        },
    
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way to say thanks to the maintainers of the modules you use and the contributors of Go itself.
GoThanks automatically stars Go's official repository and your go.mod github dependencies, providing a simple way  to say thanks to the maintainers of the modules you use and the contributors of Go itself.

Give thanks (in the form of a GitHub ★) to your fellow Go modules maintainers. About GoThanks performs the following operations Sends a star to Go's r

Dec 24, 2022
Gosfdc module - a collection of packages containing the data structures from the various Salesforce APIs and Tools

Gosfdc module - a collection of packages containing the data structures from the various Salesforce APIs and Tools

Jan 21, 2022
The phylosophy behind readyGo is "A Simple configuration should give a working project.".
The phylosophy behind readyGo is

The phylosophy behind readyGo is "A Simple configuration should give a working project.". readyGo is a command line interface( probably the name of re

Oct 30, 2021
Go clean architecture fully working example

Burp - clean architecture app Burp is a CRUD app managing beers. Front-end is written in Angular 12. Database in this example is mongodb. Root project

Nov 27, 2022
A CLI for working with Go + Angular projects

NGGO A CLI tool for working with Angular + Go projects. Prerequisites You must have Go installed and GOPATH & GOBIN setup properly You must have angul

Feb 23, 2020
Exercise for solve problem data processing, performance and something wrong in passing data

Citcall Exercise Exercise for solve problem data processing, performance and something wrong in passing data Pengolahan data data processing - Readme

Nov 25, 2021
CapMonsterTool is a set of Go tools designed to simply make requests to the CapMonster Cloud API.

✨ CapMonsterTool ✨ About this module What is ✨ CapMonsterTool ✨ ? CapMonsterTool is a set of Go tools designed to simply make requests to the CapMonst

Dec 1, 2022
frida debug tools
frida debug tools

fd windows下frida的调试工具 (单 exe,不需要python和nodejs) 现在他只支持USB english click here 预编译的二进制文件在这里下载 支持列表: 创建一个基于 frida-agent-example的typescript工程(拥有完美的智能提示) 使用

Dec 30, 2022
Tools created for my OSCP preparation

goscp Set of tools created during my OSCP preparation. They include: gosheller - terminal based interface for cmdasp.aspx webshell. It provides intera

Dec 3, 2021
API and a set of tools to manage Netbox configuration declaratively

declarative-netbox An experimental project to explore the idea of managing the N

Jan 24, 2022