|
|
|
|
|
""" |
|
|
Build the complete UVW 2026 dataset. |
|
|
|
|
|
UVW 2026: Underthesea Vietnamese Wikipedia Dataset |
|
|
https://github.com/undertheseanlp/underthesea/issues/896 |
|
|
|
|
|
This script runs the entire pipeline: |
|
|
1. Download Vietnamese Wikipedia dump |
|
|
2. Extract and clean articles |
|
|
3. Create train/dev/test splits |
|
|
4. Prepare for HuggingFace Hub |
|
|
""" |
|
|
|
|
|
import subprocess |
|
|
import sys |
|
|
from pathlib import Path |
|
|
|
|
|
|
|
|
SCRIPTS_DIR = Path(__file__).parent |
|
|
|
|
|
|
|
|
def run_script(script_name: str) -> bool: |
|
|
"""Run a Python script and return success status.""" |
|
|
script_path = SCRIPTS_DIR / script_name |
|
|
print(f"\n{'='*60}") |
|
|
print(f"Running: {script_name}") |
|
|
print(f"{'='*60}\n") |
|
|
|
|
|
result = subprocess.run([sys.executable, str(script_path)]) |
|
|
return result.returncode == 0 |
|
|
|
|
|
|
|
|
def main(): |
|
|
"""Build the complete UVW 2026 dataset.""" |
|
|
print("=" * 60) |
|
|
print("UVW 2026: Underthesea Vietnamese Wikipedia Dataset") |
|
|
print("=" * 60) |
|
|
|
|
|
scripts = [ |
|
|
"download_wikipedia.py", |
|
|
"extract_articles.py", |
|
|
"create_splits.py", |
|
|
"prepare_huggingface.py", |
|
|
] |
|
|
|
|
|
for script in scripts: |
|
|
success = run_script(script) |
|
|
if not success: |
|
|
print(f"\nError running {script}. Stopping pipeline.") |
|
|
sys.exit(1) |
|
|
|
|
|
print("\n" + "=" * 60) |
|
|
print("Dataset build complete!") |
|
|
print("=" * 60) |
|
|
|
|
|
|
|
|
data_dir = SCRIPTS_DIR.parent / "data" |
|
|
print(f"\nOutput locations:") |
|
|
print(f" - Raw dump: {data_dir / 'raw'}") |
|
|
print(f" - Processed: {data_dir / 'processed'}") |
|
|
print(f" - Splits: {data_dir / 'splits'}") |
|
|
print(f" - HuggingFace: {data_dir / 'huggingface'}") |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |
|
|
|