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: - urn (MyCapytain.common.reference.URN) – A URN identifier
- resource (lxml.etree._Element) – A resource
- parent (MyCapytain.resources.texts.tei.Passage) – Parent of the current passage
- citation (MyCapytain.resources.texts.tei.Citation) – Citation for children level
- id (List) – Identifier of the subreference without URN informations
-
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
-
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 (MyCapytain.common.reference.URN) – A URN identifier
- resource (Any) – A resource
-
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
-