xkas2001/uzbek-language-dataset
Uzbek Language Dataset Collection Bu repository o'zbek tili uchun eng keng ko'lamli va keng qamrovli dataset to'plami hisoblanadi. Dataset turli manbalardan to'plangan va NLP modellari, til modellari va boshqa AI ilovalar uchun mo'ljallangan. π Dataset Overview Bu dataset to'plami 4ta asosiy qism va qo'shimcha merge qilish asboblaridan iborat: π― Dataset Qismlari Dataset Hajmi Maqsad Source community-oscar-uzbek 1.1GB OSCAR Communityβ¦ See the full description on the dataset page: https://huggingface.co/datasets/xkas2001/uzbek-language-dataset.
Uzbek Language Dataset Collection
Bu repository o'zbek tili uchun eng keng ko'lamli va keng qamrovli dataset to'plami hisoblanadi. Dataset turli manbalardan to'plangan va NLP modellari, til modellari va boshqa AI ilovalar uchun mo'ljallangan.
π Dataset Overview
Bu dataset to'plami 4ta asosiy qism va qo'shimcha merge qilish asboblaridan iborat:
π― Dataset Qismlari
π Umumiy Statistika
- Jami hajmi: ~3.4GB
- Umumiy satr soni: 4.7+ million lines
- Til: O'zbek tili (uz)
- Encoding: UTF-8
- Format: Plain text, frequency lists, word lists
ποΈ Dataset Tuzilishi
uzbek-dataset/
βββ community-oscar-uzbek/ # 1.1GB - OSCAR community data
β βββ all_metadata_text.txt # 666MB - To'liq matn to'plami
β βββ top5_metadata_text.txt # 167MB - Top 5 sifatli matnlar
β βββ uzbek_words_community.txt # 5.6MB - Community so'zlar
β βββ uzbek_words_frequency_community.txt # 9.8MB - Chastota
β βββ uzbek_words_unique_clean.txt # 4.5MB - Unique clean words
β βββ uzbek_top1000_community.txt # 7KB - Top 1000 so'zlar
β βββ data/ # Raw OSCAR data (2014-2023)
β βββ 2014-42/ to 2023-50/ # Yillik snapshot'lar
β βββ */uz_meta/ # Uzbek metadata
βββ custom-uzbek/ # 2.1GB - Custom matnlar
β βββ parsed_txt.txt # 546MB - Parsed matnlar
β βββ parsed_with_imlo.txt # 561MB - Imlo bilan qayta ishlangan
β βββ parsed_with_imlo_without_emoji.txt # 546MB - Emoji'siz
β βββ word_lists/ # So'z ro'yxatlari
β βββ words_list.txt # Barcha so'zlar
β βββ frequency_list.txt # Chastota ro'yxati
β βββ unique_words.txt # Unique so'zlar
βββ oscar-uzbek/ # 38MB - OSCAR 2301 Uzbek
β βββ uzbek_words_unique.txt # 2MB - Unique so'zlar
β βββ uzbek_words_frequency.txt # 3MB - Chastota jadval
β βββ uzbek_top1000_words.txt # 7KB - Top 1000
β βββ uzbek_words_filtered.txt # 1.6MB - Filtrlangan
β βββ uzbek_proper_nouns.txt # 376KB - Proper nouns
β βββ uz_meta/ # Metadata
βββ merge/ # 122MB - Merge tools va natijalar
βββ frequency_list.txt # 31MB - Birlashtirilgan frequency
βββ unique_words.txt # 22MB - Birlashtirilgan unique
βββ merged_data/ # Merged datasets
βββ *.py # Merge script'lariπ Dataset Tafsilotlari
1. Community OSCAR Uzbek (1.1GB)
Maqsad: OSCAR Common Crawl datasidan o'zbek tilidagi matnlarni to'plash va qayta ishlash
Asosiy fayllar:
all_metadata_text.txt(666MB, 4.7M lines): Barcha OSCAR o'zbek matnlaritop5_metadata_text.txt(167MB): Eng sifatli matnlaruzbek_words_*fayllar: Turli so'z ro'yxatlari va chastota jadvallari
Ma'lumot: 2014-2023 yillar oralig'idagi Common Crawl data asosida
2. Custom Uzbek (2.1GB)
Maqsad: Maxsus to'plangan va qayta ishlangan o'zbek matnlari
Asosiy fayllar:
parsed_txt.txt(546MB): Asosiy parsed matnlarparsed_with_imlo.txt(561MB): Imlo qoidalari qo'llanilganparsed_with_imlo_without_emoji.txt(546MB): Emoji'siz versiya
Xususiyatlari:
- Manual curation va preprocessing
- Imlo qoidalariga muvofiq qayta ishlash
- High-quality content focus
3. OSCAR Uzbek (38MB)
Maqsad: OSCAR 2301 rasmiy uzbek dataset'idan so'z ro'yxatlari
Asosiy fayllar:
uzbek_words_unique.txt: Unique so'zlaruzbek_words_frequency.txt: Chastota jadvaliuzbek_proper_nouns.txt: Proper noun'lar
4. Merge (122MB)
Maqsad: Barcha dataset'larni birlashtirish va processing
Fayllar:
frequency_list.txt(31MB): Combined frequency dataunique_words.txt(22MB): Combined unique words- Python script'lar: merge_*.py
π Foydalanish
Dataset'ni yuklash
# Repository'ni clone qilish
git clone https://huggingface.co/datasets/xkas2001/uzbek-language-dataset
cd uzbek-language-dataset
# Yoki to'g'ridan-to'g'ri fayllarni yuklash
wget https://huggingface.co/datasets/xkas2001/uzbek-language-dataset/resolve/main/community-oscar-uzbek/all_metadata_text.txtPython orqali foydalanish
from datasets import load_dataset
# Hugging Face datasets orqali yuklash
dataset = load_dataset("xkas2001/uzbek-language-dataset")
# Yoki local fayllarni o'qish
def load_uzbek_text(file_path):
with open(file_path, 'r', encoding='utf-8') as f:
return f.readlines()
# Barcha OSCAR matnlarini yuklash
oscar_texts = load_uzbek_text('community-oscar-uzbek/all_metadata_text.txt')
print(f"OSCAR lines: {len(oscar_texts)}")
# Custom matnlarni yuklash
custom_texts = load_uzbek_text('custom-uzbek/parsed_with_imlo.txt')
print(f"Custom lines: {len(custom_texts)}")So'z ro'yxatlari bilan ishlash
import json
from collections import Counter
def load_frequency_list(file_path):
"""Frequency list'ni yuklash"""
word_freq = {}
with open(file_path, 'r', encoding='utf-8') as f:
for line in f:
if '\t' in line:
word, freq = line.strip().split('\t', 1)
word_freq[word] = int(freq)
return word_freq
# Frequency data'ni yuklash
freq_data = load_frequency_list('merge/frequency_list.txt')
print(f"Total unique words: {len(freq_data)}")
print(f"Most frequent words: {list(freq_data.items())[:10]}")
# Top N so'zlarni olish
top_words = sorted(freq_data.items(), key=lambda x: x[1], reverse=True)[:1000]
print("Top 10 so'zlar:")
for word, count in top_words[:10]:
print(f"{word}: {count}")Text preprocessing
import re
from typing import List
def clean_uzbek_text(text: str) -> str:
"""O'zbek matnini tozalash"""
# Unicode normalizatsiya
import unicodedata
text = unicodedata.normalize('NFC', text)
# Keraksiz bo'sh joylarni olib tashlash
text = re.sub(r'\s+', ' ', text).strip()
# URL va email'larni olib tashlash
text = re.sub(r'http[s]?://\S+', '', text)
text = re.sub(r'\S+@\S+\.\S+', '', text)
return text
def tokenize_uzbek(text: str) -> List[str]:
"""O'zbek matnini tokenizatsiya qilish"""
# Apostrophe va tire'larni saqlab qolish
tokens = re.findall(r"[a-zA-ZΓ-ΓΏΕΕΔΔΓΓ§Δ±Δ°ΓΆΓΌΓΓ''-]+", text, re.UNICODE)
return [token.lower() for token in tokens if len(token) > 1]
# Misol ishlatish
sample_text = "O'zbekiston Respublikasi mustaqil davlat hisoblanadi."
cleaned = clean_uzbek_text(sample_text)
tokens = tokenize_uzbek(cleaned)
print(f"Cleaned: {cleaned}")
print(f"Tokens: {tokens}")π οΈ Dataset Processing
Word List yaratish
def create_word_frequency(text_files: List[str], output_file: str):
"""Bir nechta fayl asosida frequency list yaratish"""
word_counts = Counter()
for file_path in text_files:
print(f"Processing: {file_path}")
with open(file_path, 'r', encoding='utf-8') as f:
for line_num, line in enumerate(f, 1):
if line_num % 100000 == 0:
print(f" Processed {line_num} lines")
cleaned_line = clean_uzbek_text(line)
tokens = tokenize_uzbek(cleaned_line)
word_counts.update(tokens)
# Natijalarni saqlash
with open(output_file, 'w', encoding='utf-8') as f:
for word, count in word_counts.most_common():
f.write(f"{word}\t{count}\n")
print(f"Created frequency list with {len(word_counts)} unique words")
return word_counts
# Dataset'larni birlashtirish
text_files = [
'community-oscar-uzbek/all_metadata_text.txt',
'custom-uzbek/parsed_with_imlo.txt'
]
word_freq = create_word_frequency(text_files, 'combined_frequency.txt')Text quality filtering
def filter_high_quality_text(input_file: str, output_file: str, min_length=50):
"""Yuqori sifatli matnlarni filtrlash"""
quality_lines = []
with open(input_file, 'r', encoding='utf-8') as f:
for line in f:
line = line.strip()
# Minimal uzunlik
if len(line) < min_length:
continue
# Latin harflar foizi
latin_chars = sum(1 for c in line if c.isalpha() and ord(c) < 128)
latin_ratio = latin_chars / len(line) if line else 0
# O'zbek harflar foizi (apostrophe bilan)
uzbek_chars = sum(1 for c in line if c in "aeiouAEIOUoΚ»'ΔΓΌΕΓ§Δ±ΓΓΕΓΔIi")
# Quality criteria
if (latin_ratio > 0.7 and # Mostly Latin alphabet
uzbek_chars > 5 and # Has Uzbek-specific chars
line.count('.') > 0): # Has sentences
quality_lines.append(line)
# Save high-quality lines
with open(output_file, 'w', encoding='utf-8') as f:
f.writelines(line + '\n' for line in quality_lines)
print(f"Filtered {len(quality_lines)} high-quality lines")
# High-quality text filtrlash
filter_high_quality_text(
'community-oscar-uzbek/all_metadata_text.txt',
'community-oscar-uzbek/high_quality_text.txt'
)π Use Cases
1. Language Model Training
# GPT-style model uchun data preparation
def prepare_for_language_modeling(input_files, output_file, max_length=512):
"""Language modeling uchun matnlarni tayyorlash"""
import random
all_texts = []
for file_path in input_files:
with open(file_path, 'r', encoding='utf-8') as f:
texts = [clean_uzbek_text(line.strip()) for line in f
if len(line.strip()) > 50]
all_texts.extend(texts)
# Shuffle va chunk qilish
random.shuffle(all_texts)
with open(output_file, 'w', encoding='utf-8') as f:
current_chunk = ""
for text in all_texts:
if len(current_chunk + text) < max_length:
current_chunk += text + " "
else:
f.write(current_chunk.strip() + '\n')
current_chunk = text + " "
if current_chunk.strip():
f.write(current_chunk.strip() + '\n')
# Language modeling data tayyorlash
prepare_for_language_modeling([
'community-oscar-uzbek/all_metadata_text.txt',
'custom-uzbek/parsed_with_imlo.txt'
], 'uzbek_language_modeling_data.txt')2. Word Embeddings Training
# Word2Vec/FastText uchun corpus tayyorlash
def prepare_for_embeddings(input_files, output_file):
"""Word embeddings uchun corpus yaratish"""
with open(output_file, 'w', encoding='utf-8') as out_f:
for file_path in input_files:
with open(file_path, 'r', encoding='utf-8') as in_f:
for line in in_f:
cleaned = clean_uzbek_text(line.strip())
if len(cleaned) > 20: # Minimal length
tokens = tokenize_uzbek(cleaned)
if len(tokens) > 3: # Minimal token count
out_f.write(' '.join(tokens) + '\n')
# FastText training example
"""
from gensim.models import FastText
# Corpus tayyorlash
prepare_for_embeddings([
'community-oscar-uzbek/all_metadata_text.txt',
'custom-uzbek/parsed_with_imlo.txt'
], 'uzbek_embeddings_corpus.txt')
# FastText model o'qitish
sentences = []
with open('uzbek_embeddings_corpus.txt', 'r') as f:
sentences = [line.strip().split() for line in f]
model = FastText(
sentences=sentences,
vector_size=300,
window=5,
min_count=5,
workers=4,
sg=1 # Skip-gram
)
model.save('uzbek_fasttext.model')
"""3. Classification Dataset Creation
def create_classification_dataset(texts, labels, output_file):
"""Text classification uchun dataset yaratish"""
import pandas as pd
data = []
for text, label in zip(texts, labels):
cleaned_text = clean_uzbek_text(text)
if len(cleaned_text) > 30:
data.append({
'text': cleaned_text,
'label': label,
'length': len(cleaned_text),
'word_count': len(tokenize_uzbek(cleaned_text))
})
df = pd.DataFrame(data)
df.to_csv(output_file, index=False, encoding='utf-8')
print(f"Created classification dataset with {len(df)} samples")
print(f"Label distribution:\n{df['label'].value_counts()}")
# Topic classification uchun misol
# Bu yerda siz o'z topic labeling logikangizni yozasizπ Dataset Sifat Nazorati
Statistical Analysis
import matplotlib.pyplot as plt
import seaborn as sns
from collections import Counter
import numpy as np
def analyze_dataset_quality(file_path):
"""Dataset sifatini tahlil qilish"""
line_lengths = []
word_counts = []
char_distribution = Counter()
total_lines = 0
with open(file_path, 'r', encoding='utf-8') as f:
for line in f:
total_lines += 1
line = line.strip()
line_lengths.append(len(line))
words = tokenize_uzbek(line)
word_counts.append(len(words))
# Character distribution
char_distribution.update(line.lower())
if total_lines % 100000 == 0:
print(f"Analyzed {total_lines} lines")
# Statistics
stats = {
'total_lines': total_lines,
'avg_line_length': np.mean(line_lengths),
'median_line_length': np.median(line_lengths),
'avg_word_count': np.mean(word_counts),
'median_word_count': np.median(word_counts),
'most_common_chars': char_distribution.most_common(20)
}
return stats, line_lengths, word_counts
# Analysis running
stats, lengths, word_counts = analyze_dataset_quality(
'community-oscar-uzbek/all_metadata_text.txt'
)
print("Dataset Statistics:")
for key, value in stats.items():
if key != 'most_common_chars':
print(f"{key}: {value}")
print("\nMost common characters:")
for char, count in stats['most_common_chars']:
print(f"'{char}': {count}")Visualization
def visualize_dataset_stats(lengths, word_counts, output_dir='plots'):
"""Dataset statistikalarini vizualizatsiya qilish"""
import os
os.makedirs(output_dir, exist_ok=True)
plt.style.use('seaborn-v0_8')
# Line length distribution
plt.figure(figsize=(12, 5))
plt.subplot(1, 2, 1)
plt.hist(lengths, bins=50, alpha=0.7, color='skyblue', edgecolor='black')
plt.title('Line Length Distribution')
plt.xlabel('Characters')
plt.ylabel('Frequency')
plt.axvline(np.mean(lengths), color='red', linestyle='--',
label=f'Mean: {np.mean(lengths):.1f}')
plt.legend()
# Word count distribution
plt.subplot(1, 2, 2)
plt.hist(word_counts, bins=50, alpha=0.7, color='lightgreen', edgecolor='black')
plt.title('Word Count Distribution')
plt.xlabel('Words')
plt.ylabel('Frequency')
plt.axvline(np.mean(word_counts), color='red', linestyle='--',
label=f'Mean: {np.mean(word_counts):.1f}')
plt.legend()
plt.tight_layout()
plt.savefig(f'{output_dir}/dataset_distribution.png', dpi=300, bbox_inches='tight')
plt.show()
# Visualization
visualize_dataset_stats(lengths, word_counts)π Quality Metrics
Dataset Quality Scorecard
Recommended Usage
- Language Modeling:
all_metadata_text.txt+parsed_with_imlo.txt - Word Embeddings: Combined frequency lists
- Classification: High-quality filtered texts
- Research: Full dataset with metadata
π§ Tools va Scripts
Repository'da qo'shimcha tool'lar mavjud:
Merge Scripts
# So'z ro'yxatlarini birlashtirish
cd merge/
python merge_wordlists.py
# Frequency list'larni birlashtirish
python merge_frequency_lists.pyCustom Processing
# custom-uzbek/process_words.py
# Maxsus so'z qayta ishlash script'i
python custom-uzbek/process_words.pyπ Performance Benchmarks
Loading Times
Processing Throughput
- Text cleaning: ~500K lines/min
- Tokenization: ~300K lines/min
- Frequency counting: ~200K lines/min
π¨ Limitations va Considerations
Known Issues
- OSCAR Data Quality: Web crawl data contains noise and potentially inappropriate content
- Encoding Variations: Some historical texts may have encoding artifacts
- Domain Bias: Heavy representation of web content vs. literary texts
- Temporal Distribution: More recent content than historical
Usage Recommendations
- Filtering: Always apply quality filters for production use
- Validation: Manual spot-checking recommended
- Preprocessing: Use provided cleaning functions
- Memory Management: Process large files in chunks
- Backup: Keep original data for reproducibility
π€ Contributing
Dataset Improvements
Dataset'ni yaxshilash uchun contribution'lar welcome:
- Quality Filtering: Yangi filter algoritmlari
- Data Cleaning: Tozalash script'larini yaxshilash
- Metadata Addition: Qo'shimcha metadata qo'shish
- Domain Expansion: Yangi domain'lardan data qo'shish
Code Contributions
# Repository'ni fork qiling
git fork https://github.com/xkas2001/uzbek-dataset
# Feature branch yarating
git checkout -b feature/new-improvement
# O'zgarishlarni commit qiling
git commit -m "Add: new data cleaning improvements"
# Pull request yarating
git push origin feature/new-improvementπ License
Bu dataset Apache 2.0 litsenziyasi ostida tarqatiladi.
OSCAR Data: CC0-1.0 (metadata va annotations) Custom Collections: Apache 2.0 Processing Scripts: MIT License
β οΈ Muhim: OSCAR data Common Crawl'dan olingan bo'lib, original mualliflar copyright'ga ega bo'lishi mumkin.
π Acknowledgments
- OSCAR Project: Multilingual corpus yaratgani uchun
- Common Crawl: Web data'ni ochiq qilgani uchun
- Uzbek Language Community: Data curation va feedback
- Contributors: Dataset yaxshilashda yordam berganlar
π Contact
Maintainer: @xkas2001 Issues: GitHub Issues orqali Discussions: Hugging Face Discussions
Repository: https://huggingface.co/datasets/xkas2001/uzbek-language-dataset Total Size: ~3.4GB Languages: Uzbek (uz) Last Updated: 2025-09-08 Version: 1.0.0
