Skip to main content

Python package containing various utilities relevant in the field of digital humanities.

Project description

Digital Humanities Utilities

Python 3.6+ package containing various utilities relevant in the field of digital humanities.

$ pip install dh-utils

TEI utilities

Tag languages in a given string based on its script:

>>> from dh_utils import tei as t
>>> t.tag('A line contaning the hebrew אגוז מלך inline', 'Hebr')
'A line contaning the hebrew <foreign xml:lang="he-Hebr">אגוז מלך</foreign> inline'

It is also possible to tag a given language based on its script in a TEI XML document (NB: file will be overwritten!):

>>> t.tag_xml('path/to/file.xml', 'Arab')

The available scripts are stored in AVAILABLE_SCRIPTS and are enumerated below:

>>> t.AVAILABLE_SCRIPTS
['Arab', 'Copt', 'Hebr', 'Latn', 'Cyrl']

Default language-script codes are used to tag the scripts (stored in DEFAULT_LCS), which can be adjusted using the language_code keyword argument:

>>> t.tag_xml('path/to/file.xml', 'Cyrl', language_code = 'ov-Cyrs')

Unicode utilities

Decompose any unicode string:

>>> from dh_utils import unicode as u
>>> u.decompose('λόγος')
λ U+03bb GREEK SMALL LETTER LAMDA
ο U+03bf GREEK SMALL LETTER OMICRON
́ U+0301 COMBINING ACUTE ACCENT
γ U+03b3 GREEK SMALL LETTER GAMMA
ο U+03bf GREEK SMALL LETTER OMICRON
ς U+03c2 GREEK SMALL LETTER FINAL SIGMA

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dh-utils-0.1.7.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

dh_utils-0.1.7-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file dh-utils-0.1.7.tar.gz.

File metadata

  • Download URL: dh-utils-0.1.7.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4

File hashes

Hashes for dh-utils-0.1.7.tar.gz
Algorithm Hash digest
SHA256 44ed408a5b71ed8bf9e1d4db45b362780a307a3e59cf7ef5ce694e0e3045a5da
MD5 5045bca5e87934090d0b508b41680b7f
BLAKE2b-256 1a99cd4a71c381e0e0b8cc14b0191b5d160bd83ed8ca7d97802687a25021f3c8

See more details on using hashes here.

File details

Details for the file dh_utils-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: dh_utils-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.4

File hashes

Hashes for dh_utils-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 45a78fa4753b212df7fbdfaa04ac02f4c937ebd073d0512d36d4eb964c5bd9a2
MD5 2606af9c03da19603bd1fafc8d26eec1
BLAKE2b-256 fece195d11981ead1c7e02fa42dd7586035cef3fce1aa1dfec405f8014e83a46

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page