MCPcopy Index your code
hub / github.com/clips/pattern / __init__

Method __init__

pattern/text/__init__.py:259–275  ·  view source on GitHub ↗

A list of rules based on word morphology (prefix, suffix).

(self, lexicon={}, path="")

Source from the content-addressed store, hash-verified

257class Morphology(lazylist, Rules):
258
259 def __init__(self, lexicon={}, path=""):
260 """ A list of rules based on word morphology (prefix, suffix).
261 """
262 cmd = ("char", # Word contains x.
263 "haspref", # Word starts with x.
264 "hassuf", # Word end with x.
265 "addpref", # x + word is in lexicon.
266 "addsuf", # Word + x is in lexicon.
267 "deletepref", # Word without x at the start is in lexicon.
268 "deletesuf", # Word without x at the end is in lexicon.
269 "goodleft", # Word preceded by word x.
270 "goodright", # Word followed by word x.
271 )
272 cmd = dict.fromkeys(cmd, True)
273 cmd.update(("f" + k, v) for k, v in cmd.items())
274 Rules.__init__(self, lexicon, cmd)
275 self._path = path
276
277 @property
278 def path(self):

Callers

nothing calls this directly

Calls 4

fromkeysMethod · 0.45
updateMethod · 0.45
itemsMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected