MCPcopy Create free account
hub / github.com/clips/pattern / normalize

Function normalize

pattern/text/en/wordnet/__init__.py:66–79  ·  view source on GitHub ↗

Normalizes the word for synsets() or Sentiwordnet[] by removing diacritics (PyWordNet does not take unicode).

(word)

Source from the content-addressed store, hash-verified

64}
65
66def normalize(word):
67 """ Normalizes the word for synsets() or Sentiwordnet[] by removing diacritics
68 (PyWordNet does not take unicode).
69 """
70 if not isinstance(word, basestring):
71 word = str(word)
72 if not isinstance(word, str):
73 try: word = word.encode("utf-8", "ignore")
74 except:
75 pass
76 for k, v in DIACRITICS.items():
77 for v in v:
78 word = word.replace(v, k)
79 return word
80
81### SYNSET #########################################################################################
82

Callers 3

synsetsFunction · 0.70
__getitem__Method · 0.70
getMethod · 0.70

Calls 3

strFunction · 0.85
encodeMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…