- Member-1: Dushant Panchbhai Email: [email protected]
- Member-2: Mithilesh Patil Email: [email protected]
- Mentor-1 : Parth
- Mentor-2 : Priyesh Vakharia
In this project, we had made a website consisting of chatbot functioning.
this chatbot model is based on the web scrapping. whatever the question we give to the chatbot, the chatbot does a google search based on the topic.
from googlesearch import search
search_result_list = list(search(question, tld="co.in",start=0,num=10, stop=10, pause=2))
after doing google search the bot will pickup the first hyperlink.extract the whole text and do the natural language processing it and display the appropriate result based on it.
page = requests.get(search_result_list[index])
tree = html.fromstring(page.content)
#prints the whole .html script
soup = BeautifulSoup(page.content, features="lxml")
article_text = ''
article = soup.findAll('p')
for element in article:
article_text += '\n' + ''.join(element.findAll(text = True))
first_sentence = article_text.split('\n')
#first_sentence consist of list of text of the webpage seprated by newline.
we had also embedded some greeting syntax file which will deal with some greeting and natural conversation questions like who are you? , tell me a joke, etc.
def filter(question):
# path1 is the address of greeting.yml file which consist of all the greeting syntax.
a_yaml_file = open(path1)
par = yaml.load(a_yaml_file, Loader=yaml.FullLoader)
so, the model will first check if the entered question is greeting type or not. if the question is not greeting type then it will show result according to web scrapping
- GitHub repo link: Link to repository
- Drive link: Drive link here
- Python
- Django
- Natural language processing libraries include Spacy, Nltk.
- HTML,CSS, and javascript.
- clone the project from the GitHub link
- open the terminal and create a virtual environment
pip install virtualenv
virtualenv [virtual environment name]
*to enter virtual environment syntax is:
source (environment name)/bin/activate
NOTE: you should be in the folder containing the environment while doing this.
- install the requirement.txt file present in the folder in that environment
syntax: pip install -r requirements.txt
- In terminal enter following command to install 'en_core_web_sm'.
python -m spacy download en_core_web_sm
-
In terminal activate the virtual environment
-
enter the folder containing project in terminal using the cd command
-
after that type this command and press enter:
python manage.py runserver
- This project can help in finding the main solution to many questions. so instead of surfing over the internet, enter your question here and get the answer.
This project can build further by implementing a voice search in it. Also, the model can be modified so as to get a more effective and accurate answer
for recording of chatbot clickhere