def tofile(self, filePath, pretty=True): """ Exports the eaf object to a file with or without pretty printing<br /> <br /> filePath -- The output file path - for stdout<br /> pretty -- Flag for pretty indented output""" EafIO.toEaf(filePath, self)
def __init__(self, filePath=None, author='Elan.py'): """ Constructor, builds an elan object from file or an empty one<br /> <br /> filepath -- The path to load the file from<br /> author -- The author used in the xml tag<br /> """ self.naiveGenAnn, self.naiveGenTS = False, False self.annotationDocument = { 'AUTHOR': author, 'DATE': time.strftime("%Y-%m-%dT%H:%M:%S%z"), 'VERSION': '2.7', 'FORMAT': '2.7', 'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:noNamespaceSchemaLocation': 'http://www.mpi.nl/tools/elan/EAFv2.7.xsd' } self.controlled_vocabularies = {} self.constraints = {} self.tiers = {} self.linguistic_types = {} self.header = {} self.timeslots = {} self.external_refs = [] self.lexicon_refs = [] self.locales = [] self.media_descriptors = [] self.properties = [] self.linked_file_descriptors = [] self.new_time, self.new_ann = 0, 0 if filePath is None: self.addLinguisticType('default-lt', None) self.constraints = { 'Time_Subdivision': 'Time subdivision of parent annotation\'s time interval' + ', no time gaps allowed within this interval', 'Symbolic_Subdivision': 'Symbolic subdivision of a parent annotation. Annotation' + 's refering to the same parent are ordered', 'Symbolic_Association': '1-1 association with a parent annotation', 'Included_In': 'Time alignable annotations within the parent annotation' + '\'s time interval, gaps are allowed' } self.properties.append(('0', {'NAME': 'lastUsedAnnotation'})) self.addTier('default') else: EafIO.parseEaf(filePath, self)
def __init__(self, filePath=None, author="Elan.py"): """ Constructor, builds an elan object from file or an empty one<br /> <br /> filepath -- The path to load the file from<br /> author -- The author used in the xml tag<br /> """ self.naiveGenAnn, self.naiveGenTS = False, False self.annotationDocument = { "AUTHOR": author, "DATE": time.strftime("%Y-%m-%dT%H:%M:%S%z"), "VERSION": "2.7", "FORMAT": "2.7", "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance", "xsi:noNamespaceSchemaLocation": "http://www.mpi.nl/tools/elan/EAFv2.7.xsd", } self.controlled_vocabularies = {} self.constraints = {} self.tiers = {} self.linguistic_types = {} self.header = {} self.timeslots = {} self.external_refs = [] self.lexicon_refs = [] self.locales = [] self.media_descriptors = [] self.properties = [] self.linked_file_descriptors = [] self.new_time, self.new_ann = 0, 0 if filePath is None: self.addLinguisticType("default-lt", None) self.constraints = { "Time_Subdivision": "Time subdivision of parent annotation's time interval" + ", no time gaps allowed within this interval", "Symbolic_Subdivision": "Symbolic subdivision of a parent annotation. Annotation" + "s refering to the same parent are ordered", "Symbolic_Association": "1-1 association with a parent annotation", "Included_In": "Time alignable annotations within the parent annotation" + "'s time interval, gaps are allowed", } self.properties.append(("0", {"NAME": "lastUsedAnnotation"})) self.addTier("default") else: EafIO.parseEaf(filePath, self)