Commit 4b630acb authored by rico.liu's avatar rico.liu

update category attribute

parent 5f7fb6dd
......@@ -18,6 +18,7 @@ import pickle
import os.path
import platform
import codecs
import pandas as pd
from utils.recommend import *
......@@ -83,22 +84,23 @@ class Example(Frame):
#self.initUI()
def setPressCommand(self,zgcCatCode):
if zgcCatCode == '0101':
self.pressCommand = {'1':"Artifical",
'2':"Event",
'3':"Fin-Concept",
'4':"Location",
'5':"Organization",
'6':"Person",
'7':"Sector",
'8':"Other",
'9':'liuxiaoqi'
}
zgcCatCode = '0101'
relationDf = pd.read_excel('VW_Relation_Property.xlsx',converters={'SubCategoryCode':str})
relationFilter = relationDf[(relationDf['SubCategoryCode'] == zgcCatCode) & ((relationDf['ISimportant'] == 1) | relationDf['ispeijian'] == 1)][['SubTitle']].reset_index()
del relationFilter['index']
if relationFilter.empty:
self.pressCommand = {'1':"error"}
else:
relationDict =dict([(str(k),v) for k,v in zip(relationFilter.to_dict()['SubTitle'].keys(),relationFilter.to_dict()['SubTitle'].values())])
self.pressCommand = relationDict
if len(self.pressCommand) > 20:
self.textRow = len(self.pressCommand)
else:
self.textRow = 20
def run_initUI(self):
self.initUI()
......@@ -869,11 +871,33 @@ def decompositCommand(command_string):
def main():
print(u"启动 YEDDA 标注工具!")
print((u"操作系统:%s")%(platform.system()))
box = Tk()
box.title("请输入要标注的指数类别编码")
box.geometry('300x300')
l1 = Label(box, text="指数类别:")
l1.pack()
cat_text = StringVar()
cat = Entry(box, textvariable = cat_text)
cat_text.set(" ")
cat.pack()
def on_click():
x = cat_text.get()
string = str("指数类别:%s" %(x))
print("指数类别:%s" %(x))
messagebox.showinfo(title='Success', message = string)
Button(box, text="确认", command = on_click).pack()
box.mainloop()
catCode = str(cat_text.get()).strip()
root = Tk()
root.geometry("1300x700+200+200")
app = Example(root)
app.setFont(17)
app.setPressCommand('0101')
app.setPressCommand(catCode)
app.run_initUI()
root.mainloop()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment