Package: wzk
This is wzk's personal python library~How to install?simply runpip install wzk. That's it!
(make sure your python version >= 3.7)What can you do?Entertainmentplay gamesEach with an interesting console gameimportwzkwzk.flight_game()wzk.game2048()wzk.mine_sweep()wzk.texas_poker()wzk.pokemon()wzk.mahjong()鬼畜What happens if you translate one sentence 20 times with Baidu translation?importwzkwzk.funny_translate("二臣贼子，你枉活七十有六，一生未立寸功，只会摇唇鼓舌，助曹为虐！")Academiclook up english words in dictionaryOff-line Chinese-English dictionary with more than 100k words;Translate with baidu or off-line dictionaryimportwzkwzk.lookup("good",verbose=True,non_alpha=False)#translate with baiduwzk.translate("I love you")#translate with dictionarywzk.direct_translate("I love you")check your OO homeworkGenerate data, judge your results, and beatmatch with peersNote: made in 2020, may not be applicable in later yearsfromwzk.oo2020import*check_files(["test1.txt","test2.txt","test3.txt"])print(hw3_generator(10))print(hw7_generator(10,3,10))print(hw11_generator(10,5))print(hw13_generator())print(derivative_judge("3*x**2","x**3"))print(hw5_judge(open("out.txt").read(),open("data.txt").read()))NLP metricCalculate BLEU scorefromwzk.nlpimportbleuprint(bleu("they are good","they are not good",k=2))Useful ToolsLuna: simple version control system"luna" can mean anything, depending on your mood.the goddess of the moon in Roman mythology: isn't it great?"light unix-like navigating assistant": you're in a good mood, and it actually
works for you. Angels sing, and a light suddenly fills the room."loony unsteady nerd as**ole": when it breaksLuna Lovegood inHP: correct!(1) installationmethod 1: python  --recommendedimportwzk.lunawzk.luna.install()method 2: shell#change PATH to the absolute path of wzk/luna.py#change .bashrc if using another shell. e.g. ~/.zshrcecho"alias luna='python PATH/luna.py' ">>~/.bashrcsource~/.bashrc#for single trial, "alias luna='python PATH/luna.py'" is enough(2) Use in shell (command line)  --recommendedNote: support Linux and Mac OS   (try git bash if using Windows)mkdirtestcdtestlunainit
touch666.txt
lunacommit"first commit"touchhahahaecho"hello world">>666.txt
lunadiff
lunacommit"second commit"lunalog
lunadiff12lunadiff1666.txt
lunareset1lunareset2lunahistorylunadelete1lunainfo
lunadiscard(3) Use in pythonfromwzk.lunaimport*p="~/Desktop/"init(p)makefile(p,"1")commit(p,"commit 1")makefile(p,"2")commit(p,"commit 2")revise(p,2,"commit 3 new message")reset(p,1)reset(p,2)history(p)send emailSend email with SMTPimportwzkmail_host=...mail_user=...mail_pass=...sender=wzk.parser.MailSender(mail_host,mail_user,mail_pass)sender.send_mail(title="hi~",content="nothing~",receiver=None)check web page updateAutomatically check web page and send notification email upon updateimportwzkmail_host=...mail_user=...mail_pass=...checker=wzk.parser.WebPageUpdateChecker(mail_host,mail_user,mail_pass,cookies=None)checker.check("www.baidu.com",interval=10)check system informationsee information on your system and pythonfromwzk.osimport*show_os_all_info()show_python_all_info()For Developersimproved data structureDictionary supporting inverse-mapping and attribute-indexingNumber type supporting setting bound and loopfromwzkimportDD,Na=DD({"good":"kk"})a.bad="nyima"print(a.good)print(a["bad"])print(a.inv())print(a.inv().inv())b=N(4,upper_bound=8,lower_bound=3)b+=5c=N(4,upper_bound=8,lower_bound=3,loop=True)print(c+5)interestring utensilsSeveral interesing utensilsimporttimefromwzkimportErrorFucker,Separate,ClockwithErrorFucker(raises=False)asef1:d1=int("f")withSeparate("separate zone",count=True)ass:print("ohhh")withs:withClock("test")asc:time.sleep(2)print(c)withErrorFucker(raises=True)asef2:d2=int("d")simplified pytorch(?)Scalar autograd mechanismfromwzk.autograd.thingimport*a=thing(2)b=thing(3)c=a+leaky_relu(b)d=thing(5)e=tanh(d)f=relu(e)g=log(f)g.backward()print(a,b,c,d,e,f,g)