huu4ontocord / rio

Text pre-processing for NLP datasets
Apache License 2.0
11 stars 6 forks source link

Load multiple supported kenlm models and check fakename #30

Closed vumichien closed 2 years ago

vumichien commented 2 years ago

I have refactored the check_fakename function and public_figure_kenlm_cutoff_map to add many cutoff patterns for each type of pretrained kenlm models. I have tested and set the cutoff threshold for 'vi' (Wikipedia:500, Oscar:450). We need to test for another language to set a better cutoff threshold.

>>> famous_name = ['Phạm Nhật Vượng', 'Nguyễn Thị Phương Thảo', 'Đoàn Nguyên Đức', 'Đặng Lê Nguyên Vũ',
               'Võ Nguyễn Hoài Linh', 'Nguyễn Thị Ánh Viên', 'Ngô Bảo Châu', 'Đàm Vĩnh Hưng','Mai Hồng Ngọc']
>>> for pretrain_model in ['wikipedia', 'oscar']:
...   print(pretrain_model)
...     for name in famous_name:
...       check_fakename('vi', pretrained_models=[pretrain_model], fake_name = name, verbose=True)
...   
wikipedia
Phạm Nhật Vượng 331.2
Nguyễn Thị Phương Thảo 355.5
Đoàn Nguyên Đức 375.2
Đặng Lê Nguyên Vũ 176.2
Võ Nguyễn Hoài Linh 253.3
Nguyễn Thị Ánh Viên 152.2
Ngô Bảo Châu 356.7
Đàm Vĩnh Hưng 479.6
Mai Hồng Ngọc 400.0

oscar
Phạm Nhật Vượng 224.2
Nguyễn Thị Phương Thảo 118.6
Đoàn Nguyên Đức 324.6
Đặng Lê Nguyên Vũ 208.4
Võ Nguyễn Hoài Linh 226.5
Nguyễn Thị Ánh Viên 199.5
Ngô Bảo Châu 440.9
Đàm Vĩnh Hưng 250.7

Let me know what you think!

huu4ontocord commented 2 years ago

nice! looks good to me!