fin NLP
  • Introduction
  • Installation and usage
  • Available Extension
  • Cloning and Contributing
  • In Depth look
    • Processing
    • Lexer
    • POS Tagger
    • Dependency Parser
    • Pre and Post Processing
    • Detectors
  • Annotation Specifications
    • POS Tagger
    • Dependency Parsing
Powered by GitBook
On this page
  • Introduction
  • Basic Example
  • More elaborate examples

Was this helpful?

  1. In Depth look

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 (thisobject) 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

import {Run} from "finnlp";
Run.prototype.sentencesCount = function () {
    return this.sentence.length;
}

TypeScript

import * as Fin from "finnlp";
declare module "finnlp" {
    export interface Run {
        sentencesCount: () => number;
    }
}

Fin.Run.prototype.sentencesCount = function (this:Fin.Run) {
    return this.sentences.length;
};

More elaborate examples

I'm maintaining few useful detectors, have a look at them if you want more elaborate examples:

PreviousPre and Post ProcessingNextAnnotation Specifications

Last updated 6 years ago

Was this helpful?

American vs British spelling variation detector and converter
URLs Detector
Sentiment Detector
Sentence Type Detector
Negation Detector
Emphasis Detector