MyCapytain.resources.proto.text module

class MyCapytain.resources.proto.text.Passage(parent=None, **kwargs)[source]

Bases: MyCapytain.resources.proto.text.Resource

Passage representing object prototype

Parameters:
children

Children of the passage

Return type:OrderedDict
Returns:Dictionary of chidren, where key are subreferences
first

First child of current Passage

Return type:None or Passage
Returns:None if current Passage has no children, first child passage if available
last

Last child of current Passage

Return type:None or Passage
Returns:None if current Passage has no children, last child passage if available
next

Following passage

Return type:Passage
Returns:Following passage at same level
prev

Previous passage

Return type:Passage
Returns:Previous passage at same level
class MyCapytain.resources.proto.text.PassagePlus(passage, prev, next)

Bases: tuple

next

Alias for field number 2

passage

Alias for field number 0

prev

Alias for field number 1

class MyCapytain.resources.proto.text.Resource(urn=None, resource=None)[source]

Bases: object

Initiate a Resource object

Parameters:
urn

URN Identifier of the object

Return type:MyCapytain.common.reference.URN
class MyCapytain.resources.proto.text.Text(citation=None, metadata=None, **kwargs)[source]

Bases: MyCapytain.resources.proto.text.Resource

A CTS Text

citation

Get the lowest cRefPattern in the hierarchy

Return type:MyCapytain.common.reference.Citation
getLabel()[source]

Retrieve metadata about the text

Return type:dict
Returns:Dictionary with label informations
getPassage(reference)[source]

Retrieve a passage and store it in the object

Parameters:reference (MyCapytain.common.reference.Reference or List of basestring) – Reference of the passage
Return type:Passage
Returns:Object representing the passage
Raises:TypeError when reference is not a list or a Reference
getValidReff(level=1, reference=None)[source]

Given a resource, Text will compute valid reffs

Parameters:
  • level (Int) – Depth required. If not set, should retrieve first encountered level (1 based)
  • passage (Reference) – Subreference (optional)
Return type:

List.basestring

Returns:

List of levels

reffs

Get all valid reffs for every part of the Text

Return type:MyCapytain.resources.texts.tei.Citation