Spaces:
Configuration error
Configuration error
Update README.md
Browse files
README.md
CHANGED
@@ -1,14 +1,73 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# **BLEU Score Comparison for English-to-Japanese Translations**
|
2 |
+
|
3 |
+
## **Overview**
|
4 |
+
This project demonstrates the calculation and visualization of BLEU scores for English-to-Japanese translations. The BLEU scores evaluate the performance of two different models: an **LSTM-based model** and a **Seq2Seq model**, based on their ability to translate input sentences into Japanese.
|
5 |
+
|
6 |
+
## **Models Evaluated**
|
7 |
+
1. **LSTM-based Model**:
|
8 |
+
- A simpler model that predicts translations based on a sequential structure.
|
9 |
+
- Tends to perform moderately well but lacks sophistication in handling complex language patterns.
|
10 |
+
|
11 |
+
2. **Seq2Seq Model**:
|
12 |
+
- A more advanced model designed for sequence-to-sequence tasks.
|
13 |
+
- Expected to perform better due to its ability to learn complex patterns and context.
|
14 |
+
|
15 |
+
## **Key Features**
|
16 |
+
- Calculates BLEU scores using the **SacreBLEU** library.
|
17 |
+
- Visualizes BLEU scores as a bar chart for easy comparison.
|
18 |
+
- Saves the BLEU scores to a CSV file for further analysis.
|
19 |
+
|
20 |
+
## **Implementation**
|
21 |
+
### **Steps in the Code**:
|
22 |
+
1. **Dataset Preparation**:
|
23 |
+
- The dataset contains English sentences and their corresponding Japanese translations (used as references).
|
24 |
+
- Predictions from both LSTM and Seq2Seq models are compared against these references.
|
25 |
+
|
26 |
+
2. **BLEU Score Calculation**:
|
27 |
+
- BLEU scores are computed using SacreBLEU to quantify the overlap between the model predictions and the ground truth references.
|
28 |
+
|
29 |
+
3. **Visualization**:
|
30 |
+
- BLEU scores are visualized using a bar chart to provide an intuitive comparison of model performance.
|
31 |
+
|
32 |
+
4. **Saving Results**:
|
33 |
+
- The BLEU scores for both models are saved to a CSV file named `bleu_scores_english_to_japanese.csv`.
|
34 |
+
|
35 |
+
## **Files**
|
36 |
+
- `main.py`: The primary Python script containing the code for BLEU score calculation, visualization, and saving results.
|
37 |
+
- `bleu_scores.csv`: Output file containing the BLEU scores for both models.
|
38 |
+
|
39 |
+
## **Requirements**
|
40 |
+
### **Dependencies**:
|
41 |
+
- Python 3.x
|
42 |
+
- Libraries:
|
43 |
+
- `sacrebleu`
|
44 |
+
- `matplotlib`
|
45 |
+
- `csv`
|
46 |
+
|
47 |
+
To install the required dependencies, run:
|
48 |
+
```bash
|
49 |
+
pip install sacrebleu matplotlib
|
50 |
+
```
|
51 |
+
|
52 |
+
## **Usage**
|
53 |
+
1. Clone this repository and navigate to the project directory.
|
54 |
+
2. Run the script:
|
55 |
+
```bash
|
56 |
+
python main.py
|
57 |
+
```
|
58 |
+
3. View the BLEU scores printed in the console and the generated bar chart.
|
59 |
+
4. Check the `bleu_scores_english.csv` file for the saved results.
|
60 |
+
|
61 |
+
## **Results**
|
62 |
+
- The BLEU scores for both models are displayed in the console and visualized in the bar chart.
|
63 |
+
- Example output:
|
64 |
+
```
|
65 |
+
BLEU Score Comparison (English-to-Japanese):
|
66 |
+
LSTM Model BLEU Score: 45.32
|
67 |
+
Seq2Seq Model BLEU Score: 70.25
|
68 |
+
BLEU scores have been saved to bleu_scores.csv
|
69 |
+
```
|
70 |
+
|
71 |
+
## **Acknowledgments**
|
72 |
+
This project uses the SacreBLEU library for BLEU score calculation and Matplotlib for visualization.
|
73 |
+
|