Диссертация (1167217), страница 64
Текст из файла (страница 64)
Ansichten eines Clowns":self.filename = 'HBA.xml'elif self.chosenBook == "E.M.Remarque. Die Nacht von Lissabon":self.filename = 'ERN.xml'elif self.chosenBook == "E.M.Remarque. Liebe deinen Nächsten":self.filename = 'ERL.xml'if self.chbIgnore.isChecked():self.searchTab1Ignore()else:self.searchTab1M()def searchTab1M(self):# Parses XML to DOMself.dom = xml.dom.minidom.parse(self.filename)self.logInfo('Read to DOM: %s' % self.filename)self.collection = self.dom.documentElementself.sentArr = self.collection.getElementsByTagName("s")# Check all buttons one by one if toggled# First let's check the Sich-Verben button397if self.btnSich.isChecked():# If it is toggled, scanning of values is made# What is the value of the checkbox?if self.chbSich.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('sV') != value:p = line.parentNode# Removes child that does'n contain the index (parameter)p.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Prädikativ buttonif self.btnPred.isChecked():# If it is toggled, scanning of values is made# What is the value of the checkbox?if self.chbPred.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('prd') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Mverb buttonif self.btnMV.isChecked():# If it is toggled, scanning of values is made# What is the value of the checkbox?if self.chbMV.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('mV') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Adjektiv buttonif self.btnAdj.isChecked():# If it is toggled, scanning of values is made# What is the value of the checkbox with Superlativ?if self.chbAdj2.isChecked():# Local variable for the checkbox valuevalue = '1'398else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('aS') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Komparativ?if self.chbAdj1.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('aC') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Positiv?if self.chbAdj0.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('aP') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Präposition buttonif self.btnPrep.isChecked():# If it is toggled, scanning of values is made# What is the value of the checkbox with Genitiv?if self.chbPrep0.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('pG') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Dativ?if self.chbPrep1.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parameters399for line in self.sentArr:if line.getAttribute('pD') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Akkusativ?if self.chbPrep2.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('pA') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Doppelt?if self.chbPrep3.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('pDA') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Präfix buttonif self.btnPref.isChecked():# If it is toggled, scanning of values is made# What is the value of the checkbox with Trennbar?if self.chbPref1.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('pfT') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Untrennbar?if self.chbPref2.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('pfU') != value:p = line.parentNode400p.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Genus buttonif self.btnGenus.isChecked():# If it is toggled, scanning of values is made# What is the value of the checkbox with Zustandspassiv?if self.chbGen2.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('gZ') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Passiv?if self.chbGen1.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('gP') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Aktiv?if self.chbGen0.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('gA') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Modus buttonif self.btnModus.isChecked():# If it is toggled, scanning of values is made# What is the value of the radiobutton with Modus?if self.rbModus3.isChecked():# Local variable for the radiobutton, it can take only one valuevalue = '3'if self.rbModus2.isChecked():value = '2'if self.rbModus1.isChecked():value = '1'# Looking in DOM for sentences with corresponding parameters401for line in self.sentArr:if line.getAttribute('m') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Satz buttonif self.btnSatz.isChecked():# If it is toggled, scanning of values is made# What is the value of the radiobutton with Satz?if self.rbSatz0.isChecked():# Local variable for the radiobutton, it can take only one valuevalue = '0'if self.rbSatz1.isChecked():value = '1'if self.rbSatz2.isChecked():value = '2'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('st') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Artikel buttonif self.btnArt.isChecked():# If it is toggled, scanning of values is made# What is the value of the checkbox with Null?if self.chbArt0.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('aN') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Unbesstimt?if self.chbArt1.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('aU') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Bestimmt?if self.chbArt2.isChecked():# Local variable for the checkbox valuevalue = '1'402else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('aB') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Now let's check the Zeitform buttonif self.btnZForm.isChecked():# If it is toggled, scanning of values is made# What is the value of the checkbox with FuturII?if self.chbZeit5.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('tF2') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with FuturI?if self.chbZeit4.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('tF1') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Plusquamperfekt?if self.chbZeit3.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('tQ') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Präteritum?if self.chbZeit2.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parameters403for line in self.sentArr:if line.getAttribute('tPt') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Perfekt?if self.chbZeit1.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('tPf') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# What is the value of the checkbox with Präsens?if self.chbZeit0.isChecked():# Local variable for the checkbox valuevalue = '1'else:value = '0'# Looking in DOM for sentences with corresponding parametersfor line in self.sentArr:if line.getAttribute('tPs') != value:p = line.parentNodep.removeChild(line)self.sentArr = self.collection.getElementsByTagName("s")# Output in the textEdit areas = ''for line in self.sentArr:s += line.getAttribute('id') + '.