You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from FileProcess import *
from CreateCloud import *
from Judge import *
#终止系统的运行
def endcode():
while True:
check = input("继续使用请输入1 退出系统请输入0: ")
if check == '0':
return False
elif check == '1':
return True
else:
print("请输入合法数字")
if __name__ == '__main__':
print("欢迎使用词频统计与词云生成系统\n")
flag = True
while flag == True:
FileAdict = all_path("E:\PYTHON\pycharm\project")
y = input("请输入查询文件的序号:")
#对输入字符进行检查
x = checkNum(y, FileAdict)
if x == -1:
print("输入了非法的文件序号,请重新输入")
continue
print("选择的文件是:"+FileAdict[x])
# 判断文件内容是英文还是中文
if judgeNumber(FileAdict[x], FileAdict):
#检查所选择的文件是否可以查询
jd = judgeFile(FileAdict[x])
if jd:
wcloud = Copenfile(FileAdict[x])
else:
wcloud = Eopenfile(FileAdict[x])
while True:
#词云背景的选择
print("词云样式选择 0王冠 1星星 2方块")
bgi = input("请输入词云样式序号[0,1,2],以生成词云:")
if len(bgi) > 1:
print("输入非法字符,请重新输入背景图序号")
continue
if ord(bgi) - ord("0") >= 0 and ord(bgi) - ord("0") <= 2:
createcloud(wcloud, FileAdict[x], ord(bgi) - ord("0"))
break
else:
print("输入非法数字,请重新输入背景图序号")
else:
print("请重新输入有效的序号")
#对是否结束查询的输入进行判断
if endcode() == False:
print("系统即将结束运行,感谢您对该系统的使用")
break
else:
continue