Skip to content

Commit

Permalink
Third commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ShreyasDobhal committed Mar 30, 2019
0 parents commit 21e2e14
Show file tree
Hide file tree
Showing 36 changed files with 1,415 additions and 0 deletions.
Binary file added Android/Android - problem-statements (copy).pdf
Binary file not shown.
Binary file added Android/Android - problem-statements.pdf
Binary file not shown.
Binary file added MyDocs/aadhar card.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MyDocs/id card.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions MyDocs/myDocsList.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pan card - CDQPD7909C
aadhar card - 6735 7784 4682
id card - 20165077
Binary file added MyDocs/pan card.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Simple-Sentiment-Analysis-Using-NB
Submodule Simple-Sentiment-Analysis-Using-NB added at 6d4dad
Binary file added __pycache__/chatbot.cpython-36.pyc
Binary file not shown.
Binary file added __pycache__/paths.cpython-36.pyc
Binary file not shown.
Binary file added __pycache__/reminder.cpython-36.pyc
Binary file not shown.
Binary file added __pycache__/utility.cpython-36.pyc
Binary file not shown.
16 changes: 16 additions & 0 deletions botFAQ.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
What is your name? ,"You can call me Shreyas for now"
How old are you? ,"Not sure I haven't been documented well"
When were you born? ,"Not sure I haven't been documented well"
When is your birthday? ,"Not sure I haven't been documented well"
Who is your boss?, "Team Ganador"
Who made you?, "Team Ganador"
Who is your creator?, "Team Ganador"
Are you a chatbot?, "Hmm I am not just a chatbot but an assistant as well"
Where are you? , "No won't tell you"
Are you home? , "No"
You know Shreyas Dobhal , "Yeah Shreyas is my creator"
You are an idiot , "Look who's talking"
Miss me , "Already missing you"
bro , "Yeah"
Happy Birthday , "I don't think its today"
Hey there, "I am using whatsap? xD"
15 changes: 15 additions & 0 deletions chatbot.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<html>
<head>
<title>
ChatBot
</title>
</head>
<body>
<iframe
allow="microphone;"
width="350"
height="440"
src="https://console.dialogflow.com/api-client/demo/embedded/2eca99fa-78d2-4822-92b3-59dcd0045fe2">
</iframe>
</body>
</html>
45 changes: 45 additions & 0 deletions chatbot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
from time import sleep
import paths

USER = paths.USER


DRIVER_PATH = '/home/'+USER+'/Downloads/chromedriver'
URL = 'file:///home/'+USER+'/Desktop/HINT4/chatbot.html'
COMMAND_STOP = 'stop'
driver = webdriver.Chrome(DRIVER_PATH)
driver.get(URL)

wait = WebDriverWait(driver, 600)

driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))

txtBox = driver.find_element_by_xpath('//*[@id="query"]')

def getResponse(message):
waitPlaceHolder = '...'
msgXPath = '//*[@id="result"]'
txtBox.send_keys(message+"\n")
num = len(driver.find_element_by_xpath(msgXPath).text.split('\n'))
respXPath = msgXPath+'/div['+str(num)+']'
while (driver.find_element_by_xpath(respXPath).text == waitPlaceHolder):
sleep(0.01)
return driver.find_element_by_xpath(respXPath).text

def startChat():
while True:
message = input('>> ')
if (message == COMMAND_STOP):
break
response = getResponse(message)
print (response)
print ('Bot shutting down')

#startChat()
13 changes: 13 additions & 0 deletions check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
import matplotlib.pyplot as plt

objects = ('Python', 'C++', 'Java', 'Perl', 'Scala', 'Lisp')
y_pos = np.arange(len(objects))
performance = [10,8,6,4,2,1]

plt.bar(y_pos, performance, align='center', alpha=0.5)
plt.xticks(y_pos, objects)
plt.ylabel('Usage')
plt.title('Programming language usage')
plt.savefig('foo.png')
35 changes: 35 additions & 0 deletions clear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# old = ['A','B','C','D','E']
# new = ['A','B','C','D','E','F','G']

# old = ['A','B','C','D','E']
# new = ['C','D','E','F','G']

# old = ['A','B','B']
# new = ['B','B','B']

old = ['A','B','B']
new = ['B','B']

unread = []

for i in range(0,len(new)):
comFlag=0
for j in range(0,len(old)):
#print (old[j],new[i])
if (new[i]==old[j]):
k=0
while (i+k<len(new) and j+k<len(old) and new[i+k]==old[j+k]):
k+=1
if (j+k==len(old)):
break
if (j+k==len(old)):
unread = new[i+k:]
comFlag=1
break
if (comFlag==1):
break

if (comFlag==0):
unread=new
print (unread)
print ('Done')
35 changes: 35 additions & 0 deletions clearCopy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# old = ['A','B','C','D','E']
# new = ['A','B','C','D','E','F','G']

# old = ['A','B','C','D','E']
# new = ['C','D','E','F','G']

# old = ['A','B','B']
# new = ['B','B','B']

old = ['A','B','B']
new = ['B','B']

unread = []

for i in range(0,len(new)):
comFlag=0
for j in range(0,len(old)):
#print (old[j],new[i])
if (new[i]==old[j]):
k=0
while (i+k<len(new) and j+k<len(old) and new[i+k]==old[j+k]):
k+=1
if (j+k==len(old)):
break
if (j+k==len(old)):
unread = new[i+k:]
comFlag=1
break
if (comFlag==1):
break

if (comFlag==0):
unread=new
print (unread)
print ('Done')
1 change: 1 addition & 0 deletions credentials.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"installed":{"client_id":"198434578168-45f477pr9mdku5ectn6vsjivq9nhp6r5.apps.googleusercontent.com","project_id":"quickstart-1553633302188","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"srBVfI0mbT_rdglQBHlu-bDA","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
12 changes: 12 additions & 0 deletions drive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os
proxy = 'http://172.31.2.4:8080'

os.environ['http_proxy'] = proxy
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy

def uploadDrive(path):
os.system('gdrive upload ' + path)

# uploadDrive('/home/shreyasus/Desktop/Ganador')
Binary file added foo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gdrive
Binary file not shown.
58 changes: 58 additions & 0 deletions getEvent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from __future__ import print_function
import datetime
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import os
proxy = 'http://172.31.2.4:8080'

os.environ['http_proxy'] = proxy
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy

# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']

def upComingEvents(total, start_date):
"""Shows basic usage of the Google Calendar API.
Prints the start and name of the next 10 events on the user's calendar.
"""
creds = None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'credentials.json', SCOPES)
creds = flow.run_local_server()
# Save the credentials for the next run
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)

service = build('calendar', 'v3', credentials=creds)

# Call the Calendar API
now = datetime.datetime.utcnow().isoformat() + 'Z' # 'Z' indicates UTC time
print('Getting the upcoming 10 events')
events_result = service.events().list(calendarId='en.indian#[email protected]', timeMin=start_date,
maxResults=total, singleEvents=True,
orderBy='startTime').execute()
events = events_result.get('items', [])
print (now)
if not events:
print('No upcoming events found.')
for event in events:
start = event['start'].get('dateTime', event['start'].get('date'))
print(start, event['summary'])

upComingEvents(10, '2019-03-20T01:00:00.00Z')
Binary file added image.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions ocr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread('digits.png')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

# Now we split the image to 5000 cells, each 20x20 size
cells = [np.hsplit(row,100) for row in np.vsplit(gray,50)]

# Make it into a Numpy array. It size will be (50,100,20,20)
x = np.array(cells)

# Now we prepare train_data and test_data.
train = x[:,:50].reshape(-1,400).astype(np.float32) # Size = (2500,400)
test = x[:,50:100].reshape(-1,400).astype(np.float32) # Size = (2500,400)

# Create labels for train and test data
k = np.arange(10)
train_labels = np.repeat(k,250)[:,np.newaxis]
test_labels = train_labels.copy()

# Initiate kNN, train the data, then test it with test data for k=1
knn = cv2.KNearest()
knn.train(train,train_labels)
ret,result,neighbours,dist = knn.find_nearest(test,k=5)

# Now we check the accuracy of classification
# For that, compare the result with test_labels and check which are wrong
matches = result==test_labels
correct = np.count_nonzero(matches)
accuracy = correct*100.0/result.size
print (accuracy)
8 changes: 8 additions & 0 deletions ostest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import os as os1
import os

os1.chdir('/home/shreyasus/Desktop/')
os1.system('ls')

os.chdir('/home/shreyasus/Desktop/HINT4/')
os.system('ls')
16 changes: 16 additions & 0 deletions paths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

USER = 'shreyasus'
PASSWORD = '1234'
EMAIL = '[email protected]'

DRIVER_PATH = '/home/'+USER+'/Downloads/chromedriver'
REPLY_ONLY_LIST_PATH = '/home/'+USER+'/Desktop/HINT4/replyOnlyList.txt'
SLANG_WORDS_PATH = '/home/'+USER+'/Desktop/HINT4/slangWords.txt'
SLANG_WORDS_RESPONSE_PATH = '/home/'+USER+'/Desktop/HINT4/slangWordsResponse.txt'
MY_DOCS_LIST_PATH = '/home/'+USER+'/Desktop/HINT4/MyDocs/myDocsList.txt'
MY_DOCS_PATH = '/home/'+USER+'/Desktop/HINT4/MyDocs/'
HINT_PATH = '/home/'+USER+'/Desktop/HINT4/'
URL = 'file:///home/'+USER+'/Desktop/HINT4/chatbot.html'
DOWNLOAD_PATH = '/home/'+USER+'/Downloads/'
SAVING_PATH = '/home/'+USER+'/Desktop/HINT4/'
START_PATH = '/home/'+USER+'/'
Loading

0 comments on commit 21e2e14

Please sign in to comment.