This repository contains a Python script that processes subtitle files to extract words, lemmatize them, and translate them from Spanish to English. The script outputs each word with its translation and the context in which it appeared.
- Extracts words from subtitle files
- Lemmatizes words to their base form
- Translates words from Spanish to English using Google Translate API
- Outputs each word with its translation and context
- Python 3.7+
pysrtfor reading subtitle filesspacyfor natural language processingaiohttpfor asynchronous HTTP requests
-
Clone this repository:
git clone https://github.com/nellrun/subtitle-word-extractor.git cd subtitle-word-extractor -
Create a virtual environment and activate it:
make install
-
Install language model:
./venv/bin/python -m spacy download es_core_news_sm # your model
Here is an example of what the output might look like:
Spanish: hola | English: hello | Context: Hola, ¿cómo estás?
Spanish: cómo | English: how | Context: Hola, ¿cómo estás?
Spanish: estar | English: be | Context: Hola, ¿cómo estás?
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.