Диссертация (1167217), страница 62
Текст из файла (страница 62)
Листинг программы для ЭВМ учебного назначения«Помощник лингвиста: переводческие эквиваленты»from tkinter import *import osimport randomimport ioimport timeclass Assistant:def __init__(self, amount, file_b, file_pv, file_g):self.amount = amountself.file_b = file_bself.file_pv = file_pvself.file_g = file_gself.value = []self.counter = 0def test(self):butStart["state"] = "disabled"entryName["state"] = "disabled"self.fB = open(self.file_b, 'r', encoding="utf-8")self.fPv = open(self.file_pv, 'r', encoding="utf-8")self.fG = open(self.file_g, 'r', encoding="utf-8")self.dataB = self.fB.readlines()self.dataPv = self.fPv.readlines()self.dataG = self.fG.readlines()self.name = entryName.get()self.nameTXT = valGroup[0] + "_" + self.name + ".txt"self.newFile = open(self.nameTXT, 'w', encoding="utf-8")self.newFile.write("Group: %s\n" % valGroup[0])self.newFile.write("Name: %s\n" % self.name)self.lb = Listbox(frame2, width=200, height=iterNum*m,selectmode=MULTIPLE, selectbackground="darkgreen")self.lb.grid()for q in range(0,iterNum*m, m):self.value.append(self.dataB[int(random.uniform(0,len(self.dataB)))])self.lb.insert(END,self.value[q])self.value.append(self.dataPv[int(random.uniform(0,len(self.dataPv)))])self.lb.insert(END,self.value[q+1])self.value.append(self.dataG[int(random.uniform(0,len(self.dataG)))])self.lb.insert(END,self.value[q+2])self.newFile.close()butCheck.grid()def testEnt(self, event):butStart["state"] = "disabled"entryName["state"] = "disabled"self.fB = open(self.file_b, 'r', encoding="utf-8")self.fPv = open(self.file_pv, 'r', encoding="utf-8")self.fG = open(self.file_g, 'r', encoding="utf-8")self.dataB = self.fB.readlines()self.dataPv = self.fPv.readlines()366self.dataG = self.fG.readlines()self.name = entryName.get()self.nameTXT = valGroup[0] + "_" + self.name + ".txt"self.newFile = open(self.nameTXT, 'w', encoding="utf-8")self.newFile.write("Group: %s\n" % valGroup[0])self.newFile.write("Name: %s\n" % self.name)self.lb = Listbox(frame2, width=200, height=iterNum*m,selectmode=MULTIPLE, selectbackground="darkgreen")self.lb.grid()for q in range(0,iterNum*m, m):self.value.append(self.dataB[int(random.uniform(0,len(self.dataB)))])self.lb.insert(END,self.value[q])self.value.append(self.dataPv[int(random.uniform(0,len(self.dataPv)))])self.lb.insert(END,self.value[q+1])self.value.append(self.dataG[int(random.uniform(0,len(self.dataG)))])self.lb.insert(END,self.value[q+2])self.newFile.close()butCheck.grid()def makeAFile(self):butCheck["state"] = "disabled"self.newFile = open(self.nameTXT, 'a', encoding="utf-8")self.tulpeSel = self.lb.curselection()for q in range(0,iterNum*m):self.word = "False"if q in self.tulpeSel:self.word = "True"self.counter = self.counter + 1self.newFile.write("%s %s" % (self.word, self.value[q]))self.res = int(self.counter/(iterNum*m)*10000)/100self.newFile.write("Result: %s" % str(self.res))self.newFile.write(" %\n")self.newFile.write(time.asctime(time.localtime(time.time())))self.newFile.close()root.destroy()os.startfile(self.nameTXT)iterNum = 5 ## number of questions from each filem = 3## number of filesi = Assistant(iterNum, "bib.txt", "proverbs.txt", "geo.txt")### Reading a groupvalGroup = []def getGroup():valGroup.append(entryGroup.get())root.destroy()def getGroupEnt(event):valGroup.append(entryGroup.get())root.destroy()root = Tk()root.title("Professor's Assistant")frame1 = Frame(root)367frame1.grid()entryGroup = Entry(frame1)entryGroup.bind("<Return>", getGroupEnt)entryGroup.grid()entryGroup.focus()butStart = Button(frame1, text="get the group", command=getGroup)butStart.grid()root.mainloop()### Reading the name of a student### and building 3 frames in rootroot = Tk()root.title("Professor's Assistant")frame1 = Frame(root)frame1.grid() ## row=0Label(frame1, text="Name of the student: ", fg="darkgreen").grid(row=0,column=0, sticky=W)entryName = Entry(frame1, width=100)entryName.bind("<Return>", i.testEnt)entryName.grid(row=0, column=1, sticky=W)entryName.focus()frame2 = Frame(root)frame2.grid() ## row=1butStart = Button(frame2, text="Start", command=i.test)butStart.grid(sticky=W)frame3 = Frame(root)frame3.grid() ## row=2butCheck = Button(frame3, text="Check", command=i.makeAFile)root.mainloop()368Приложение 6.
Листинг программ для ЭВМ комплекта «Помощниккорпусного лингвиста»Листинг программы для ЭВМ-автоматического преобразователя текстовогофайла в базу данных XMLimport xml.dom.minidomimport ioclass Parse01():attrBlank = "st='0' tPs='0' tPf='0' tPt='0' tQ='0' tF1='0' tF2='0' m='1'mV='0' aN='0' aB='0' aU='0' pG='0' pD='0' pA='0' pDA='0' pfT='0' pfU='0' prd='0'aP='0' aC='0' aS='0' gA='1' gP='0' gZ='0' sV='0'"def __init__(self):self.file = open('Liebe deinen Naechsten.txt', 'r')self.lines = self.file.readlines()#print(len(self.lines))self.file.close()self.file = open('1.xml', 'w')self.file.write("<?xml version='1.0' encoding='utf-8'?>")self.file.write("<book ttl='" + self.lines[0][0 : -1] + "'>\n")del self.lines[0]for self.line in self.lines:self.lineWN = self.line.split()self.num = '' + self.lineWN[0][0 : -1]self.line = "<s id='" + self.num + "' " + self.attrBlank + ">" +self.line[len(self.num)+2 : -1] + "</s>\n"self.file.write(self.line)self.file.write("</book>")self.file.close()if __name__ == '__main__':a = Parse01()Листинг программы для ЭВМ для автоматизированной разметкиспециального (грамматического) лингвистического корпусаfrom PyQt5 import QtCore, QtGui, QtWidgets#from PyQt5.QtCore import Qtimport sys#from xml.dom.minidom import parseimport xml.dom.minidomclass Ui_MainWindow(object):filename = '' # Global variable for the path to XML DBcolor = 'navy' # Tooltip text colorcurId = '' # Text from label with sentence IDdef setupUi(self, MainWindow):MainWindow.setObjectName("MainWindow")MainWindow.setFixedSize(600, 400)palette = QtGui.QPalette()369brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)brush = QtGui.QBrush(QtGui.QColor(170, 170, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)brush = QtGui.QBrush(QtGui.QColor(212, 212, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)brush = QtGui.QBrush(QtGui.QColor(85, 85, 127))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)brush = QtGui.QBrush(QtGui.QColor(113, 113, 170))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.BrightText, brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)brush = QtGui.QBrush(QtGui.QColor(245, 241, 176))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Shadow, brush)brush = QtGui.QBrush(QtGui.QColor(212, 212, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase,brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipBase, brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText,brush)brush = QtGui.QBrush(QtGui.QColor(170, 170, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)370palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)brush = QtGui.QBrush(QtGui.QColor(212, 212, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)brush = QtGui.QBrush(QtGui.QColor(85, 85, 127))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)brush = QtGui.QBrush(QtGui.QColor(113, 113, 170))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.BrightText,brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText,brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)brush = QtGui.QBrush(QtGui.QColor(245, 241, 176))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Shadow, brush)brush = QtGui.QBrush(QtGui.QColor(212, 212, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase,brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipBase,brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText,brush)brush = QtGui.QBrush(QtGui.QColor(85, 85, 127))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText,brush)brush = QtGui.QBrush(QtGui.QColor(170, 170, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)brush = QtGui.QBrush(QtGui.QColor(212, 212, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)371brush = QtGui.QBrush(QtGui.QColor(85, 85, 127))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)brush = QtGui.QBrush(QtGui.QColor(113, 113, 170))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)brush = QtGui.QBrush(QtGui.QColor(85, 85, 127))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.BrightText,brush)brush = QtGui.QBrush(QtGui.QColor(85, 85, 127))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText,brush)brush = QtGui.QBrush(QtGui.QColor(245, 241, 176))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)brush = QtGui.QBrush(QtGui.QColor(245, 241, 176))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Shadow, brush)brush = QtGui.QBrush(QtGui.QColor(170, 170, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase,brush)brush = QtGui.QBrush(QtGui.QColor(255, 255, 220))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipBase,brush)brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText,brush)MainWindow.setPalette(palette)self.centralwidget = QtWidgets.QWidget(MainWindow)self.centralwidget.setObjectName("centralwidget")self.textEdit = QtWidgets.QTextEdit(self.centralwidget)self.textEdit.setGeometry(QtCore.QRect(10, 70, 581, 101))font = QtGui.QFont()font.setPointSize(10)self.textEdit.setFont(font)self.textEdit.setObjectName("textEdit")self.btnPrev = QtWidgets.QPushButton(self.centralwidget)self.btnPrev.setGeometry(QtCore.QRect(210, 330, 75, 23))self.btnPrev.setObjectName("btnPrev")self.btnPrev.setEnabled(False)self.btnNext = QtWidgets.QPushButton(self.centralwidget)self.btnNext.setGeometry(QtCore.QRect(290, 330, 75, 23))self.btnNext.setFont(font)372self.btnNext.setObjectName("btnNext")self.btnNext.setEnabled(False)self.lblTitle = QtWidgets.QLabel(self.centralwidget)self.lblTitle.setGeometry(QtCore.QRect(10, 10, 581, 16))self.lblTitle.setObjectName("lblTitle")self.lblId = QtWidgets.QLabel(self.centralwidget)self.lblId.setGeometry(QtCore.QRect(10, 40, 46, 21))self.lblId.setObjectName("lblId")self.rbSatz0 = QtWidgets.QRadioButton(self.centralwidget)self.rbSatz0.setGeometry(QtCore.QRect(10, 200, 82, 17))self.rbSatz0.setObjectName("rbSatz0")self.buttonGroup = QtWidgets.QButtonGroup(MainWindow)self.buttonGroup.setObjectName("buttonGroup")self.buttonGroup.addButton(self.rbSatz0)self.rbSatz1 = QtWidgets.QRadioButton(self.centralwidget)self.rbSatz1.setGeometry(QtCore.QRect(10, 220, 82, 17))self.rbSatz1.setObjectName("rbSatz1")self.buttonGroup.addButton(self.rbSatz1)self.rbSatz2 = QtWidgets.QRadioButton(self.centralwidget)self.rbSatz2.setGeometry(QtCore.QRect(10, 240, 82, 17))self.rbSatz2.setObjectName("rbSatz2")self.buttonGroup.addButton(self.rbSatz2)self.lblSatz = QtWidgets.QLabel(self.centralwidget)self.lblSatz.setGeometry(QtCore.QRect(10, 180, 46, 13))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.lblSatz.setFont(font)self.lblSatz.setObjectName("lblSatz")self.line = QtWidgets.QFrame(self.centralwidget)self.line.setGeometry(QtCore.QRect(80, 180, 20, 171))self.line.setFrameShape(QtWidgets.QFrame.VLine)self.line.setFrameShadow(QtWidgets.QFrame.Sunken)self.line.setObjectName("line")self.lblZform = QtWidgets.QLabel(self.centralwidget)self.lblZform.setGeometry(QtCore.QRect(100, 180, 51, 16))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.lblZform.setFont(font)self.lblZform.setObjectName("lblZform")self.chbZeit0 = QtWidgets.QCheckBox(self.centralwidget)self.chbZeit0.setGeometry(QtCore.QRect(100, 200, 70, 17))self.chbZeit0.setObjectName("chbZeit0")self.chbZeit1 = QtWidgets.QCheckBox(self.centralwidget)self.chbZeit1.setGeometry(QtCore.QRect(100, 220, 70, 17))self.chbZeit1.setObjectName("chbZeit1")self.chbZeit2 = QtWidgets.QCheckBox(self.centralwidget)self.chbZeit2.setGeometry(QtCore.QRect(100, 240, 81, 17))self.chbZeit2.setObjectName("chbZeit2")self.chbZeit3 = QtWidgets.QCheckBox(self.centralwidget)self.chbZeit3.setGeometry(QtCore.QRect(100, 260, 81, 17))self.chbZeit3.setObjectName("chbZeit3")self.chbZeit4 = QtWidgets.QCheckBox(self.centralwidget)self.chbZeit4.setGeometry(QtCore.QRect(100, 280, 70, 17))373self.chbZeit4.setObjectName("chbZeit4")self.chbZeit5 = QtWidgets.QCheckBox(self.centralwidget)self.chbZeit5.setGeometry(QtCore.QRect(100, 300, 70, 17))self.chbZeit5.setObjectName("chbZeit5")self.line_2 = QtWidgets.QFrame(self.centralwidget)self.line_2.setGeometry(QtCore.QRect(170, 180, 20, 171))self.line_2.setFrameShape(QtWidgets.QFrame.VLine)self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)self.line_2.setObjectName("line_2")self.lblModus = QtWidgets.QLabel(self.centralwidget)self.lblModus.setGeometry(QtCore.QRect(190, 180, 51, 16))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.lblModus.setFont(font)self.lblModus.setObjectName("lblModus")self.rbModus2 = QtWidgets.QRadioButton(self.centralwidget)self.rbModus2.setGeometry(QtCore.QRect(190, 220, 82, 17))self.rbModus2.setObjectName("rbModus2")self.buttonGroup_2 = QtWidgets.QButtonGroup(MainWindow)self.buttonGroup_2.setObjectName("buttonGroup_2")self.buttonGroup_2.addButton(self.rbModus2)self.rbModus1 = QtWidgets.QRadioButton(self.centralwidget)self.rbModus1.setGeometry(QtCore.QRect(190, 200, 82, 17))self.rbModus1.setObjectName("rbModus1")self.buttonGroup_2.addButton(self.rbModus1)self.rbModus3 = QtWidgets.QRadioButton(self.centralwidget)self.rbModus3.setGeometry(QtCore.QRect(190, 240, 82, 17))self.rbModus3.setObjectName("rbModus3")self.buttonGroup_2.addButton(self.rbModus3)self.line_3 = QtWidgets.QFrame(self.centralwidget)self.line_3.setGeometry(QtCore.QRect(270, 180, 20, 141))self.line_3.setFrameShape(QtWidgets.QFrame.VLine)self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)self.line_3.setObjectName("line_3")self.lblMV = QtWidgets.QLabel(self.centralwidget)self.lblMV.setGeometry(QtCore.QRect(190, 260, 71, 16))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.lblMV.setFont(font)self.lblMV.setObjectName("lblMV")self.lblMV.setToolTip("<b style='color: %s;'>Modale Verben + lassen inmodaler Bedeutung</b>" % self.color)self.chbMV = QtWidgets.QCheckBox(self.centralwidget)self.chbMV.setGeometry(QtCore.QRect(190, 280, 70, 17))self.chbMV.setObjectName("chbMV")self.lblArt = QtWidgets.QLabel(self.centralwidget)self.lblArt.setGeometry(QtCore.QRect(290, 180, 51, 16))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.lblArt.setFont(font)self.lblArt.setObjectName("lblArt")374self.lblArt.setToolTip("<b style='color: %s;'>\"Der\" und \"ein\" inKasusformen</b>" % self.color)self.chbArt0 = QtWidgets.QCheckBox(self.centralwidget)self.chbArt0.setGeometry(QtCore.QRect(290, 200, 70, 17))self.chbArt0.setObjectName("chbArt0")self.chbArt1 = QtWidgets.QCheckBox(self.centralwidget)self.chbArt1.setGeometry(QtCore.QRect(290, 220, 70, 17))self.chbArt1.setObjectName("chbArt1")self.chbArt2 = QtWidgets.QCheckBox(self.centralwidget)self.chbArt2.setGeometry(QtCore.QRect(290, 240, 70, 17))self.chbArt2.setObjectName("chbArt2")self.line_4 = QtWidgets.QFrame(self.centralwidget)self.line_4.setGeometry(QtCore.QRect(350, 180, 20, 141))self.line_4.setFrameShape(QtWidgets.QFrame.VLine)self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)self.line_4.setObjectName("line_4")self.chbPrep0 = QtWidgets.QCheckBox(self.centralwidget)self.chbPrep0.setGeometry(QtCore.QRect(370, 200, 70, 17))self.chbPrep0.setObjectName("chbPrep0")self.chbPrep1 = QtWidgets.QCheckBox(self.centralwidget)self.chbPrep1.setGeometry(QtCore.QRect(370, 220, 70, 17))self.chbPrep1.setObjectName("chbPrep1")self.lblPrep = QtWidgets.QLabel(self.centralwidget)self.lblPrep.setGeometry(QtCore.QRect(370, 180, 51, 16))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.lblPrep.setFont(font)self.lblPrep.setObjectName("lblPrep")self.chbPrep2 = QtWidgets.QCheckBox(self.centralwidget)self.chbPrep2.setGeometry(QtCore.QRect(370, 240, 70, 17))self.chbPrep2.setObjectName("chbPrep2")self.chbPrep3 = QtWidgets.QCheckBox(self.centralwidget)self.chbPrep3.setGeometry(QtCore.QRect(370, 260, 70, 17))self.chbPrep3.setObjectName("chbPrep3")self.line_5 = QtWidgets.QFrame(self.centralwidget)self.line_5.setGeometry(QtCore.QRect(430, 180, 20, 171))self.line_5.setFrameShape(QtWidgets.QFrame.VLine)self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)self.line_5.setObjectName("line_5")self.chbPref1 = QtWidgets.QCheckBox(self.centralwidget)self.chbPref1.setGeometry(QtCore.QRect(10, 280, 70, 17))self.chbPref1.setObjectName("chbPref1")self.lblPref = QtWidgets.QLabel(self.centralwidget)self.lblPref.setGeometry(QtCore.QRect(10, 260, 71, 16))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.lblPref.setFont(font)self.lblPref.setObjectName("lblPref")self.lblPred = QtWidgets.QLabel(self.centralwidget)self.lblPred.setGeometry(QtCore.QRect(290, 260, 71, 16))font = QtGui.QFont()font.setBold(True)font.setWeight(75)375self.lblPred.setFont(font)self.lblPred.setObjectName("lblPred")self.chbPred = QtWidgets.QCheckBox(self.centralwidget)self.chbPred.setGeometry(QtCore.QRect(290, 280, 70, 17))self.chbPred.setObjectName("chbPred")self.chbAdj0 = QtWidgets.QCheckBox(self.centralwidget)self.chbAdj0.setGeometry(QtCore.QRect(450, 200, 70, 17))self.chbAdj0.setObjectName("chbAdj0")self.chbAdj1 = QtWidgets.QCheckBox(self.centralwidget)self.chbAdj1.setGeometry(QtCore.QRect(450, 220, 81, 17))self.chbAdj1.setObjectName("chbAdj1")self.lblAdj = QtWidgets.QLabel(self.centralwidget)self.lblAdj.setGeometry(QtCore.QRect(450, 180, 51, 16))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.lblAdj.setFont(font)self.lblAdj.setObjectName("lblAdj")self.chbAdj2 = QtWidgets.QCheckBox(self.centralwidget)self.chbAdj2.setGeometry(QtCore.QRect(450, 240, 81, 17))self.chbAdj2.setObjectName("chbAdj2")self.chbPref2 = QtWidgets.QCheckBox(self.centralwidget)self.chbPref2.setGeometry(QtCore.QRect(10, 300, 70, 17))self.chbPref2.setObjectName("chbPref2")self.label = QtWidgets.QLabel(self.centralwidget)self.label.setGeometry(QtCore.QRect(450, 260, 46, 13))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.label.setFont(font)self.label.setObjectName("label")self.chbGen2 = QtWidgets.QCheckBox(self.centralwidget)self.chbGen2.setGeometry(QtCore.QRect(450, 320, 111, 17))self.chbGen2.setObjectName("chbGen2")self.chbGen1 = QtWidgets.QCheckBox(self.centralwidget)self.chbGen1.setGeometry(QtCore.QRect(450, 300, 111, 17))self.chbGen1.setObjectName("chbGen1")self.chbGen0 = QtWidgets.QCheckBox(self.centralwidget)self.chbGen0.setGeometry(QtCore.QRect(450, 280, 111, 17))self.chbGen0.setObjectName("chbGen0")self.lblSich = QtWidgets.QLabel(self.centralwidget)self.lblSich.setGeometry(QtCore.QRect(370, 280, 61, 16))font = QtGui.QFont()font.setBold(True)font.setWeight(75)self.lblSich.setFont(font)self.lblSich.setObjectName("lblSich")self.chbSich = QtWidgets.QCheckBox(self.centralwidget)self.chbSich.setGeometry(QtCore.QRect(370, 300, 51, 17))self.chbSich.setObjectName("chbSich")MainWindow.setCentralWidget(self.centralwidget)self.menubar = QtWidgets.QMenuBar(MainWindow)self.menubar.setGeometry(QtCore.QRect(0, 0, 600, 21))self.menubar.setObjectName("menubar")376self.menuFile = QtWidgets.QMenu(self.menubar)self.menuFile.setObjectName("menuFile")self.menuControl = QtWidgets.QMenu(self.menubar)self.menuControl.setObjectName("menuControl")MainWindow.setMenuBar(self.menubar)self.statusbar = QtWidgets.QStatusBar(MainWindow)self.statusbar.setObjectName("statusbar")MainWindow.setStatusBar(self.statusbar)self.actionOpen = QtWidgets.QAction(MainWindow)self.actionOpen.setObjectName("actionOpen")self.actionSave = QtWidgets.QAction(MainWindow)self.actionSave.setObjectName("actionSave")self.actionSave.setEnabled(False)self.actionSaveAs = QtWidgets.QAction(MainWindow)self.actionSaveAs.setObjectName("actionSaveAs")self.actionSaveAs.setEnabled(False)self.actionExit = QtWidgets.QAction(MainWindow)self.actionExit.setObjectName("actionExit")self.actionGo_To = QtWidgets.QAction(MainWindow)self.actionGo_To.setObjectName("actionGo_To")self.actionGo_To.setEnabled(False)self.menuFile.addAction(self.actionOpen)self.menuFile.addAction(self.actionSave)self.menuFile.addAction(self.actionSaveAs)self.menuFile.addSeparator()self.menuFile.addAction(self.actionExit)self.menuControl.addAction(self.actionGo_To)self.menubar.addAction(self.menuFile.menuAction())self.menubar.addAction(self.menuControl.menuAction())self.lblFooter = QtWidgets.QLabel()self.lblFooter.setText('')#"© Alexey Gorozhanov, 2014")self.statusbar.addWidget(self.lblFooter, 1)self.retranslateUi(MainWindow)self.actionExit.triggered.connect(self.closeAll)QtCore.QMetaObject.connectSlotsByName(MainWindow)# Connection to functionsself.actionOpen.triggered.connect(self.openText)self.actionSave.triggered.connect(self.saveDom)self.actionSaveAs.triggered.connect(self.saveDomAs)self.actionGo_To.triggered.connect(self.gotoSent)self.btnNext.clicked.connect(self.nextB)self.btnPrev.clicked.connect(self.prevB)def retranslateUi(self, MainWindow):_translate = QtCore.QCoreApplication.translateMainWindow.setWindowTitle(_translate("MainWindow", "Coprus Editor"))self.textEdit.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n""<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n""p, li { white-space: pre-wrap; }\n""</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:10pt;font-weight:400; font-style:normal;\">\n""<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; marginleft:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br/></p></body></html>"))377self.btnPrev.setText(_translate("MainWindow", "<---"))self.btnNext.setText(_translate("MainWindow", "--->"))self.lblTitle.setText(_translate("MainWindow", ""))self.lblId.setText(_translate("MainWindow", ""))self.rbSatz0.setText(_translate("MainWindow", "0 Einfach"))self.rbSatz1.setText(_translate("MainWindow", "1 Reihe"))self.rbSatz2.setText(_translate("MainWindow", "2 Gefüge"))self.lblSatz.setText(_translate("MainWindow", "Satz"))self.lblZform.setText(_translate("MainWindow", "Zeitform"))self.chbZeit0.setText(_translate("MainWindow", "Präsens"))self.chbZeit1.setText(_translate("MainWindow", "Perfekt"))self.chbZeit2.setText(_translate("MainWindow", "Präteritum"))self.chbZeit3.setText(_translate("MainWindow", "Plusquamp."))self.chbZeit4.setText(_translate("MainWindow", "Futur I"))self.chbZeit5.setText(_translate("MainWindow", "Futur II"))self.lblModus.setText(_translate("MainWindow", "Modus"))self.rbModus2.setText(_translate("MainWindow", "2 Imperativ"))self.rbModus1.setText(_translate("MainWindow", "1 Indikativ"))self.rbModus3.setText(_translate("MainWindow", "3 Konjunktiv"))self.lblMV.setText(_translate("MainWindow", "Modalverb"))self.chbMV.setText(_translate("MainWindow", "x"))self.lblArt.setText(_translate("MainWindow", "Artikel"))self.chbArt0.setText(_translate("MainWindow", "Null"))self.chbArt1.setText(_translate("MainWindow", "Unbest."))self.chbArt2.setText(_translate("MainWindow", "Best."))self.chbPrep0.setText(_translate("MainWindow", "Genitiv"))self.chbPrep1.setText(_translate("MainWindow", "Dativ"))self.lblPrep.setText(_translate("MainWindow", "Präp."))self.chbPrep2.setText(_translate("MainWindow", "Akkusativ"))self.chbPrep3.setText(_translate("MainWindow", "Doppelt"))self.chbPref1.setText(_translate("MainWindow", "1 trennbar"))self.lblPref.setText(_translate("MainWindow", "Präfix"))self.lblPred.setText(_translate("MainWindow", "Prädikativ"))self.chbPred.setText(_translate("MainWindow", "x"))self.chbAdj0.setText(_translate("MainWindow", "Positiv"))self.chbAdj1.setText(_translate("MainWindow", "Komparativ"))self.lblAdj.setText(_translate("MainWindow", "Adjektiv"))self.chbAdj2.setText(_translate("MainWindow", "Superlativ"))self.chbPref2.setText(_translate("MainWindow", "2 untr."))self.label.setText(_translate("MainWindow", "Genus"))self.chbGen2.setText(_translate("MainWindow", "Zustandspassiv"))self.chbGen1.setText(_translate("MainWindow", "Passiv"))self.chbGen0.setText(_translate("MainWindow", "Aktiv"))self.lblSich.setText(_translate("MainWindow", "Sich-Verb"))self.chbSich.setText(_translate("MainWindow", "x"))self.menuFile.setTitle(_translate("MainWindow", "File"))self.menuControl.setTitle(_translate("MainWindow", "Control"))self.actionOpen.setText(_translate("MainWindow", "Open"))self.actionOpen.setShortcut(_translate("MainWindow", "Ctrl+O"))self.actionSave.setText(_translate("MainWindow", "Save"))self.actionSaveAs.setText(_translate("MainWindow", "Save As"))self.actionExit.setText(_translate("MainWindow", "Exit"))self.actionGo_To.setText(_translate("MainWindow", "Go To"))# Opens file with XML DB378def openText(self):options = QtWidgets.QFileDialog.Options()fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self.centralwidget,"Open XML Database", '',"XML Files (*.xml)", options=options)if fileName:self.filename = fileNameself.dom = xml.dom.minidom.parse(self.filename)self.collection = self.dom.documentElementself.lblTitle.setText(self.collection.getAttribute('ttl')[1:])self.sentArr = self.collection.getElementsByTagName("s")# Output of the first sentenceself.outputSent(1)self.allId = len(self.sentArr)self.actionGo_To.setEnabled(True)self.btnNext.setEnabled(True)self.btnPrev.setEnabled(True)self.actionSave.setEnabled(True)self.actionSaveAs.setEnabled(True)self.lblFooter.setText("Opened: %s" % self.filename)# Proceeds to the given sentencedef gotoSent(self):# Updates current sentence before go toself.curId = int(self.lblId.text())self.updateDom(self.curId)# Request the number from the userid, ok = QtWidgets.QInputDialog.getInt(self.centralwidget,"Go To Sentence","Enter A Number 1-%d:" %self.allId, 1, 1, self.allId, 1)if ok:self.outputSent(id)# Proceeds to the next sentencedef nextB(self):self.curId = int(self.lblId.text())self.updateDom(self.curId)if self.curId < self.allId:self.curId += 1self.outputSent(self.curId)# Proceeds to the previous sentencedef prevB(self):self.curId = int(self.lblId.text())self.updateDom(self.curId)if self.curId > 1:self.curId -= 1self.outputSent(self.curId)# Sets interface parameters for the current sentencedef outputSent(self, num):# Sets idself.lblId.setText(self.sentArr[num-1].getAttribute('id'))# Sets the text of the sentence379self.textEdit.setText(self.sentArr[num-1].childNodes[0].data)# Sentenceif self.sentArr[num-1].getAttribute('st') == '0': # Einfachself.rbSatz0.setChecked(True)elif self.sentArr[num-1].getAttribute('st') == '1': # Reiheself.rbSatz1.setChecked(True)elif self.sentArr[num-1].getAttribute('st') == '2': # Gefügeself.rbSatz2.setChecked(True)# Tempora# Präsesif self.sentArr[num-1].getAttribute('tPs') == '1':self.chbZeit0.setChecked(True)else:self.chbZeit0.setChecked(False)# Perfektif self.sentArr[num-1].getAttribute('tPf') == '1':self.chbZeit1.setChecked(True)else:self.chbZeit1.setChecked(False)# Präteritumif self.sentArr[num-1].getAttribute('tPt') == '1':self.chbZeit2.setChecked(True)else:self.chbZeit2.setChecked(False)# Qlusquamperfektif self.sentArr[num-1].getAttribute('tQ') == '1':self.chbZeit3.setChecked(True)else:self.chbZeit3.setChecked(False)# Futur Iif self.sentArr[num-1].getAttribute('tF1') == '1':self.chbZeit4.setChecked(True)else:self.chbZeit4.setChecked(False)# Futur IIif self.sentArr[num-1].getAttribute('tF2') == '1':self.chbZeit5.setChecked(True)else:self.chbZeit5.setChecked(False)# Präfixe# Trennbarif self.sentArr[num-1].getAttribute('pfT') == '1':self.chbPref1.setChecked(True)else:self.chbPref1.setChecked(False)# Untrennbarif self.sentArr[num-1].getAttribute('pfU') == '1':self.chbPref2.setChecked(True)else:self.chbPref2.setChecked(False)# Modusif self.sentArr[num-1].getAttribute('m') == '1': # Indikativself.rbModus1.setChecked(True)elif self.sentArr[num-1].getAttribute('m') == '2': # Imperativself.rbModus2.setChecked(True)380elif self.sentArr[num-1].getAttribute('m') == '3': # Konjunktivself.rbModus3.setChecked(True)# Modalverbif self.sentArr[num-1].getAttribute('mV') == '1':self.chbMV.setChecked(True)else:self.chbMV.setChecked(False)# Prädikativif self.sentArr[num-1].getAttribute('prd') == '1':self.chbPred.setChecked(True)else:self.chbPred.setChecked(False)# Artikelif self.sentArr[num-1].getAttribute('aN') == '1': # Nullself.chbArt0.setChecked(True)else:self.chbArt0.setChecked(False)if self.sentArr[num-1].getAttribute('aU') == '1': # Unbestimmtself.chbArt1.setChecked(True)else:self.chbArt1.setChecked(False)if self.sentArr[num-1].getAttribute('aB') == '1': # Bestimmtself.chbArt2.setChecked(True)else:self.chbArt2.setChecked(False)# Präpositionenif self.sentArr[num-1].getAttribute('pG') == '1': # Genitivself.chbPrep0.setChecked(True)else:self.chbPrep0.setChecked(False)if self.sentArr[num-1].getAttribute('pD') == '1': # Dativself.chbPrep1.setChecked(True)else:self.chbPrep1.setChecked(False)if self.sentArr[num-1].getAttribute('pA') == '1': # Akkusativself.chbPrep2.setChecked(True)else:self.chbPrep2.setChecked(False)if self.sentArr[num-1].getAttribute('pDA') == '1': # Doppeltself.chbPrep3.setChecked(True)else:self.chbPrep3.setChecked(False)# Adjektiveif self.sentArr[num-1].getAttribute('aP') == '1': # Positivself.chbAdj0.setChecked(True)else:self.chbAdj0.setChecked(False)if self.sentArr[num-1].getAttribute('aC') == '1': # Komparativself.chbAdj1.setChecked(True)else:self.chbAdj1.setChecked(False)if self.sentArr[num-1].getAttribute('aS') == '1': # Superlativself.chbAdj2.setChecked(True)else:self.chbAdj2.setChecked(False)381# Genusif self.sentArr[num-1].getAttribute('gA') == '1': # Aktivself.chbGen0.setChecked(True)else:self.chbGen0.setChecked(False)if self.sentArr[num-1].getAttribute('gP') == '1': # Passivself.chbGen1.setChecked(True)else:self.chbGen1.setChecked(False)if self.sentArr[num-1].getAttribute('gZ') == '1': # Zustandspassivself.chbGen2.setChecked(True)else:self.chbGen2.setChecked(False)# Sich-Verbenif self.sentArr[num-1].getAttribute('sV') == '1':self.chbSich.setChecked(True)else:self.chbSich.setChecked(False)# save the text from textEditself.sentArr[num-1].childNodes[0].data = self.textEdit.toPlainText()# Updates the current sentence in DOMdef updateDom(self, num):# Satzif self.rbSatz0.isChecked():self.sentArr[num-1].setAttribute('st', '0')elif self.rbSatz1.isChecked():self.sentArr[num-1].setAttribute('st', '1')elif self.rbSatz2.isChecked():self.sentArr[num-1].setAttribute('st', '2')# Tempora# Präsesif self.chbZeit0.isChecked():self.sentArr[num-1].setAttribute('tPs', '1')else:self.sentArr[num-1].setAttribute('tPs', '0')# Perfektif self.chbZeit1.isChecked():self.sentArr[num-1].setAttribute('tPf', '1')else:self.sentArr[num-1].setAttribute('tPf', '0')# Präteritumif self.chbZeit2.isChecked():self.sentArr[num-1].setAttribute('tPt', '1')else:self.sentArr[num-1].setAttribute('tPt', '0')# Qlusquamperfektif self.chbZeit3.isChecked():self.sentArr[num-1].setAttribute('tQ', '1')else:self.sentArr[num-1].setAttribute('tQ', '0')# Futur Iif self.chbZeit4.isChecked():self.sentArr[num-1].setAttribute('tF1', '1')else:382self.sentArr[num-1].setAttribute('tF1', '0')# Futur IIif self.chbZeit5.isChecked():self.sentArr[num-1].setAttribute('tF2', '1')else:self.sentArr[num-1].setAttribute('tF2', '0')# Präfixe# Trennbarif self.chbPref1.isChecked():self.sentArr[num-1].setAttribute('pfT', '1')else:self.sentArr[num-1].setAttribute('pfT', '0')# Untrennbarif self.chbPref2.isChecked():self.sentArr[num-1].setAttribute('pfU', '1')else:self.sentArr[num-1].setAttribute('pfU', '0')# Modusif self.rbModus1.isChecked(): # Indikativself.sentArr[num-1].setAttribute('m', '1')elif self.rbModus2.isChecked(): # Imperativself.sentArr[num-1].setAttribute('m', '2')elif self.rbModus3.isChecked(): # Konjunktivself.sentArr[num-1].setAttribute('m', '3')# Modalverbif self.chbMV.isChecked():self.sentArr[num-1].setAttribute('mV', '1')else:self.sentArr[num-1].setAttribute('mV', '0')# Prädikativif self.chbPred.isChecked():self.sentArr[num-1].setAttribute('prd', '1')else:self.sentArr[num-1].setAttribute('prd', '0')# Artikelif self.chbArt0.isChecked(): # Nullself.sentArr[num-1].setAttribute('aN', '1')else:self.sentArr[num-1].setAttribute('aN', '0')if self.chbArt1.isChecked(): # Unbestimmtself.sentArr[num-1].setAttribute('aU', '1')else:self.sentArr[num-1].setAttribute('aU', '0')if self.chbArt2.isChecked(): # Bestimmtself.sentArr[num-1].setAttribute('aB', '1')else:self.sentArr[num-1].setAttribute('aB', '0')# Präpositionenif self.chbPrep0.isChecked(): # Genitivself.sentArr[num-1].setAttribute('pG', '1')else:self.sentArr[num-1].setAttribute('pG', '0')if self.chbPrep1.isChecked(): # Dativself.sentArr[num-1].setAttribute('pD', '1')else:383self.sentArr[num-1].setAttribute('pD', '0')if self.chbPrep2.isChecked(): # Akkusativself.sentArr[num-1].setAttribute('pA', '1')else:self.sentArr[num-1].setAttribute('pA', '0')if self.chbPrep3.isChecked(): # Doppeltself.sentArr[num-1].setAttribute('pDA', '1')else:self.sentArr[num-1].setAttribute('pDA', '0')# Adjektiveif self.chbAdj0.isChecked(): # Positivself.sentArr[num-1].setAttribute('aP', '1')else:self.sentArr[num-1].setAttribute('aP', '0')if self.chbAdj1.isChecked(): # Komparativself.sentArr[num-1].setAttribute('aC', '1')else:self.sentArr[num-1].setAttribute('aC', '0')if self.chbAdj2.isChecked(): # Superlativself.sentArr[num-1].setAttribute('aS', '1')else:self.sentArr[num-1].setAttribute('aS', '0')# Genusif self.chbGen0.isChecked(): # Aktivself.sentArr[num-1].setAttribute('gA', '1')else:self.sentArr[num-1].setAttribute('gA', '0')if self.chbGen1.isChecked(): # Passivself.sentArr[num-1].setAttribute('gP', '1')else:self.sentArr[num-1].setAttribute('gP', '0')if self.chbGen2.isChecked(): # Zustandspassivself.sentArr[num-1].setAttribute('gZ', '1')else:self.sentArr[num-1].setAttribute('gZ', '0')# Sich-Verbenif self.chbSich.isChecked():self.sentArr[num-1].setAttribute('sV', '1')else:self.sentArr[num-1].setAttribute('sV', '0')# save the text from textEditself.sentArr[num-1].childNodes[0].data = self.textEdit.toPlainText()# Saves DOM to the current filedef saveDom(self):self.curId = int(self.lblId.text())self.updateDom(self.curId)if self.filename != '':open(self.filename, 'wb').write(self.dom.toxml('utf-8'))self.lblFooter.setText('Saved: %s' % self.filename)def saveDomAs(self):self.curId = int(self.lblId.text())self.updateDom(self.curId)options = QtWidgets.QFileDialog.Options()384fileName1, _ = QtWidgets.QFileDialog.getSaveFileName(self.centralwidget,"Save", '', "XML Files (*.xml)", options=options)if fileName1:open(fileName1, 'wb').write(self.dom.toxml('utf-8'))self.lblFooter.setText('Saved As: %s' % fileName1)def closeAll(self):if self.curId != '':self.curId = int(self.lblId.text())self.updateDom(self.curId)self.saveDom()MainWindow.close()if __name__ == "__main__":app = QtWidgets.QApplication(sys.argv)MainWindow = QtWidgets.QMainWindow()ui = Ui_MainWindow()ui.setupUi(MainWindow)MainWindow.show()sys.exit(app.exec_())Листинг программы для ЭВМ для работы с готовым лингвистическимкорпусом (корпусный менеджер)# -*- coding: utf-8 -*#######Form implementation generated from reading ui file 'searchW.ui'Created: Tue Apr 1 14:04:43 2014by: PyQt5 UI code generator 5.2.1WARNING! All changes made in this file will be lost!http://qt-project.org/doc/qt-5/qregexp.html - docs on QRegExfrom PyQt5 import QtCore, QtGui, QtWidgetsimport xml.dom.minidomimport ioimport reclass Ui_MainWindow(object):def setupUi(self, MainWindow):MainWindow.setObjectName("MainWindow")MainWindow.setGeometry(10, 30, 900, 600)MainWindow.setFixedSize(900, 600)self.color = QtGui.QColor("yellow")palette = QtGui.QPalette()brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)brush = QtGui.QBrush(QtGui.QColor(0, 130, 130)) # Main Window background.2, 132, 0brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)385brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)brush = QtGui.QBrush(QtGui.QColor(95, 213, 138))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)brush = QtGui.QBrush(QtGui.QColor(95, 213, 138))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)brush = QtGui.QBrush(QtGui.QColor(95, 213, 138))brush.setStyle(QtCore.Qt.SolidPattern)palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)MainWindow.setPalette(palette)self.centralwidget = QtWidgets.QWidget(MainWindow)self.centralwidget.setObjectName("centralwidget")self.textEdit = QtWidgets.QTextEdit(self.centralwidget)self.textEdit.setGeometry(QtCore.QRect(303, 0, 591, 551))font = QtGui.QFont()font.setPointSize(10)self.textEdit.setFont(font)self.textEdit.setObjectName("textEdit")self.pushButton = QtWidgets.QPushButton(self.centralwidget)self.pushButton.setEnabled(False)self.pushButton.setGeometry(QtCore.QRect(10, 10, 281, 23))self.pushButton.setObjectName("pushButton")self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)self.tabWidget.setGeometry(QtCore.QRect(0, 40, 301, 391))self.tabWidget.setObjectName("tabWidget")self.tab = QtWidgets.QWidget()self.stylesheet = "QTabBar::tab:selected {background: #ffff00;}QTabWidget::pane { border-top: 2px solid #C2C7CB;}" #QTabWidget>QWidget>QWidget{background: #028482;}self.tabWidget.setStyleSheet(self.stylesheet)self.tab.setObjectName("tab")self.chbZeit4 = QtWidgets.QCheckBox(self.tab)self.chbZeit4.setEnabled(False)self.chbZeit4.setGeometry(QtCore.QRect(100, 120, 70, 17))self.chbZeit4.setObjectName("chbZeit4")self.bgModus = QtWidgets.QButtonGroup(MainWindow)self.bgModus.setObjectName("bgModus")self.bgSatz = QtWidgets.QButtonGroup(MainWindow)self.bgSatz.setObjectName("bgSatz")self.rbModus1 = QtWidgets.QRadioButton(self.tab)self.rbModus1.setEnabled(False)self.rbModus1.setGeometry(QtCore.QRect(200, 40, 82, 17))self.rbModus1.setObjectName("rbModus1")self.rbModus2 = QtWidgets.QRadioButton(self.tab)self.rbModus2.setEnabled(False)self.rbModus2.setGeometry(QtCore.QRect(200, 60, 82, 17))self.rbModus2.setObjectName("rbModus2")self.rbModus3 = QtWidgets.QRadioButton(self.tab)self.rbModus3.setEnabled(False)self.rbModus3.setGeometry(QtCore.QRect(200, 80, 82, 17))386self.rbModus3.setObjectName("rbModus3")self.rbSatz0 = QtWidgets.QRadioButton(self.tab)self.rbSatz0.setEnabled(False)self.rbSatz0.setGeometry(QtCore.QRect(10, 40, 82, 17))self.rbSatz0.setObjectName("rbSatz0")self.rbSatz1 = QtWidgets.QRadioButton(self.tab)self.rbSatz1.setEnabled(False)self.rbSatz1.setGeometry(QtCore.QRect(10, 60, 82, 17))self.rbSatz1.setObjectName("rbSatz1")self.rbSatz2 = QtWidgets.QRadioButton(self.tab)self.rbSatz2.setEnabled(False)self.rbSatz2.setGeometry(QtCore.QRect(10, 80, 82, 17))self.rbSatz2.setObjectName("rbSatz2")self.btnPrep = QtWidgets.QPushButton(self.tab)self.btnPrep.setGeometry(QtCore.QRect(100, 160, 75, 23))self.btnPrep.setCheckable(True)self.btnPrep.setChecked(False)self.btnPrep.setObjectName("btnPrep")self.chbGen2 = QtWidgets.QCheckBox(self.tab)self.chbGen2.setEnabled(False)self.chbGen2.setGeometry(QtCore.QRect(200, 320, 91, 17))self.chbGen2.setObjectName("chbGen2")self.chbPred = QtWidgets.QCheckBox(self.tab)self.chbPred.setEnabled(False)self.chbPred.setGeometry(QtCore.QRect(10, 300, 70, 17))self.chbPred.setObjectName("chbPred")self.chbAdj0 = QtWidgets.QCheckBox(self.tab)self.chbAdj0.setEnabled(False)self.chbAdj0.setGeometry(QtCore.QRect(200, 190, 70, 17))self.chbAdj0.setObjectName("chbAdj0")self.chbZeit5 = QtWidgets.QCheckBox(self.tab)self.chbZeit5.setEnabled(False)self.chbZeit5.setGeometry(QtCore.QRect(100, 140, 70, 17))self.chbZeit5.setObjectName("chbZeit5")self.btnGenus = QtWidgets.QPushButton(self.tab)self.btnGenus.setGeometry(QtCore.QRect(200, 250, 75, 23))self.btnGenus.setCheckable(True)self.btnGenus.setChecked(False)self.btnGenus.setObjectName("btnGenus")self.btnArt = QtWidgets.QPushButton(self.tab)self.btnArt.setGeometry(QtCore.QRect(10, 180, 75, 23))self.btnArt.setCheckable(True)self.btnArt.setObjectName("btnArt")self.btnPred = QtWidgets.QPushButton(self.tab)self.btnPred.setGeometry(QtCore.QRect(10, 270, 75, 23))self.btnPred.setCheckable(True)self.btnPred.setChecked(False)self.btnPred.setObjectName("btnPred")self.btnAdj = QtWidgets.QPushButton(self.tab)self.btnAdj.setGeometry(QtCore.QRect(200, 160, 75, 23))self.btnAdj.setCheckable(True)self.btnAdj.setChecked(False)self.btnAdj.setObjectName("btnAdj")387self.chbArt1 = QtWidgets.QCheckBox(self.tab)self.chbArt1.setEnabled(False)self.chbArt1.setGeometry(QtCore.QRect(10, 230, 70, 17))self.chbArt1.setObjectName("chbArt1")self.btnModus = QtWidgets.QPushButton(self.tab)self.btnModus.setGeometry(QtCore.QRect(200, 10, 75, 23))self.btnModus.setCheckable(True)self.btnModus.setObjectName("btnModus")self.btnSatz = QtWidgets.QPushButton(self.tab)self.btnSatz.setGeometry(QtCore.QRect(10, 10, 75, 23))self.btnSatz.setCheckable(True)self.btnSatz.setObjectName("btnSatz")self.chbPref2 = QtWidgets.QCheckBox(self.tab)self.chbPref2.setEnabled(False)self.chbPref2.setGeometry(QtCore.QRect(10, 150, 70, 17))self.chbPref2.setObjectName("chbPref2")self.chbPrep0 = QtWidgets.QCheckBox(self.tab)self.chbPrep0.setEnabled(False)self.chbPrep0.setGeometry(QtCore.QRect(100, 190, 70, 17))self.chbPrep0.setObjectName("chbPrep0")self.chbArt2 = QtWidgets.QCheckBox(self.tab)self.chbArt2.setEnabled(False)self.chbArt2.setGeometry(QtCore.QRect(10, 250, 70, 17))self.chbArt2.setObjectName("chbArt2")self.chbZeit1 = QtWidgets.QCheckBox(self.tab)self.chbZeit1.setEnabled(False)self.chbZeit1.setGeometry(QtCore.QRect(100, 60, 70, 17))self.chbZeit1.setObjectName("chbZeit1")self.chbMV = QtWidgets.QCheckBox(self.tab)self.chbMV.setEnabled(False)self.chbMV.setGeometry(QtCore.QRect(200, 130, 70, 17))self.chbMV.setObjectName("chbMV")self.chbArt0 = QtWidgets.QCheckBox(self.tab)self.chbArt0.setEnabled(False)self.chbArt0.setGeometry(QtCore.QRect(10, 210, 70, 17))self.chbArt0.setObjectName("chbArt0")self.line_3 = QtWidgets.QFrame(self.tab)self.line_3.setGeometry(QtCore.QRect(180, 10, 16, 331))self.line_3.setFrameShape(QtWidgets.QFrame.VLine)self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)self.line_3.setObjectName("line_3")self.chbAdj1 = QtWidgets.QCheckBox(self.tab)self.chbAdj1.setEnabled(False)self.chbAdj1.setGeometry(QtCore.QRect(200, 210, 81, 17))self.chbAdj1.setObjectName("chbAdj1")self.chbPref1 = QtWidgets.QCheckBox(self.tab)self.chbPref1.setEnabled(False)self.chbPref1.setGeometry(QtCore.QRect(10, 130, 70, 17))self.chbPref1.setObjectName("chbPref1")self.chbPrep1 = QtWidgets.QCheckBox(self.tab)self.chbPrep1.setEnabled(False)self.chbPrep1.setGeometry(QtCore.QRect(100, 210, 70, 17))self.chbPrep1.setObjectName("chbPrep1")self.chbPrep2 = QtWidgets.QCheckBox(self.tab)self.chbPrep2.setEnabled(False)388self.chbPrep2.setGeometry(QtCore.QRect(100, 230, 70, 17))self.chbPrep2.setObjectName("chbPrep2")self.chbZeit0 = QtWidgets.QCheckBox(self.tab)self.chbZeit0.setEnabled(False)self.chbZeit0.setGeometry(QtCore.QRect(100, 40, 70, 20))self.chbZeit0.setObjectName("chbZeit0")self.chbSich = QtWidgets.QCheckBox(self.tab)self.chbSich.setEnabled(False)self.chbSich.setGeometry(QtCore.QRect(100, 300, 51, 17))self.chbSich.setObjectName("chbSich")self.chbAdj2 = QtWidgets.QCheckBox(self.tab)self.chbAdj2.setEnabled(False)self.chbAdj2.setGeometry(QtCore.QRect(200, 230, 81, 17))self.chbAdj2.setObjectName("chbAdj2")self.btnZForm = QtWidgets.QPushButton(self.tab)self.btnZForm.setGeometry(QtCore.QRect(100, 10, 75, 23))self.btnZForm.setCheckable(True)self.btnZForm.setObjectName("btnZForm")self.btnSich = QtWidgets.QPushButton(self.tab)self.btnSich.setGeometry(QtCore.QRect(100, 270, 75, 23))self.btnSich.setCheckable(True)self.btnSich.setChecked(False)self.btnSich.setObjectName("btnSich")self.chbGen1 = QtWidgets.QCheckBox(self.tab)self.chbGen1.setEnabled(False)self.chbGen1.setGeometry(QtCore.QRect(200, 300, 81, 17))self.chbGen1.setObjectName("chbGen1")self.btnMV = QtWidgets.QPushButton(self.tab)self.btnMV.setGeometry(QtCore.QRect(200, 100, 75, 23))self.btnMV.setCheckable(True)self.btnMV.setObjectName("btnMV")self.bgModus.addButton(self.rbModus1)self.bgModus.addButton(self.rbModus2)self.bgModus.addButton(self.rbModus3)self.bgSatz.addButton(self.rbSatz0)self.bgSatz.addButton(self.rbSatz1)self.bgSatz.addButton(self.rbSatz2)self.rbModus1.setChecked(True)self.rbSatz0.setChecked(True)self.btnPref = QtWidgets.QPushButton(self.tab)self.btnPref.setGeometry(QtCore.QRect(10, 100, 75, 23))self.btnPref.setCheckable(True)self.btnPref.setChecked(False)self.btnPref.setObjectName("btnPref")self.chbZeit3 = QtWidgets.QCheckBox(self.tab)self.chbZeit3.setEnabled(False)self.chbZeit3.setGeometry(QtCore.QRect(100, 100, 81, 17))self.chbZeit3.setObjectName("chbZeit3")self.line_4 = QtWidgets.QFrame(self.tab)self.line_4.setGeometry(QtCore.QRect(80, 10, 20, 331))self.line_4.setFrameShape(QtWidgets.QFrame.VLine)self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)389self.line_4.setObjectName("line_4")self.chbZeit2 = QtWidgets.QCheckBox(self.tab)self.chbZeit2.setEnabled(False)self.chbZeit2.setGeometry(QtCore.QRect(100, 80, 81, 17))self.chbZeit2.setObjectName("chbZeit2")self.chbPrep3 = QtWidgets.QCheckBox(self.tab)self.chbPrep3.setEnabled(False)self.chbPrep3.setGeometry(QtCore.QRect(100, 250, 70, 17))self.chbPrep3.setObjectName("chbPrep3")self.chbGen0 = QtWidgets.QCheckBox(self.tab)self.chbGen0.setEnabled(False)self.chbGen0.setGeometry(QtCore.QRect(200, 280, 81, 17))self.chbGen0.setObjectName("chbGen0")self.chbIgnore = QtWidgets.QCheckBox(self.tab)self.chbIgnore.setGeometry(QtCore.QRect(10, 340, 111, 17))self.chbIgnore.setObjectName("checkBox")self.tabWidget.addTab(self.tab, "")self.tab_2 = QtWidgets.QWidget()self.tab_2.setObjectName("tab_2")self.tabWidget.addTab(self.tab_2, "")self.tab_3 = QtWidgets.QWidget()self.tab_3.setObjectName("tab_3")self.verticalLayoutWidget = QtWidgets.QWidget(self.tab_3)self.tabWidget.addTab(self.tab_3, "")self.verticalLayoutWidget = QtWidgets.QWidget(self.tab_3)self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 290, 360))self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)self.verticalLayout.setContentsMargins(0, 0, 0, 0)self.verticalLayout.setObjectName("verticalLayout")self.textEdit2 = QtWidgets.QTextEdit(self.verticalLayoutWidget)self.textEdit2.setObjectName("textEdit")self.textEdit2.setReadOnly(True)self.textEdit2.append("Start")self.verticalLayout.addWidget(self.textEdit2)self.comboBox2 = QtWidgets.QComboBox(self.tab_2)self.comboBox2.setGeometry(QtCore.QRect(10, 60, 240, 23))self.comboBox2.setObjectName("comboBox2")# Read items from file 'patterns.txt'file = open('patterns.txt', 'r', encoding='utf-8')self.items = file.read().split('\n')[1:]# the file can be closed nowfile.close()# Put items into the comboboxself.comboBox2.addItems(self.items)self.comboBox2.setEditable(False)self.btnTab2_run = QtWidgets.QPushButton(self.tab_2)self.btnTab2_run.setGeometry(QtCore.QRect(250, 35, 50, 23))self.btnTab2_run.setObjectName("btnTab2_run")self.btnTab2_plus = QtWidgets.QPushButton(self.tab_2)self.btnTab2_plus.setGeometry(QtCore.QRect(250, 60, 50, 23))self.btnTab2_plus.setObjectName("btnTab2_plus")390self.btnTab2_clear = QtWidgets.QPushButton(self.tab_2)self.btnTab2_clear.setGeometry(QtCore.QRect(250, 85, 50, 23))self.btnTab2_clear.setObjectName("btnTab2_clear")self.lineTab2_input = QtWidgets.QLineEdit(self.tab_2)self.lineTab2_input.setGeometry(QtCore.QRect(10, 10, 240, 23))self.lineTab2_input.setObjectName("lineTab2_input")self.lineTab2_input.setText(self.comboBox2.itemText(0))self.lineTab2_input.selectAll()MainWindow.setCentralWidget(self.centralwidget)self.pushButton = QtWidgets.QPushButton(self.centralwidget) # SearchButtonself.pushButton.setFocusPolicy(QtCore.Qt.NoFocus)self.pushButton.setGeometry(QtCore.QRect(10, 10, 280, 23))self.pushButton.setObjectName("pushButton")self.pushButton.setEnabled(False)self.btnTab2 = QtWidgets.QPushButton(self.tab_2)self.btnTab2.setGeometry(QtCore.QRect(250, 10, 50, 23))self.btnTab2.setObjectName("btnTab2")self.comboBox = QtWidgets.QComboBox(self.centralwidget)self.comboBox.setGeometry(QtCore.QRect(10, 440, 280, 22))self.comboBox.setObjectName("comboBox")self.comboBox.addItem("...", userData=None)self.comboBox.addItem("H.Böll.