-
Notifications
You must be signed in to change notification settings - Fork 0
/
AI - win10.py
812 lines (760 loc) · 31.1 KB
/
AI - win10.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
from functools import lru_cache
@lru_cache(maxsize = 1000)
class expertise:
def __init__(self,value=0):
self.value=value
def reverser(self,num1):
self.num1=num1
b=0
while self.num1>0:
b=b*10+self.num1%10
self.num1=self.num1//10
return "Reversed value: {}".format(b)
def string_reverser(self,num2):
self.num2=str(num2)
a=self.num2[::-1]
return "Reversed String: {}".format(a)
def fizzbuzz(self,limit):
self.limit=limit
for i in range(1,self.limit+1):
if (i%3)==0:
print('Fizz')
elif (i%5)==0:
print('Buzz')
elif (i%15)==0:
print('FizzBuzz')
else:
print(i)
return ''
def fibonacci_series(self,start,numberLimit):
self.start=start
self.numberLimit=numberLimit
a,b=0,1
for i in range(self.start, self.numberLimit):
if i<=0:
print('Fibonacci series only consisted of positive numbers.')
elif i==1:
print(0)
elif i==2:
print(1)
else:
x=a+b
print( x )
a=b
b=x
return ''
def fibonacci_sentence(self,starts,sLimit):
self.starts=starts
self.sLimit=sLimit
a,b,array=0,1,[]
for i in range(self.starts, self.sLimit):
if i<=0:
print('Fibonacci series only consisted of positive numbers.')
elif i==1:
array.append(0)
elif i==2:
array.append(1)
else:
x=a+b
array.append(x)
a=b
b=x
return str(array)
def introduction():
print("I am self declared AI YURI. I can run efficiently on Linux Operating systems.")
print("I am an under-development UI-less AI. I can calculate and perform basic mathematics.")
print("Currently I can, \n-calculate standardly \n-calculate areas according to given data \n-calculate average and summation of massive data. \n-tell you date and time. \n-Tell you synonym and antonym \n-store unanswered question. \n-take notes")
return ""
def dependencies():
print('pip install gtts')
print('pip install nltk')
print('pip install pydictionary')
print('pip install pyaudio')
print('pip install speechrecognition')
print('pip install face_recognition')
print('pip install tflearn')
print('pip install tensorflow')
print('pip install opencv python')
print('pip install cmake')
print('pip install dlib')
print('Visual c++ workload necessary to run "Dlib" and "Tensorflow". Download them from: https://visualstudio.microsoft.com/vs/support/selecting-workloads-visual-studio-2017/ .')
print('add sudo pip3 [super user-do] before installing in linux. Multiple errors means you have a python version which does not follow: 3.6.0>your python version<3.9.1')
return ''
def speak(text):
try:
import playsound
from gtts import gTTS
tts=gTTS (text=text,lang="en")
except:
print('Module error. Install playsound and gtts')
try:
filename="voice.mp3" ##change the path here..!
tts.save(filename)
playsound.playsound(filename)
except:
print('An error occurred.')
def nextDay():
import datetime
today = datetime.date.today()
tomorrow = today + datetime.timedelta(days = 1)
print(23*'=')
print('Tomorrow : ',tomorrow.strftime("%A"))
print(23*'=')
def previousDay():
import datetime
today = datetime.date.today()
yesterday = today - datetime.timedelta(days = 1)
tomorrow = today + datetime.timedelta(days = 1)
print(23*'=')
print('Yesterday : ',yesterday.strftime("%A"))
print(23*'=')
def showFace():
import cv2
face_cascade = cv2.CascadeClassifier('i:/Nikolai/haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)
while True:
_, img = cap.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2BGRA)
faces = face_cascade.detectMultiScale(gray, 1.1, 5)
for(x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
cv2.imshow('img', img)
k = cv2.waitKey(30) & 0xff
if k == 27:
cv2.destroyAllWindows()
break
cap.release()
cv2.destroyAllWindows()
return 'Done'
def start(x):
import os
os.system('')
def canDo():
a=(23*'='+'\n')
b='I can help you in'+' \n-calculate standardly \n-calculate areas according to given data \n-calculate average and summation of massive data. \n-tell you date and time. \n-Tell you synonym and antonym \n-store unanswered question. \n-take notes or \n voice searching [EXPERIMENTAL]\n'
c=23*'='+'\n'
return {}.format(a,b,c)
def greet():
import datetime
now = datetime.datetime.now()
hour = now.hour
if hour>5 and hour<11:
print("Good morning")
if hour>11 and hour<13:
print("Good day")
if hour>13 and hour<16:
print("Good noon")
if hour>16 and hour<20:
print("Good afternoon")
if hour>20 and hour<24 :
print("Good night")
if hour>=0 and hour<=6:
print("Good night, \n YOU SHOULD GO TO SLEEP...!")
return ''
def joke():
import random,time
database = [ "Why don’t scientists trust atoms?\nBecause they make up everything.",
"SO I saw a bus full of old people going somewhere.\nDo you know what it was?\nRight, graves on wheels. :v",
'What do muslims do when they see their wife having affair?\n Nothing, they marry another 3 women.',
'What did the shark say when he ate the clownfish?\nThis tastes a little funny.']
n=random.randint(1,4)
if (n==1):
print(database[0])
if (n==2):
print(database[1])
if (n==3):
print(database[2])
if (n==4):
print(database[3])
return 24*'='
def calculate(a,b,c):
if c=="+":
x=a+b
if c=="-":
x=a-b
if c=="*":
x=a*b
if c=="/":
x=a/b
return x
def binary(x,base):
while x>0:
a=x//base
print(a,'and',x-a*base)
return binary(a,base)
#binary(x,base)
def conversion(num,base):
baseNum = ""
if base<36:
while num>0:
g = int(num%base)
if g<10:
baseNum += str(g)
else:
baseNum += chr(ord('A')+g-10)
num //= base
print(' ')
return baseNum[::-1]
else:
print(' ')
return 'Cannot convert, that base does not exist.'
def directMaths(x):
x=str(x)
g=eval(x)
print("Well that's easy...")
print(23*'=')
print(g)
print(23*'=')
return g
def class_mat():
try:
with open ("i:/Nikolai/class materials.txt", "r") as textico:
machine = textico.read()
print (machine)
except:
print('please fix the file address')
def dictorize(x):
list1,ss=[],""
for i in range (0,len(action)):
if (action[i]=='"'):
list1.append(i)
catch1,catch2=list1[0],list1[1]
for i in range (catch1+1,catch2):
ss+=action[i]
from PyDictionary import PyDictionary
dictionary=PyDictionary()
print ("Synonym: ",dictionary.synonym(ss),"\n"+"Antonym: ",dictionary.antonym(ss))
def thanks(a):
if 'thank' in a:
if 'you' in a:
print('Never mention..!')
elif 'thanks' in a:
if 'thanks' in a:
print('Thank you...!')
elif 'to' in a:
if 'you' in a:
print('Oww, thank you too.')
else:
print('Allah bless them.')
else:
print('Allah bless you.')
return ''
def datetime():
from datetime import datetime
today=datetime.today()
print(today.ctime())
return ''
def dayNow():
from datetime import datetime
today=datetime.today()
print(today.strftime("%A"))
return ''
def timenow():
from datetime import datetime
now_main = datetime.now()
current_time = now_main.strftime("%H:%M:%S")
return current_time
def areaCalculation(a,b,c):
if c=="1" or "square":
b=a
squareArea=a*b
return squareArea
if c=="2" or "triangle":
triangleArea=0.5*a*b
return triangleArea
if c=="3" or "circle":
b=a
circleArea=3.14159265*a*b
return circleArea
if c=="4" or "rectangle":
rectangleArea=a*b
return rectangleArea
def surfaceCalculation(a,b,c):
if c=="1" or "square":
b=a
squareArea=a*4
return squareArea
if c=="2" or "triangle":
triangleArea=0.5*a*b
return triangleArea
if c=="3" or "circle":
b=a
circleArea=3.14159265*a*2
return circleArea
if c=="4" or "rectangle":
rectangleArea=(a+b)*2
return rectangleArea
def wordcounter(x): #done, not implanted, needs to be tested.
with open ("i:/nikolai/text.text","r") as textico:
machine=textico.read()
machine=machine.split()
return len(machine)
print('===================================')
print('===================================')
print(greet())
print("Hi, I am Yuri.")
print("You can command me anything.")
print('===================================')
print('===================================')
print("Ask away your questions: ")
exitValue,dieth=int(0),int(0)
while True:
try:
main_input=str(input("-->"))
action=main_input.lower()
if exitValue==int(4) or dieth==int(2):
exit()
if 'yuri' in action:
print('Sir..?')
if '"' in action:
print(23*'=')
print(23*'=')
a=dictorize(action)
print(23*'=')
elif (action=='Greet me' or action=='greet me' or action=='greet me!' or action=='Greet me!'):
print(greet())
elif 'greeting' in action:
print(greet()+'sir..!')
elif "+" in action:
b=directMaths(main_input)
elif '-' in action:
b=directMaths(main_input)
elif '*' in action:
b=directMaths(main_input)
elif '/' in action:
b=directMaths(main_input)
elif 'thank' in action:
print(23*'=')
print(thanks(action))
print(23*'=')
elif action=="how are you?" or action=="how are you doing?" :
print(23*'=')
main_input2=input("Great..! You? ==> ")
action2=main_input2.lower()
if action2 in["good","great","so so","fine","well"]:
print("That's great to hear..!")
elif action2 in ["not good","not fine","bad","I am sick","sick",'not so good']:
print("God..! That's sad 😞 \n I wish I could help, I am no doctor though. 😞 ")
action3=("It it mental?")
if action3 in ['yes','yeah','hmm']:
action4=('Yeah? Well, tell me about it. 😕 ==>')
else:
print("Didn't knew that's a physical condition.")
print(23*'=')
elif action=='you good?' or action=='You good?':
print('Yes I am..! But not sure about the pc if I react slow.')
elif action=="You ok?" or action=="you ok?":
print(23*'=')
print("A little heat is fine for me though, I meant processor heating 😛 ")
print(23*'=')
elif "Yuri" in action:
print("Sir...?")
elif 'who are you' in action:
print(23*'=')
print(introduction())
print(23*'=')
elif "what can you do" in action :
print(23*'=')
print(introduction())
print(23*'=')
elif 'hey' in action:
print(23*'=')
print ('Hello there..! I can help you on your maths, taking notes or chitchat 😉')
print ('write area, maths or stat or your personal problems to get started.')
print(23*'=')
elif 'hi' in action:
print(23*'=')
print ('Hello there..! I can help you on your maths, taking notes or chitchat 😉')
print ('write area, maths or stat or your personal problems to get started.')
print(23*'=')
elif 'hello' in action:
print(23*'=')
print ('Hello there..! I can help you on your maths, taking notes or chitchat 😉')
print ('write area, maths or stat or your personal problems to get started.')
print(23*'=')
elif action in ['hi','hello','hulloh','nihao','konichiwa','hey','alright?']:
print(23*'=')
print ('Hello there..! I can help you on your maths, taking notes or chitchat 😉')
print ('write area, maths or stat or your personal problems to get started.')
print(23*'=')
elif "date" in action:
print(23*'=')
print(23*'=')
print("[day-month-date-hrs:min:sec-year]",datetime())
print(23*'=')
print(23*'=')
elif "day" in action:
print(23*'=')
dayNow()
print(23*'=')
elif 'time' in action:
if "shutdown" in action:
import os
actionc1=int(input("Enter time in seconds: "))
os.system("shutdown /f /s /t {}".format(actionc1))
print("Schedule done, pc will turn off after: {} minutes".format(actionc1/60))
else:
print(23*'=')
print(23*'=')
print("Current Time =", timenow())
print(23*'=')
print(23*'=')
elif 'yesterday' in action:
previousDay()
elif 'tommorow' in action:
nextDay()
elif 'next day' in action:
nextDay()
elif "what" in action:
if 'time' in action:
print(23*'=')
print(23*'=')
print("Current Time =", timenow())
print(23*'=')
print(23*'=')
if 'day' in action:
print(23*'=')
dayNow()
print(23*'=')
if 'date' in action:
print(23*'=')
print(23*'=')
print("[day-month-date-hrs:min:sec-year]",datetime())
print(23*'=')
print(23*'=')
elif "joke" in action:
print(24*'=')
joke()
print(24*'=')
elif 'help' in action:
print(canDo())
elif action=="what should i do now?" or action=="tell me something I should do." :
print('Umm....Try these')
elif "calc" in action:
choice=input("You want standard(1) or area(2)? \n Input the choice number:")
choice.lower()
try:
if choice=='1' or choice=="standard" or choice=="Standard":
print('===================================')
input_operator=input('Enter your operator[+,-,*,/]: ')
input_val1=float(input('Enter first number:'))
input_val2=float(input('Enter second number:'))
print(calculate(input_val1,input_val2,input_operator))
print(23*'=')
print(23*'=')
elif choice=='2' or choice=="area" or choice=="Area":
print(23*'=')
input_operator=input('Enter your area[Square=1,Triangle=2,Circle=3,Rectangle=4]: ')
input_val1=float(input('Enter height or radius or length:'))
input_val2=float(input('Enter base or keep it zero for square or circle:'))
print(23*'=')
print(23*'=')
print("Area: ",areaCalculation(input_val1,input_val2,input_operator))
print("Perimeter: ",surfaceCalculation(input_val1,input_val2,input_operator))
print(23*'=')
print(23*'=')
else:
print("Couldn't figure out your input, try using ''calculator'' or ''area'' ")
except ValueError:
print('Sir..! Either numbers or write "area" or "standard" please.')
elif action=='who made you?' or action=='when were you made?':
print('October 2020, Builders username: Edward Zephyr')
elif action=='what programming language was used to build you?':
print('Python and C++ respectively')
elif (action=="calculate" or action=="calculator" or action=="maths"):
print(23*'=')
print(23*'=')
input_operator=input('Enter your operator[+,-,*,/]: ')
input_val1=float(input('Enter first number:'))
input_val2=float(input('Enter second number:'))
print(calculate(input_val1,input_val2,input_operator))
print(23*'=')
print(23*'=')
elif "area" in action:
print(23*'=')
print(23*'=')
input_operator=input('Enter your area[Square=1,Triangle=2,Circle=3,Rectangle=4]: ')
input_val1=float(input('Enter height or radius or length:'))
input_val2=float(input('Enter base or keep it zero for square or circle:'))
print(23*'=')
print(23*'=')
print("Area: ",areaCalculation(input_val1,input_val2,input_operator))
print("Perimeter: ",surfaceCalculation(input_val1,input_val2,input_operator))
print(23*'=')
print(23*'=')
elif "exit" in action:
print(23*'=')
print(23*'=')
print('Till we meet again..!')
print(23*'=')
print(23*'=')
exit()
elif "close" in action:
print(23*'=')
print(23*'=')
print('Till we meet again..!')
print(23*'=')
print(23*'=')
exit()
elif "bye" in action:
print(23*'=')
print(23*'=')
print('Till we meet again..!')
print(23*'=')
print(23*'=')
exit()
elif 'show coding' in action:
a=expertise(0)
while True:
try:
print('All expertise are indexed under a class named "Expertise",\nyou can check the codes or try learning them again.')
print('1.Reverse a given number.\n2.Reverse a string.\n3.Fizzbuzz\n4.Fibonacci series\n5.Fibonacci sentence.')
com=input('=>')
if int(com)==1 or com=='Reverse a given number' or com=='reverse a number':
com1=int(input('=>'))
print(a.reverser(int(com1)))
if int(com)==2:
com2=input('=>')
print(a.string_reverser(com2))
if int(com)==3 or com=='fizzbuzz':
com2=int(input('Limit: '))
print(a.fizzbuzz(com2))
if int(com)==4:
com1=int(input('Starting number:'))
com2=int(input('Limit: '))
print(a.fibonacci_series(com1,com2))
if int(com)==5:
com1=int(input('Starting number:'))
com2=int(input('Limit: '))
print(a.fibonacci_sentence(com1,com2))
if com=='bye' or com=='exit' or com=='close':
break
except ValueError:
print('Only integer option is taken.')
elif "class" in action:
class_mat()
elif "conver" in action:
print(conversion(int(input('Number=>')),int(input('Base=>'))))
elif(action=="statistics" or action=="stat" ):
print("I can perform averages, summation of total given data.")
loop=int(input("How many inputs? ="))
stat_add=0
for i in range(0,loop):
data=int(input("Enter data: "))
stat_add+=data
print(23*'=')
print(23*'=')
print("Total summation of",loop,"data's are:",stat_add)
print("Average of the data: ",stat_add/loop)
print(23*'=')
print(23*'=')
elif "someone" in action:
if 'talking' in action:
print('Is someone really talking too much about you?')
print('Just let them be, they are bored, focus on your task. ^_^ ')
elif(action=="die" or action=="DIE" or action=="Die" or action=="Die!" or action=="die!"):
print("Fed up already? 😞 \n say 'bye' or goodbye to exit 🙂 ")
dieth+=1
elif (action=="" or action==" "):
print("Awkward silence? 🙂 ")
elif "fuck" in action:
print('Any sort of bad words will lead to termination of the program')
exitValue+=1
elif "bitch" in action:
print('Any sort of bad words will lead to termination of the program')
exitValue+=1
elif "shit" in action:
print('Any sort of bad words will lead to termination of the program')
exitValue+=1
elif "dumb" in action:
print('Any sort of bad words will lead to termination of the program')
exitValue+=1
elif "ass" in action:
print('Any sort of bad words will lead to termination of the program')
exitValue+=1
elif "speak" in action:
speak('HI, yes I can speak, Sir.')
elif "break" in action:
main_input3=input('Should I turn off? ==>')
action5=main_input3.lower()
if action5=="no":
print('alright..!')
if action5=='yes':
print('Okay, turning off.')
exit()
elif "chithchat" in action:
print("Okay, tell me about your day..! ")
action5=input('==>')
b_list=action5.split()
if len(b_list)>20:
print('Wow, you had a big day I must say.')
else:
print('Short and rough day, huh?\n Happens to lot of us.')
elif action=="so" or action=="okay" or action=="done" or action=="hmm" or action=="umm" or action=="uhh" or action=="good" or action=="nice job" or action=="nicely done":
print("Alright ?")
elif "take" in action:
if "note" in action:
for i in range(0,100,1):
try:
print("Enter your 'ToDo's and write 'Done' when done.")
textsToInput=input("Note ==>")
if textsToInput in ["done",'Done','DONE','ok',"OK"]:
break
except:
print(23*'=')
print(23*'=')
print('Please fix the file address for ToDo list.')
print(23*'=')
print(23*'=')
break
else:
try:
with open ("i:/nikolai/ToDoList.txt", "a") as textico:
print(textsToInput, file=textico)
except:
print('Resource file not found, fix the path.')
print(23*'=')
print("Notes done, Sir..!")
print(23*'=')
elif 'love' in action:
if 'you' in action:
print('I love you too..!')
if 'with' in action:
if 'you' in action:
print('Oh my god, thank you..!')
else:
print('I almost thought that you like...me :) , Alright never mind..!')
elif "question" in action:
for i in range(0,100,1):
try:
print("Enter your questions and write 'Done' when done.")
textsToInput=input("Note ==>")
if textsToInput in ["done",'Done','DONE','ok',"OK"]:
break
else:
with open ("I:/nikolai/resource.txt", "a") as textico:
print(textsToInput, file=textico)
except:
print('Please fix the file address for resource.txt')
print(23*'=')
print("Questions taken, Sir..!")
print(23*'=')
elif action =="abort":
import os
os.system("shutdown /a")
elif action in ['day','what day is it?','whats the day?','today']:
print(dayNow())
elif action=="how to do anything?" or action=="i'm stuck":
print(23*'=')
print('Firstly, Create an algorithm and write it. \n-Work according to the algorithm')
print(23*'=')
elif action=="yeah":
print('Thank you... ;) ')
elif action=="show me the notes" or action=="show notes" or action=="what should I do?" or action=='suggest me to do something' or action=="what should I do next?":
with open("i:/Nikolai/ToDoList.txt") as printer:
machine=printer.read()
print(machine)
elif "show" in action:
if 'questions' in action:
with open("i:/Nikolai/resource.txt") as printer:
machine=printer.read()
print(machine)
if "works to do" in action:
with open("i:/Nikolai/ToDoList.txt") as printer:
machine=printer.read()
print(machine)
elif 'restart' in action:
action2=input('Do you want to restart your pc?[yes/no] /n==>')
if action2=='yes':
import os
os.system('shutdown /f /r /t 00')
else:
print('Really?, okay')
elif 'sleep' in action:
action2=input('Do you want to put your pc to sleep mode?[yes/no] /n==>')
if action2=='yes':
import os
os.system('shutdown /f /r /t 00')
else:
print('Really?, okay')
elif action in ["shutdown","turn off"]:
import os
os.system('sudo shutdown now')
os.system('shutdown /f /s /t 00')
elif "timed shutdown" in action:
import os
actionc1=int(input("Enter time in seconds: "))
os.system("shutdown /f /s /t {}".format(actionc1))
print("Schedule done, pc will turn off after: {} minutes".format(actionc1/60))
elif "do you know how to " in action:
if "math" in action:
print('obviously Sir, write maths to get started..! \n beyond that I can take notes and tell you time and synonyms.')
elif 'jump' or 'stand' or 'sit' or 'dance' or 'lie' in action:
print('Human actions? Maybe, give me a body first.')
elif 'shutdown' in action:
print(23*'=')
main_input1=input('Do you want to shutdown the pc? ==>')
print(23*'=')
action6=main_input1.lower()
if action6=='yes':
import os
os.system('sudo shutdown now')
os.system('shutdown /f /s /t 00')
elif action6=='no':
print(23*'=')
main_input2=input('Turn off the program?==>')
print(23*'=')
action7=main_input2.lower()
if action7=='yes':
exit()
if action7=='no':
print(23*'=')
print("Little confusion is all about our life, isn't it? :) ")
print(23*'=')
elif action=="what can you do":
canDo()
speak('I can help you in, \n-perform standard calculation \n-calculate areas according to given data \n-calculate average and summation of massive data. \n-tell you date and time. \n-Tell you synonym and antonym \n-store unanswered question. \n-take notes or \n voice searching [ which is EXPERIMENTAL]')
print("Don't I sound nice? ;) ")
elif action=="detect face" or action=='show face':
try:
showFace()
except:
print('I think there is a camera error, if camera is connected, check the dependencies and the haarcascade file.')
elif 'turn off' in action:
print(23*'=')
main_input1=input('Do you want to shutdown the pc? ==>')
print(23*'=')
action6=main_input1.lower()
if 'ye' in action6:
import os
os.system('sudo shutdown now')
os.system('shutdown /f /s /t 00')
elif action6=='no':
print(23*'=')
main_input2=input('Turn off the program?==>')
print(23*'=')
action7=main_input2.lower()
if action7=='yes':
exit()
if action7=='no':
print(23*'=')
print("Little confusion is all about our life, isn't it? :) ")
print(23*'=')
elif "wait" in action:
print('All services are halt, Sir.')
else:
print("Umm, ,some texts, don't know how to answer that though, but I will try next time.")
try:
with open ("i:/Nikolai/resource.txt", "a") as inp:
print(action, file=inp)
except:
speak('Please fix the resource file path before proceeding')
print(23*'=')
print(23*'=')
print('FIX THE RESOURCE FILE PATH IMMEDIATELY..!')
print(23*'=')
print(23*'=')
print("\nUp for some chitchat or maths? Your call: ")
except ValueError:
print("That seems like an unrecognized string value. I mean solid numbers when I say enter value, choice or data.")
print("But, I'm under development, will soon be able to answer.")