Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vikrant48/language__detection
Language detection from audio file or text file
https://github.com/vikrant48/language__detection
Last synced: 4 days ago
JSON representation
Language detection from audio file or text file
- Host: GitHub
- URL: https://github.com/vikrant48/language__detection
- Owner: vikrant48
- Created: 2024-05-16T03:01:03.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-07-05T16:45:22.000Z (7 months ago)
- Last Synced: 2024-07-05T21:55:50.919Z (7 months ago)
- Language: Jupyter Notebook
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Audio Language Detection
## Overview
This project provides a Python script for detecting the language of spoken words in an audio file or through microphone input. It utilizes the speech_recognition, langdetect, and googletrans libraries for recognizing speech, detecting language, and translating text.## Requirements
Python 3.x\
speech_recognition\
langdetect\
googletrans\You can install the required libraries using pip:
```bash
pip install SpeechRecognition langdetect googletrans==4.0.0-rc1
```## uses
### detect_language_from_audio(audio_file)
This function detects the language of spoken words from an audio file or microphone input.\
Parameters\
audio_file (str): Path to the audio file. If an empty string is provided, the script will use the microphone for input.\
Returns\
language (str): Detected language code (e.g., 'en' for English, 'fr' for French).### translate_to_oriLanguage(text)
This helper function translates the input text to its original language.\Parameters\
text (str): Text to be translated.\
Returns\
translated.text (str): Translated text.## Notes
Ensure your internet connection is stable as the speech recognition and translation functionalities require online services.\
Handle exceptions properly to avoid unexpected crashes.