pyCTS
is a minimal Python implementation of the CTS URN
class as defined in the CTS protocol. It allows for performing basic operation on CTS URNs -- the identifiers defined and used by the CTS protocol and the CITE architecture.
The current implementation is largely a port to python of this CTS Java implementation by Neel Smith.
(NB: pyCTS
can be very convenient for basic manipulations on CTS URNs. For
advanced usage of such URNs (e.g. resolution) I recommend checking out the MyCapytain Python library).
Installing pyCTS
is as easy as pip install pyCTS
.
from pyCTS import CTS_URN
urn = CTS_URN("urn:cts:greekLit:tlg0003.tlg001:1.173")
print(urn.work) # Returns 'tlg001'
print(urn.textgroup) # Returns 'tlg0003'
print(urn.is_range()) # False
print(urn.get_citation_depth()) # Returns 2
For more usage examples see the doctstring tests.
The source code in this repository is licensed under the GNU General Public License version 3 (http://www.gnu.org/licenses/gpl.html).
(c) 2018 Matteo Romanello