help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
language-translation
/
scripts
RSK World
language-translation
Language Translation Dataset - Machine Translation + Multilingual NLP + Parallel Corpus + Transformers
scripts
  • __pycache__
  • analyze_dataset.py4.6 KB
  • build_local_dictionary.py6.7 KB
  • convert_format.py3.6 KB
  • create_zip.py4.1 KB
  • download_translation_data.py17.6 KB
  • process_data.py3.9 KB
README.mdcreate_zip.pydashboard.htmlconvert_format.py
README.md
Raw Download

README.md

# Language Translation Dataset

<!--
Language Translation Dataset - README
Author: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277
Copyright © 2016 RSK World. All rights reserved.
-->

## Overview

This dataset contains parallel sentence pairs in multiple languages with aligned translations. Perfect for machine translation, multilingual NLP, and cross-lingual model training.

## Features

- ✅ Parallel sentences
- ✅ Multiple language pairs
- ✅ Aligned translations
- ✅ Training and validation sets
- ✅ Ready for translation models

## Dataset Information

- **Category**: Text Data
- **Difficulty**: Advanced
- **Technologies**: TSV, JSON, Transformers, mBERT, mT5
- **Format**: TSV (Tab-Separated Values) and JSON

## Dataset Structure

The dataset includes parallel sentence pairs in multiple languages:

- English
- Spanish
- French
- German
- And more...

## Files Included

- `data/train.tsv` - Training dataset in TSV format
- `data/validation.tsv` - Validation dataset in TSV format
- `data/train.json` - Training dataset in JSON format
- `data/validation.json` - Validation dataset in JSON format
- `data/sample_data.json` - Sample data for preview
- `scripts/process_data.py` - Python script for data processing
- `scripts/convert_format.py` - Script to convert between TSV and JSON formats

## Usage

### Loading TSV Data

```python
import pandas as pd

# Load training data
train_df = pd.read_csv('data/train.tsv', sep='\t')
print(train_df.head())
```

### Loading JSON Data

```python
import json

# Load training data
with open('data/train.json', 'r', encoding='utf-8') as f:
train_data = json.load(f)
```

### Using with Transformers

```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("google/mt5-small")
model = AutoModelForSeq2SeqLM.from_pretrained("google/mt5-small")
```

## Installation

1. Download the dataset from the provided link
2. Extract the files
3. Install required dependencies:

```bash
pip install pandas transformers torch
```

## Processing Scripts

Run the data processing script:

```bash
python scripts/process_data.py
```

Convert between formats:

```bash
python scripts/convert_format.py --input data/train.tsv --output data/train.json
```

## Citation

If you use this dataset in your research, please cite:

```
Language Translation Dataset
RSK World (https://rskworld.in)
2016
```

## Contact

- **Website**: https://rskworld.in
- **Email**: help@rskworld.in
- **Phone**: +91 93305 39277

## License

Copyright © 2016 RSK World. All rights reserved.

---

**Created by RSK World** - Free Programming Resources & Source Code

scripts/create_zip.py
Raw Download
Find: Go to:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Language Translation Dataset - Create ZIP Archive Script
Author: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277
Copyright © 2016 RSK World. All rights reserved.

This script creates a ZIP archive of the entire project for download.
"""

import zipfile
import os
from pathlib import Path
from datetime import datetime

BASE_DIR = Path(__file__).parent.parent
ZIP_FILE = BASE_DIR / 'language-translation.zip'

# Files and directories to include
INCLUDE_PATTERNS = [
    'data/*.json',
    'data/*.tsv',
    'data/*.txt',
    'scripts/*.py',
    'examples/*.py',
    '*.py',
    '*.md',
    '*.txt',
    '*.html',
    'LICENSE',
    'requirements.txt'
]

# Files and directories to exclude
EXCLUDE_PATTERNS = [
    '__pycache__',
    '*.pyc',
    '*.pyo',
    '.git',
    '.DS_Store',
    '*.zip',
    'tatoeba_*.csv',  # Exclude large downloaded files
    'opus_*.zip'
]

def should_include(file_path):
    """Check if file should be included in ZIP."""
    file_str = str(file_path)
    
    # Check exclude patterns
    for pattern in EXCLUDE_PATTERNS:
        if pattern in file_str or file_path.name.startswith('.'):
            return False
    
    # Check if it's a data file we want
    if file_path.suffix in ['.json', '.tsv', '.txt', '.py', '.md', '.html']:
        return True
    
    return False

def create_zip():
    """Create ZIP archive of the project."""
    print("=" * 60)
    print("Creating Language Translation Dataset ZIP Archive")
    print("Author: RSK World (https://rskworld.in)")
    print("=" * 60)
    
    # Remove existing ZIP if it exists
    if ZIP_FILE.exists():
        ZIP_FILE.unlink()
        print(f"[OK] Removed existing ZIP file")
    
    # Create ZIP file
    with zipfile.ZipFile(ZIP_FILE, 'w', zipfile.ZIP_DEFLATED) as zipf:
        # Track added files to avoid duplicates
        added_files = set()
        
        # Add all Python files
        for py_file in BASE_DIR.rglob('*.py'):
            if should_include(py_file):
                arcname = str(py_file.relative_to(BASE_DIR))
                if arcname not in added_files:
                    zipf.write(py_file, arcname)
                    added_files.add(arcname)
                    print(f"  Added: {arcname}")
        
        # Add data files
        data_dir = BASE_DIR / 'data'
        if data_dir.exists():
            for data_file in data_dir.iterdir():
                if data_file.is_file() and should_include(data_file):
                    arcname = str(data_file.relative_to(BASE_DIR))
                    if arcname not in added_files:
                        zipf.write(data_file, arcname)
                        added_files.add(arcname)
                        print(f"  Added: {arcname}")
        
        # Add documentation files
        for doc_file in BASE_DIR.glob('*.md'):
            if should_include(doc_file):
                arcname = str(doc_file.relative_to(BASE_DIR))
                if arcname not in added_files:
                    zipf.write(doc_file, arcname)
                    added_files.add(arcname)
                    print(f"  Added: {arcname}")
        
        # Add other important files
        important_files = ['index.html', 'LICENSE', 'requirements.txt', 'config.py']
        for file_name in important_files:
            file_path = BASE_DIR / file_name
            if file_path.exists():
                arcname = str(file_path.relative_to(BASE_DIR))
                if arcname not in added_files:
                    zipf.write(file_path, arcname)
                    added_files.add(arcname)
                    print(f"  Added: {arcname}")
    
    # Get file size
    file_size = ZIP_FILE.stat().st_size
    file_size_mb = file_size / (1024 * 1024)
    
    print("\n" + "=" * 60)
    print(f"[OK] ZIP archive created successfully!")
    print(f"File: {ZIP_FILE.name}")
    print(f"Size: {file_size_mb:.2f} MB ({file_size:,} bytes)")
    print(f"Location: {ZIP_FILE}")
    print("=" * 60)

if __name__ == '__main__':
    create_zip()

135 lines•4.1 KB
python
scripts/convert_format.py
Raw Download
Find: Go to:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Language Translation Dataset - Format Conversion Script
Author: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277
Copyright © 2016 RSK World. All rights reserved.

This script converts between TSV and JSON formats for the language translation dataset.
"""

