Japanese Lyric Learner is a Python application designed to analyze Japanese song lyrics. It uses the OpenAI API to provide detailed translations and explanations of the lyrics.
- Analyzes Japanese song lyrics in batches.
- Provides accurate translations and detailed explanations of grammar and key vocabulary.
- Saves the analysis results to output files.
- Python 3.11+
- uv package manager (recommended) or pip
- Required Python packages (listed in
pyproject.toml)
-
Clone the repository:
git clone <repository-url> cd japanese-lyric-learner
-
Install uv if you haven't already:
curl -LsSf https://astral.sh/uv/install.sh | sh -
Install dependencies:
uv sync
-
Create a
.envfile in the root directory and add your OpenAI API key, model name, and base URL:OPENAI_API_KEY=your_openai_api_key MODEL_NAME=qwen-plus BASE_URL=https://dashscope-intl.aliyuncs.com/compatible-mode/v1
-
If you want to use the OpenAI GPT model, update your
.envfile as follows:OPENAI_API_KEY=your_openai_api_key MODEL_NAME=gpt-5 BASE_URL=https://api.openai.com/v1 # Default OpenAI API URL
-
Place your song lyrics in the
original_song/learnedororiginal_song/to_learndirectories. -
Run the main script:
uv run main.py
This will create a file named test_analyze.txt in the output directory, which you can use as a reference for the analysis results.