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

update category attribute

parent 5f7fb6dd
...@@ -18,6 +18,7 @@ import pickle ...@@ -18,6 +18,7 @@ import pickle
import os.path import os.path
import platform import platform
import codecs import codecs
import pandas as pd
from utils.recommend import * from utils.recommend import *
...@@ -83,21 +84,22 @@ class Example(Frame): ...@@ -83,21 +84,22 @@ class Example(Frame):
#self.initUI() #self.initUI()
def setPressCommand(self,zgcCatCode): def setPressCommand(self,zgcCatCode):
if zgcCatCode == '0101': zgcCatCode = '0101'
self.pressCommand = {'1':"Artifical", relationDf = pd.read_excel('VW_Relation_Property.xlsx',converters={'SubCategoryCode':str})
'2':"Event", relationFilter = relationDf[(relationDf['SubCategoryCode'] == zgcCatCode) & ((relationDf['ISimportant'] == 1) | relationDf['ispeijian'] == 1)][['SubTitle']].reset_index()
'3':"Fin-Concept", del relationFilter['index']
'4':"Location",
'5':"Organization", if relationFilter.empty:
'6':"Person", self.pressCommand = {'1':"error"}
'7':"Sector", else:
'8':"Other", relationDict =dict([(str(k),v) for k,v in zip(relationFilter.to_dict()['SubTitle'].keys(),relationFilter.to_dict()['SubTitle'].values())])
'9':'liuxiaoqi' self.pressCommand = relationDict
}
if len(self.pressCommand) > 20: if len(self.pressCommand) > 20:
self.textRow = len(self.pressCommand) self.textRow = len(self.pressCommand)
else: else:
self.textRow = 20 self.textRow = 20
def run_initUI(self): def run_initUI(self):
self.initUI() self.initUI()
...@@ -869,11 +871,33 @@ def decompositCommand(command_string): ...@@ -869,11 +871,33 @@ def decompositCommand(command_string):
def main(): def main():
print(u"启动 YEDDA 标注工具!") print(u"启动 YEDDA 标注工具!")
print((u"操作系统:%s")%(platform.system())) 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 = Tk()
root.geometry("1300x700+200+200") root.geometry("1300x700+200+200")
app = Example(root) app = Example(root)
app.setFont(17) app.setFont(17)
app.setPressCommand('0101') app.setPressCommand(catCode)
app.run_initUI() app.run_initUI()
root.mainloop() 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