import pandas as pd
import json
import argparse
from pathlib import Path

def convert_tsv_to_json(input_path, output_path):
    """
    Convert TSV file to JSON format.
    
    Args:
        input_path: Path to input TSV file
        output_path: Path to output JSON file
    """
    print(f"Converting TSV to JSON...")
    print(f"Input: {input_path}")
    print(f"Output: {output_path}")
    
    # Load TSV
    df = pd.read_csv(input_path, sep='\t', encoding='utf-8')
    print(f"Loaded {len(df)} rows from TSV")
    
    # Convert to JSON
    data = df.to_dict('records')
    
    # Save JSON
    with open(output_path, 'w', encoding='utf-8') as f:
        json.dump(data, f, ensure_ascii=False, indent=4)
    
    print(f"Successfully converted to JSON: {len(data)} records")

def convert_json_to_tsv(input_path, output_path):
    """
    Convert JSON file to TSV format.
    
    Args:
        input_path: Path to input JSON file
        output_path: Path to output TSV file
    """
    print(f"Converting JSON to TSV...")
    print(f"Input: {input_path}")
    print(f"Output: {output_path}")
    
    # Load JSON
    with open(input_path, 'r', encoding='utf-8') as f:
        data = json.load(f)
    print(f"Loaded {len(data)} records from JSON")
    
    # Convert to DataFrame
    df = pd.DataFrame(data)
    
    # Save TSV
    df.to_csv(output_path, sep='\t', index=False, encoding='utf-8')
    
    print(f"Successfully converted to TSV: {len(df)} rows")

def main():
    """Main conversion function."""
    parser = argparse.ArgumentParser(
        description='Convert between TSV and JSON formats for language translation dataset',
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog="""
Examples:
  python convert_format.py --input data/train.tsv --output data/train.json
  python convert_format.py --input data/train.json --output data/train.tsv
        """
    )
    
    parser.add_argument(
        '--input',
        type=str,
        required=True,
        help='Input file path (TSV or JSON)'
    )
    
    parser.add_argument(
        '--output',
        type=str,
        required=True,
        help='Output file path (TSV or JSON)'
    )
    
    args = parser.parse_args()
    
    input_path = Path(args.input)
    output_path = Path(args.output)
    
    # Check if input file exists
    if not input_path.exists():
        print(f"Error: Input file not found: {input_path}")
        return
    
    # Determine conversion direction
    input_ext = input_path.suffix.lower()
    output_ext = output_path.suffix.lower()
    
    print("=" * 60)
    print("Language Translation Dataset - Format Converter")
    print("Author: RSK World (https://rskworld.in)")
    print("=" * 60)
    
    if input_ext == '.tsv' and output_ext == '.json':
        convert_tsv_to_json(input_path, output_path)
    elif input_ext == '.json' and output_ext == '.tsv':
        convert_json_to_tsv(input_path, output_path)
    else:
        print(f"Error: Unsupported conversion from {input_ext} to {output_ext}")
        print("Supported conversions: TSV <-> JSON")
        return
    
    print("=" * 60)
    print("Conversion complete!")
    print("=" * 60)

if __name__ == '__main__':
    main()

130 lines•3.6 KB
python
🚀 Support RSK World

Subscribe to our YouTube channel for latest tutorials & updates!



Click subscribe & support our work ❤️

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer