Giter Site home page Giter Site logo

library-1's Introduction

library

The module most commonly used here is SonicScrewdriver.py; I import it in lots of other code as "utils."

If you're working with HathiTrust pairtree folder structure, you may be interested in the functions clean_pairtree, dirty_pairtree, and pairtreepath.

pairtreepath converts a HathiTrust volume ID into a path. It accepts two arguments, the volume ID and a "root path." It also returns two results, the path and a "postfix."

Here's a usage example:

In [10]: import SonicScrewdriver as utils

In [11]: path, postfix = utils.pairtreepath('uiuo.ark:/13960/t4bp06k8v', 'my_corpus/')

In [12]: path
Out[12]: 'my_corpus/uiuo/pairtree_root/ar/k+/=1/39/60/=t/4b/p0/6k/8v/'

In [13]: postfix
Out[13]: 'ark+=13960=t4bp06k8v'

In [14]: path + postfix + '/' + postfix + '.zip'
Out[14]: 'my_corpus/uiuo/pairtree_root/ar/k+/=1/39/60/=t/4b/p0/6k/8v/ark+=13960=t4bp06k8v/ark+=13960=t4bp06k8v.zip'

The last line here is probably the path to uiuo.ark:/13960/t4bp06k8v in your folder structure.

clean_pairtree and dirty_pairtree become useful because one often needs to save or refer to files using the htid itself as a filename, without the rigamarole of pairtree structure. In order to do that, you have to "clean* the htid by removing illegal characters like slashes. For instance:

In [2]: utils.clean_pairtree('uiuo.ark:/13960/t4bp06k8v')
Out[2]: 'uiuo.ark+=13960=t4bp06k8v'

dirty_pairtree, obviously, reverses the process.

March 17, 2017

tokenizer.py is an old deprecated module

tokenizetexts.py is the updated version

Sat Aug 26, 2017

parsefeaturejsons.py converts HathiTrust extracted feature files into feature .tsvs that I use for predictive modeling. Probably only interests you if you want to replicate my particular workflow.

library-1's People

Contributors

tedunderwood avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.