def get_fix_stage(self): tool = Tools() fDs = self.root.findall(".//"+self.prefix+"stage") result = [] for f in fDs: if ("{http://www.germanistik.uni-wuerzburg.de/lehrstuehle/computerphilologie/dramenanalyse}fixed-stage" in f.attrib): result.append(tool.unicode_safe(f.text)) #print tool.unicode_safe(f.text) return result
def get_all_speech(self): tools = Tools() fDs = self.root.findall(".//"+self.prefix+"speaker") result = [] for f in fDs: #jump empty speakers if f.text is not None: speaker = tools.unicode_safe(f.text) speaker_id = f.attrib["{http://www.w3.org/XML/1998/namespace}id"] sps=self.get_sp_by_speaker_id(speaker_id) for sp in sps: speechs = self.get_all_speech_by_speaker(sp) speech = Speech(speaker,speaker_id,speechs) result.append(speech) return result
def content_joiner(self): tools = Tools() text ="" for c in self.content: text = text + tools.unicode_safe(c.text) + "\n" return text