/Talk2TextSim

The objective of this project is to design and develop a tool that converts audio files to text, preprocesses the text, and calculates the cosine similarity between the preprocessed text and a reference text.

Primary LanguagePythonMIT LicenseMIT

Talk2TextSim

You can run the code in vs code and pycharm.

Explanation:

Audio File Conversion:

It converts a list of input audio files in .m4a format to .wav format using the moviepy library.

Speech Recognition:

It uses the speech_recognition library to recognize the text from the converted audio files.

Text Preprocessing:

It preprocesses the recognized text by tokenizing, removing stop words, and converting to lowercase using the nltk library.

Cosine Similarity Calculation:

It calculates the cosine similarity between the preprocessed text and a reference text ("hello how are you") using the sklearn library.

Similarity Percentage Calculation:

It calculates the similarity percentage by multiplying the cosine similarity score by 100.

The script consists of the following functions:

preprocess_text:

preprocesses the text by tokenizing, removing stop words, and converting to lowercase.

get_wordnet_pos:

determines the part-of-speech (POS) tag for a given word.

calculate_cosine_similarity:

calculates the cosine similarity between two texts.

main:

the main function that orchestrates the entire process.

The script uses the following libraries:

moviepy: for audio file conversion

speech_recognition: for speech recognition

nltk: for text preprocessing and POS tagging

sklearn: for cosine similarity calculation

The output looks like this:

Capture

Capture 2

Capture 3

Capture 4

License

MIT License