Detectors
Introduction
Detectors are a higher level analysis functions that run on top of processors to get a more curated and specific results. Technically, any function that utilize and analyse the tokens, POS tags, and/or dependencies can be considered a detector.
Typically, detector function should be added to the Fin.Run
function prototype. So whenever a new instance is created the detector function can be applied on the processing result which resides on the context (this
object) of the instance.
The reason that Fin has been designed to have it's detectors on the prototype, not as part of the core processors, is that the detector function might cause performance issues. So you can call detector function only when you need them.
Basic Example
A very basic example that will just return the number of sentences in a given instance.
JavaScript
TypeScript
More elaborate examples
I'm maintaining few useful detectors, have a look at them if you want more elaborate examples:
Last updated