GNU Dictionary Server
5.6.2 Dico Python Primitives
- Python primitive: register_strat name descr [proc]
Registers new match strategy. The arguments are:
Strategy name for use in the
The dscription, which will appear in the output of
Optional selector procedure.
If the proc argument is present, it must be the name of a Python function declared as:
def select(opcode key headword):
Its arguments are:
Integer operation code.
DicoSelectionKeyobject identifying the search term (see DicoSelectionKey).
The headword being examined.
At the beginning of the search, the function is called with the ‘DICO_SELECT_BEGIN’ as its opcode argument. It must perform the necessary initialization and return.
At the end of the search loop, the function is called with opcode ‘DICO_SELECT_END’. It must perform the necessary deinitialization procedures and exit.
In both cases, the key and headword arguments are not defined.
Within the search loop, the function will be called for each headword from the database. The opcode parameter will be ‘DICO_SELECT_RUN’. In this case the function must return ‘True’ if the headword matches the key and ‘False’ otherwise.
This document was generated on April 24, 2019 using makeinfo.Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.