Skip to content

Commit

Permalink
expose decompose_nfkd()
Browse files Browse the repository at this point in the history
  • Loading branch information
andkamau committed Feb 18, 2017
1 parent 4910c16 commit 8bb434f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions normality/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import six

from normality.cleaning import collapse_spaces, category_replace
from normality.cleaning import collapse_spaces, category_replace, decompose_nfkd
from normality.constants import UNICODE_CATEGORIES
from normality.transliteration import latinize_text, ascii_text
from normality.encoding import guess_encoding # noqa

WS = ' '


def normalize(text, lowercase=True, collapse=True, latinize=False, ascii=False,
def normalize(text, lowercase=True, collapse=True, latinize=False, ascii=False, decompose=False,
replace_categories=UNICODE_CATEGORIES):
"""The main normalization function for text.
Expand Down Expand Up @@ -38,6 +38,9 @@ def normalize(text, lowercase=True, collapse=True, latinize=False, ascii=False,
# Yeah I made a Python package for this.
text = text.lower()

if decompose:
text = decompose_nfkd(text)

if ascii:
# A stricter form of transliteration that leaves only ASCII
# characters.
Expand Down

0 comments on commit 8bb434f

Please sign in to comment.