Last active
June 25, 2017 20:18
-
-
Save shunfan/5847732 to your computer and use it in GitHub Desktop.
Revisions
-
Shunfan Du revised this gist
Jun 24, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # coding=utf-8 """ Slugify for Chinese 没有优化多音字 优化多音字的项目有: https://github.com/jiedan/chinese_pinyin -
Shunfan Du revised this gist
Jun 24, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,9 @@ import unidecode def slugify(str): return re.sub(r'\s+', '-', unidecode.unidecode(str).lower().strip()) # Test print slugify(u"测试") # >>> ce-shi -
Shunfan Du revised this gist
Jun 24, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,5 +10,6 @@ def slugify(str): return re.sub(r"\s+", '-', unidecode.unidecode(str).lower().strip()) # Test print slugify(u"测试") -
Shunfan Du revised this gist
Jun 24, 2013 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,9 @@ # coding=utf-8 """ 没有优化多音字 优化多音字的项目有: https://github.com/jiedan/chinese_pinyin """ import re import unidecode -
Shunfan Du revised this gist
Jun 24, 2013 . 1 changed file with 2 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,10 +3,7 @@ import unidecode def slugify(str): return re.sub(r"\s+", '-', unidecode.unidecode(str).lower().strip()) # Test print slugify(u"测试") -
Shunfan Du revised this gist
Jun 24, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ # coding=utf-8 import re import unidecode @@ -8,4 +9,4 @@ def slugify(str): return str # Test print slugify(u"测试") -
Shunfan Du revised this gist
Jun 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,4 +8,4 @@ def slugify(str): return str # Test slugify(u"测试") -
Shunfan Du revised this gist
Jun 24, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,4 +8,4 @@ def slugify(str): return str # Test slugify(u"试试") -
Shunfan Du created this gist
Jun 24, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ import re import unidecode def slugify(str): str = unidecode.unidecode(str).lower() str = str.strip() str = re.sub(r"\s+", '-', str) return str # Test slugify("试试")