Skip to content

Commit

Permalink
Improved the organisation of files, added all python code in python f…
Browse files Browse the repository at this point in the history
…older.
  • Loading branch information
Godzilla5111 committed Oct 2, 2021
1 parent 364049d commit 1c562fd
Show file tree
Hide file tree
Showing 32 changed files with 404 additions and 404 deletions.
File renamed without changes.
66 changes: 33 additions & 33 deletions Audio_book.py → Python/Audio_book.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# To read PDF file using Python pip install pypdf2 To Read text (Text to speech) pip install pyaudio pip install pyttsx3

import pyttsx3
import PyPDF2

book = open("C:/Users/bhask\Desktop/tweet_summarization/DE1.pdf","rb")
pdfReader = PyPDF2.PdfFileReader(book)
pages = pdfReader.numPages
print("total number of pages is:" ,pages)

speaker = pyttsx3.init()
""" RATE"""
rate = speaker.getProperty('rate') # getting details of current speaking rate
print ("current voice rate is: ",rate) #printing current voice rate
speaker.setProperty('rate',170) # setting up new voice rate
speaker.runAndWait()

"""VOLUME"""
volume = speaker.getProperty('volume') #getting to know current volume level (min=0 and max=1)
print ("volume level is at : ",volume) #printing current volume level
speaker.setProperty('volume',1.0) # setting up volume level between 0 and 1

"""VOICE"""
voices = speaker.getProperty('voices') #getting details of current voice
#speaker.setProperty('voice', voices[0].id) #changing index, changes voices. o for male
speaker.setProperty('voice', voices[1].id) #changing index, changes voices. 1 for female
speaker.say("HII BHASKAR!, NICE to see you here............")
print("the reading of book is started!............")
speaker.say("the reading of book is started!!!!!!!!")
for num in range(1,pages):
page = pdfReader.getPage(num)
text = page.extractText()
speaker.say(text)
# To read PDF file using Python pip install pypdf2 To Read text (Text to speech) pip install pyaudio pip install pyttsx3

import pyttsx3
import PyPDF2

book = open("C:/Users/bhask\Desktop/tweet_summarization/DE1.pdf","rb")
pdfReader = PyPDF2.PdfFileReader(book)
pages = pdfReader.numPages
print("total number of pages is:" ,pages)

speaker = pyttsx3.init()
""" RATE"""
rate = speaker.getProperty('rate') # getting details of current speaking rate
print ("current voice rate is: ",rate) #printing current voice rate
speaker.setProperty('rate',170) # setting up new voice rate
speaker.runAndWait()

"""VOLUME"""
volume = speaker.getProperty('volume') #getting to know current volume level (min=0 and max=1)
print ("volume level is at : ",volume) #printing current volume level
speaker.setProperty('volume',1.0) # setting up volume level between 0 and 1

"""VOICE"""
voices = speaker.getProperty('voices') #getting details of current voice
#speaker.setProperty('voice', voices[0].id) #changing index, changes voices. o for male
speaker.setProperty('voice', voices[1].id) #changing index, changes voices. 1 for female
speaker.say("HII BHASKAR!, NICE to see you here............")
print("the reading of book is started!............")
speaker.say("the reading of book is started!!!!!!!!")
for num in range(1,pages):
page = pdfReader.getPage(num)
text = page.extractText()
speaker.say(text)
speaker.runAndWait()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
96 changes: 48 additions & 48 deletions NQueens.py → Python/NQueens.py
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
global N
N = 4

def printSolution(board):
for i in range(N):
for j in range(N):
print (board[i][j], end = " ")
print()

def isSafe(board, row, col):
for i in range(col):
if board[row][i] == 1:
return False
for i, j in zip(range(row, -1, -1),
range(col, -1, -1)):
if board[i][j] == 1:
return False
for i, j in zip(range(row, N, 1),
range(col, -1, -1)):
if board[i][j] == 1:
return False

return True

def solveutil(board, col):
if col >= N:
return True
for i in range(N):

if isSafe(board, i, col):
board[i][col] = 1
if solveutil(board, col + 1) == True:
return True
board[i][col] = 0
return False

def solveNQ():
board = [ [0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0] ]

if solveutil(board, 0) == False:
print ("Solution does not exist")
return False

printSolution(board)
return True
global N
N = 4

def printSolution(board):
for i in range(N):
for j in range(N):
print (board[i][j], end = " ")
print()

def isSafe(board, row, col):
for i in range(col):
if board[row][i] == 1:
return False
for i, j in zip(range(row, -1, -1),
range(col, -1, -1)):
if board[i][j] == 1:
return False
for i, j in zip(range(row, N, 1),
range(col, -1, -1)):
if board[i][j] == 1:
return False

return True

def solveutil(board, col):
if col >= N:
return True
for i in range(N):

if isSafe(board, i, col):
board[i][col] = 1
if solveutil(board, col + 1) == True:
return True
board[i][col] = 0
return False

def solveNQ():
board = [ [0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0] ]

if solveutil(board, 0) == False:
print ("Solution does not exist")
return False

printSolution(board)
return True
solveNQ()
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 1c562fd

Please sign in to comment.