├── WA FOR GD REPORT.docx └── CODE FOR WEB APPLICATION FOR GD.ipynb /WA FOR GD REPORT.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuvashreeSugumar/WEB-APPLICATION-FOR-GROUP-DISCUSSION-MINOR-PROJECT-III/HEAD/WA FOR GD REPORT.docx -------------------------------------------------------------------------------- /CODE FOR WEB APPLICATION FOR GD.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "e3fd2838", 7 | "metadata": {}, 8 | "outputs": [ 9 | { 10 | "name": "stdout", 11 | "output_type": "stream", 12 | "text": [ 13 | "Requirement already satisfied: language_tool_python in c:\\users\\sugumar\\anaconda3\\lib\\site-packages (2.7.1)Note: you may need to restart the kernel to use updated packages.\n", 14 | "\n", 15 | "Requirement already satisfied: tqdm in c:\\users\\sugumar\\anaconda3\\lib\\site-packages (from language_tool_python) (4.64.1)\n", 16 | "Requirement already satisfied: requests in c:\\users\\sugumar\\anaconda3\\lib\\site-packages (from language_tool_python) (2.28.1)\n", 17 | "Requirement already satisfied: charset-normalizer<3,>=2 in c:\\users\\sugumar\\anaconda3\\lib\\site-packages (from requests->language_tool_python) (2.0.4)\n", 18 | "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\sugumar\\anaconda3\\lib\\site-packages (from requests->language_tool_python) (2022.9.14)\n", 19 | "Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\users\\sugumar\\anaconda3\\lib\\site-packages (from requests->language_tool_python) (1.26.11)\n", 20 | "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\sugumar\\anaconda3\\lib\\site-packages (from requests->language_tool_python) (3.3)\n", 21 | "Requirement already satisfied: colorama in c:\\users\\sugumar\\anaconda3\\lib\\site-packages (from tqdm->language_tool_python) (0.4.5)\n" 22 | ] 23 | } 24 | ], 25 | "source": [ 26 | "pip install language_tool_python" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 2, 32 | "id": "2fa48841", 33 | "metadata": {}, 34 | "outputs": [ 35 | { 36 | "name": "stdout", 37 | "output_type": "stream", 38 | "text": [ 39 | "Requirement already satisfied: pyaudio in c:\\users\\sugumar\\anaconda3\\lib\\site-packages (0.2.13)\n", 40 | "Note: you may need to restart the kernel to use updated packages.\n" 41 | ] 42 | } 43 | ], 44 | "source": [ 45 | "pip install pyaudio" 46 | ] 47 | }, 48 | { 49 | "cell_type": "code", 50 | "execution_count": 3, 51 | "id": "88007f55", 52 | "metadata": {}, 53 | "outputs": [ 54 | { 55 | "name": "stdout", 56 | "output_type": "stream", 57 | "text": [ 58 | "Note: you may need to restart the kernel to use updated packages.\n" 59 | ] 60 | }, 61 | { 62 | "name": "stderr", 63 | "output_type": "stream", 64 | "text": [ 65 | "ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)\n", 66 | "ERROR: No matching distribution found for tkinter\n" 67 | ] 68 | } 69 | ], 70 | "source": [ 71 | "pip install tkinter" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": 1, 77 | "id": "5db2f3a8", 78 | "metadata": {}, 79 | "outputs": [ 80 | { 81 | "name": "stdout", 82 | "output_type": "stream", 83 | "text": [ 84 | "Listening...\n" 85 | ] 86 | } 87 | ], 88 | "source": [ 89 | "import tkinter as tk\n", 90 | "from tkinter import scrolledtext\n", 91 | "import speech_recognition as sr\n", 92 | "from language_tool_python import LanguageTool\n", 93 | "\n", 94 | "def start_listening():\n", 95 | " try:\n", 96 | " with sr.Microphone() as source:\n", 97 | " recognizer.adjust_for_ambient_noise(source)\n", 98 | " print(\"Listening...\")\n", 99 | " audio = recognizer.listen(source)\n", 100 | " text = recognizer.recognize_google(audio)\n", 101 | " text_area.insert(tk.END, text + \" \")\n", 102 | " corrected_text = check_grammar(text)\n", 103 | " if corrected_text:\n", 104 | " text_area.insert(tk.END, \"Corrected Text: \" + corrected_text + \" \")\n", 105 | " except sr.UnknownValueError:\n", 106 | " text_area.insert(tk.END, \"Sorry, could not understand audio. \")\n", 107 | " except sr.RequestError as e:\n", 108 | " text_area.insert(tk.END, f\"Error with the service; {e}. \")\n", 109 | "\n", 110 | "def check_grammar(text):\n", 111 | " tool = LanguageTool('en-US')\n", 112 | " matches = tool.check(text)\n", 113 | " corrected_text = tool.correct(text)\n", 114 | " return corrected_text\n", 115 | "\n", 116 | "def clear_text():\n", 117 | " text_area.delete('1.0', tk.END)\n", 118 | "\n", 119 | "# Create the main window\n", 120 | "window = tk.Tk()\n", 121 | "window.title(\"Speech-to-Text and Grammar Checker\")\n", 122 | "\n", 123 | "# Create widgets\n", 124 | "text_area = scrolledtext.ScrolledText(window, wrap=tk.WORD, width=40, height=10)\n", 125 | "text_area.pack()\n", 126 | "text_area.config(state=tk.NORMAL)\n", 127 | "\n", 128 | "start_button = tk.Button(window, text=\"Start Listening\", command=start_listening)\n", 129 | "start_button.pack()\n", 130 | "\n", 131 | "clear_button = tk.Button(window, text=\"Clear Text\", command=clear_text)\n", 132 | "clear_button.pack()\n", 133 | "\n", 134 | "recognizer = sr.Recognizer()\n", 135 | "\n", 136 | "window.mainloop()\n" 137 | ] 138 | }, 139 | { 140 | "cell_type": "code", 141 | "execution_count": null, 142 | "id": "58088c1d", 143 | "metadata": {}, 144 | "outputs": [], 145 | "source": [] 146 | } 147 | ], 148 | "metadata": { 149 | "kernelspec": { 150 | "display_name": "Python 3 (ipykernel)", 151 | "language": "python", 152 | "name": "python3" 153 | }, 154 | "language_info": { 155 | "codemirror_mode": { 156 | "name": "ipython", 157 | "version": 3 158 | }, 159 | "file_extension": ".py", 160 | "mimetype": "text/x-python", 161 | "name": "python", 162 | "nbconvert_exporter": "python", 163 | "pygments_lexer": "ipython3", 164 | "version": "3.9.13" 165 | } 166 | }, 167 | "nbformat": 4, 168 | "nbformat_minor": 5 169 | } 170 | --------------------------------------------------------------------------------