-
-
Save heartbleeded/1ec6d57f3a2a6a96ec016b60fa61e6b5 to your computer and use it in GitHub Desktop.
Remove Vietnamese Accents - Xoá dấu tiếng việt in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| s1 = u'ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯưẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹ' | |
| s0 = u'AAAAEEEIIOOOOUUYaaaaeeeiioooouuyAaDdIiUuOoUuAaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYy' | |
| def remove_accents(input_str): | |
| s = '' | |
| print input_str.encode('utf-8') | |
| for c in input_str: | |
| if c in s1: | |
| s += s0[s1.index(c)] | |
| else: | |
| s += c | |
| return s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment