Skip to content
Permalink
Browse files
Comments added
  • Loading branch information
plurab committed Dec 1, 2018
1 parent 8e02481 commit cf5dd806f065a73b43c0bd51da1f84ffc7040591
Showing 1 changed file with 14 additions and 14 deletions.
@@ -1,4 +1,4 @@
from what import sentence_what
from what import sentence_what #1-22 Bartosz
from why import sentence_why
from weather import weather_ask
from Setup import setup_time
@@ -21,18 +21,18 @@ from translation import translate
from send_email import *
from time import calendar_reminder

import subprocess #Necessary to execute a program from the computer
import subprocess #Necessary to execute a program from the computer #24-25 Andre
import os #provides a portable way of using operating system functionalities

global name
global name #27-28 Artur
global city

'''This function searches, if the input calls any function or printings '''
'''This function searches, if the input calls any function or printings ''' #30-34 Bartosz
def check(sentence): #putting the appropriate input, calls the particular function from other files.
try:
if "why" in sentence:
sentence_why(sentence)
elif "weather in" in sentence or "weather for" in sentence or "weather today" in sentence:
elif "weather in" in sentence or "weather for" in sentence or "weather today" in sentence: #35-43 Artur
if "weather today" not in sentence: # Taking the value of city (which user gave on the beginning) and using it into a weather_ask function. In practice showing the weather for the current location.
temporary, Lcity = sentence.split('weather')
Lcity = Lcity.replace('in ', '')
@@ -41,21 +41,21 @@ def check(sentence): #putting the appropriate input, calls the particular funct
else: # Taking the particular city name which user will pass through the program and give the weather information about that place.
sentence = city
weather_ask(sentence)
elif "exit" in sentence or 'bye' in sentence:
elif "exit" in sentence or 'bye' in sentence: #44-112 Bartosz
global running
running = False
running = False
elif "plus" in sentence or "minus" in sentence or "times" in sentence or "less" in sentence or "+" in sentence or "divided" in sentence or "*" in sentence or "/" in sentence or "-" in sentence:
entre(sentence)
elif "facebook" in sentence:
facebook(sentence)
elif "next" in sentence:
elif "next" in sentence:
play("random")
elif "open" in sentence:
uGoogle(sentence)
elif "calendar" in sentence or "reminder" in sentence:
calendar_reminder(sentence)
elif "music" in sentence:
play(sentence)
play(sentence)
elif "run" in sentence: #Runs a subprocess like cmd, notepad and opening control panel
sentence = sentence.replace("run ", "")
os.system(sentence)
@@ -87,7 +87,7 @@ def check(sentence): #putting the appropriate input, calls the particular funct
elif "translate" in sentence:
translate(sentence)
elif "funny" in sentence or "interesting" in sentence:
print("")
print("NO.")
elif 'fine' in sentence:
print("Nice to hear that :)")
elif "!help" in sentence:
@@ -109,21 +109,21 @@ def check(sentence): #putting the appropriate input, calls the particular funct
except:
print("Operation not available..")


#113-119 Artur
reset() # Calling the function which deletes text file (data inside) after the program will end, so that a new data (name and city) can be created and stored next time while main code run.
running = True
setup_time() # Calling the function which checks if text file with data been created, if not create it and store the username and location (city).
name = load_setting(
0) # Taking a variable name from stored data and use it while the program is running by calling the user.
city = load_setting(
1) # Taking a variable city from stored data and use it while a user is asking for the weather for a particular location.
while running: #Chatbot conducts conversation by a loop
while running: #Chatbot conducts conversation by a loop #120-122 Bartosz
query = input("")
query = query.lower()
query = query.lower() #123-126 Artur
if "!setup" in query: # String "!setup" calling the function "reset" in the first place. All data since then been removed, therefore calling a load_setting function to could ask for and store new data (name and city).
check(query)
name = load_setting(0)
city = load_setting(1)
else:
else: #Bartosz
check(query)

0 comments on commit cf5dd80

Please sign in to comment.