Extending¶
Custom modules can be loaded via !IMPORT(<module_path>)
Example of basic fuzzy matcher:
!IMPORT("rita.modules.fuzzy")
FUZZY("squirrel") -> MARK("CRITTER")
Code can be seen in: fuzzy.py
After import is done, custom macros defined in imported module can be executed.
Interface for custom Macro¶
Each macro must have atleast two arguments
-
op
- custom handling of?
,*
and+
operators. If it has no use, argument can be defined asdef <macro>(*args, op=None)
and simply ignored inside code -
context
- context is eitherdict
orlist
type used to store results
All other arguments should be defined at the start