Lua Post Processing
An Eduction Lua Post Processing task runs a Lua script that modifies the output from the Eduction module. For example, you might want to increase the score for a match if it is found near similar matches.
NOTE: The Lua script is run by the Eduction module, not by CFS. The Eduction module expects the script to start with function processmatch (edkmatch)
. You cannot modify the document being processed by CFS, or use the Lua methods that are available to CFS Lua scripts. For information about the Lua methods that are available in the Eduction module, refer to the Eduction User Guide.
To create an Eduction Lua Post Processing task, set the PostProcessingTaskN
parameter. This specifies the name of a section in the CFS configuration file that contains parameters to configure the task. For example:
[ImportTasks] Post0=Eduction:EductionSettings [EductionSettings] ResourceFiles=C:\MyGrammar\gram1.ecr SearchFields=DRECONTENT Entity0=edk_common_entities/postal_address EntityField0=SHIPPING_ADDRESS PostProcessingTask0=EductionLuaPostProcessing [EductionLuaPostProcessing] Script=scripts/eduction_post_process.lua ProcessEnMasse=False
The Eduction Lua module will call function processmatch (edkmatch)
. For example:
function processmatch(edkmatch) if edkmatch then local text = edkmatch:getOutputText() -- modify the match edkmatch:setOutputText(text) return true end return false -- return false to drop the match end
The edkmatch
argument represents a single eduction match, or the complete set of matches if you set the configuration parameter ProcessEnMasse
to true
.
If the processmatch
function returns true
, the match is returned to CFS. If the function returns false
, the match is discarded.
For more information about writing Eduction post-processing scripts, and information about the Lua methods that you can use, refer to the Eduction User Guide.