Spaces:
Configuration error
Configuration error
Update README.md
Browse files
README.md
CHANGED
@@ -1,73 +1,101 @@
|
|
1 |
-
# **BLEU Score
|
2 |
|
3 |
## **Overview**
|
4 |
-
This project
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
- Tends to perform moderately well but lacks sophistication in handling complex language patterns.
|
10 |
|
11 |
-
|
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 |
-
|
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 |
-
## **
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
- BLEU scores are computed using SacreBLEU to quantify the overlap between the model predictions and the ground truth references.
|
28 |
|
29 |
-
|
30 |
-
- BLEU scores are visualized using a bar chart to provide an intuitive comparison of model performance.
|
31 |
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
41 |
- Python 3.x
|
42 |
-
-
|
43 |
-
|
44 |
-
|
45 |
-
- `csv`
|
46 |
|
47 |
-
|
48 |
```bash
|
49 |
pip install sacrebleu matplotlib
|
50 |
```
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
-
|
63 |
-
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
## **Acknowledgments**
|
72 |
-
This project uses the SacreBLEU library for BLEU score calculation and Matplotlib for visualization.
|
73 |
|
|
|
1 |
+
# **BLEU and chrF Score Evaluation for English-to-Japanese Translations**
|
2 |
|
3 |
## **Overview**
|
4 |
+
This project evaluates the performance of two translation models:
|
5 |
+
1. **LSTM-based Model**
|
6 |
+
2. **Seq2Seq Model**
|
7 |
|
8 |
+
The evaluation is based on two standard metrics:
|
9 |
+
- **BLEU Score**: Measures n-gram precision with a penalty for shorter translations.
|
10 |
+
- **chrF Score**: Measures character-level n-gram precision and recall with a focus on fluency.
|
|
|
11 |
|
12 |
+
The dataset contains translations from **English to Japanese**, where both the reference (ground truth) and predicted translations are evaluated.
|
|
|
|
|
13 |
|
14 |
+
---
|
|
|
|
|
|
|
15 |
|
16 |
+
## **Project Structure**
|
17 |
+
- **Code**: Contains Python scripts for computing BLEU and chrF scores using the `sacrebleu` library.
|
18 |
+
- **Input Data**:
|
19 |
+
- Reference translations (ground truth in Japanese).
|
20 |
+
- Predictions generated by LSTM and Seq2Seq models.
|
21 |
+
- **Output**:
|
22 |
+
- BLEU and chrF scores for each model.
|
23 |
+
- Visualizations of the comparison as bar charts.
|
24 |
+
- Results saved to `.csv` files.
|
25 |
|
26 |
+
---
|
|
|
27 |
|
28 |
+
## **Evaluation Steps**
|
|
|
29 |
|
30 |
+
### **1. BLEU Score Evaluation**
|
31 |
+
The **BLEU** metric evaluates n-gram matches between model predictions and reference translations. Higher scores indicate better translation quality.
|
32 |
+
|
33 |
+
**Process**:
|
34 |
+
1. Compute BLEU scores using `sacrebleu.corpus_bleu`.
|
35 |
+
2. Compare scores for LSTM and Seq2Seq models.
|
36 |
+
3. Save results to `bleu_scores.csv`.
|
37 |
+
4. Visualize the results with a bar chart.
|
38 |
+
|
39 |
+
**Example BLEU Results**:
|
40 |
+
| Model | BLEU Score |
|
41 |
+
|---------|------------|
|
42 |
+
| LSTM | 60.45 |
|
43 |
+
| Seq2Seq | 85.78 |
|
44 |
+
|
45 |
+
---
|
46 |
+
|
47 |
+
### **2. chrF Score Evaluation**
|
48 |
+
The **chrF** metric evaluates character-level n-gram precision and recall, making it more sensitive to fluency and grammatical correctness.
|
49 |
+
|
50 |
+
**Process**:
|
51 |
+
1. Compute chrF scores using `sacrebleu.corpus_chrf`.
|
52 |
+
2. Compare scores for LSTM and Seq2Seq models.
|
53 |
+
3. Save results to `chrf_scores_updated.csv`.
|
54 |
+
4. Visualize the results with a bar chart.
|
55 |
+
|
56 |
+
**Example chrF Results**:
|
57 |
+
| Model | chrF Score |
|
58 |
+
|---------|------------|
|
59 |
+
| LSTM | 72.36 |
|
60 |
+
| Seq2Seq | 93.12 |
|
61 |
+
|
62 |
+
---
|
63 |
|
64 |
## **Files**
|
|
|
|
|
65 |
|
66 |
+
- **`bleu_scores.csv`**: Contains BLEU scores for LSTM and Seq2Seq models.
|
67 |
+
- **`chrf_scores_updated.csv`**: Contains chrF scores for LSTM and Seq2Seq models.
|
68 |
+
- **Python Script**: Computes BLEU and chrF scores, generates visualizations, and saves results.
|
69 |
+
|
70 |
+
---
|
71 |
+
|
72 |
+
## **Dependencies**
|
73 |
- Python 3.x
|
74 |
+
- `sacrebleu`: Library for computing BLEU and chrF scores.
|
75 |
+
- `matplotlib`: For plotting visualizations.
|
76 |
+
- `csv`: To save results as `.csv` files.
|
|
|
77 |
|
78 |
+
Install dependencies using:
|
79 |
```bash
|
80 |
pip install sacrebleu matplotlib
|
81 |
```
|
82 |
|
83 |
+
---
|
84 |
+
|
85 |
+
## **How to Run**
|
86 |
+
1. Results will be saved as `.csv` files, and bar charts will be displayed.
|
87 |
+
|
88 |
+
---
|
89 |
+
|
90 |
+
## **Visualization**
|
91 |
+
Both BLEU and chrF results are displayed as bar charts for easy comparison:
|
92 |
+
- **X-axis**: Models (LSTM, Seq2Seq).
|
93 |
+
- **Y-axis**: Scores (BLEU or chrF).
|
94 |
+
- Each chart highlights the comparative performance of the models.
|
95 |
+
|
96 |
+
---
|
97 |
+
|
98 |
+
## **Conclusion**
|
99 |
+
- **Seq2Seq Model**: Achieves higher BLEU and chrF scores, demonstrating better translation accuracy and fluency.
|
100 |
+
- **LSTM Model**: Performs adequately but lags behind Seq2Seq in both metrics.
|
|
|
|
|
|
|
101 |
|