Skip to main content

vi-fix 🛠️

vi-fix là một thư viện Python mã nguồn mở siêu nhẹ (Zero Dependency), được tối ưu hóa để xử lý các bài toán đặc thù của Tiếng Việt như chuẩn hóa dấu, bỏ dấu, xử lý CCCD, nhà mạng và dữ liệu hành chính mới nhất.

🔗 Tài liệu hướng dẫn chi tiết: https://lib.mscrew.io.vn/vi-fix/py


✨ Tính năng nổi bật

  • Siêu nhẹ: Dung lượng chỉ khoảng 5KB, không phụ thuộc vào thư viện bên thứ ba.
  • Cập nhật 2026: Danh sách 34 tỉnh thành mới nhất theo phân cấp hành chính Việt Nam.
  • Thông minh: Phân tích sâu dữ liệu từ số CCCD (Giới tính, Năm sinh, Tỉnh thành).
  • Tiện lợi: Tên hàm ngắn gọn (fix, nosign, clean...), dễ nhớ, dễ gõ.

🚀 Cài đặt

Cài đặt thông qua pip:

pip install vi-fix

📖 Hướng dẫn sử dụng

Nên sử dụng biệt danh vf để mã nguồn của bạn gọn gàng hơn:

import vi_fix as vf

# 1. Chuẩn hóa dấu (hoà -> hòa)
print(vf.fix("Khánh Hoà bình yên")) # Output: Khánh Hòa bình yên

# 2. Bỏ dấu Tiếng Việt
print(vf.nosign("Tiếng Việt có dấu")) # Output: Tieng Viet co dau

# 3. Phân tích CCCD (12 số)
info = vf.parse_cccd("037098000123")
print(info) 
# Output: {'gender': 'Nam', 'birth_year': 1998, 'province_code': '037', 'valid': True}

# 4. Kiểm tra nhà mạng
print(vf.get_telco("0961234567")) # Output: Viettel

# 5. Định dạng tiền tệ
print(vf.money(1500000)) # Output: 1.500.000đ

# 6. Đọc số thành chữ
print(vf.num2str("102", lang="vi")) # Output: một không hai

# 7. Danh sách 34 tỉnh thành (Update 2026)
provinces = vf.get_provinces()
print(len(provinces)) # Output: 34

🛠️ Danh sách 15 hàm tiện ích

Hàm Mô tả
fix(text) Sửa vị trí đặt dấu thanh chuẩn (hoà -> hòa).
nosign(text) Chuyển văn bản có dấu thành không dấu.
clean(text) Loại bỏ khoảng trắng thừa giữa các từ.
slug(text) Tạo chuỗi định danh (slug) cho URL.
v_caps(text) Viết hoa chuẩn tên riêng Tiếng Việt.
is_vi(text) Kiểm tra văn bản có chứa ký tự Tiếng Việt không.
num2str(num, lang) Chuyển dãy số thành chữ (Hỗ trợ vi/en).
money(amount) Định dạng số thành tiền tệ VNĐ (1.000.000đ).
clean_phone(phone) Chuẩn hóa mọi định dạng SĐT về đầu số 0.
get_telco(phone) Nhận diện nhà mạng từ số điện thoại.
get_provinces(format) Lấy danh sách 34 tỉnh thành (list/json/str).
is_email(email) Kiểm tra định dạng email hợp lệ.
is_cccd(number) Kiểm tra định dạng CCCD 12 chữ số.
parse_cccd(cccd) Phân tích Giới tính, Năm sinh, Tỉnh từ CCCD.
gen_pass(length) Tạo mật khẩu/OTP ngẫu nhiên nhanh.

📄 Giấy phép (License)

Dự án này sử dụng giấy phép MIT License - Bạn có quyền tự do sử dụng, sửa đổi và phân phối.

✍️ Tác giả

Phát triển bởi MinhSangGD

Cũng có sẵn phiên bản dành cho JavaScript

Metadata

Release files for vi-fix 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vi-fix 1.0.0
File Size Uploaded Provenance Actions
vi_fix-1.0.0.tar.gz 6.1 kB Without provenance Details for vi_fix-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vi-fix 1.0.0
File Interpreter ABI Platform Actions
vi_fix-1.0.0-py3-none-any.whl Python 3 none any Details for vi_fix-1.0.0-py3-none-any.whl

Total release size: 12.3 kB

Release files / vi_fix-1.0.0.tar.gz

Download URL vi_fix-1.0.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
26fd65c7fe29e855d3c2bfa7151aa3b27ed5ab51c856526ee26faa4701e7d33e
BLAKE2b-256 checksum
How to use checksums
2f8db60591305729de958f221b81ad10d29791342409deb916afebb038a3be8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / vi_fix-1.0.0-py3-none-any.whl

Download URL vi_fix-1.0.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
980ee77c0ff1d71974ff75932f9f53e4d8944c86372a9d95184726ff9682565a
BLAKE2b-256 checksum
How to use checksums
17ba23dcd7ddd69f3222f5a0a5d5668663b15da3b83452d8ae127c8195f1e4b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for vi-fix 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page