Skip to content

๐Ÿ” [Detector] Sentence type detection for FIN

Notifications You must be signed in to change notification settings

FinNLP/fin-sentence-type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Fin-sentence-type

Sentence type detection for Fin natural language processor.

There are 4 possible sentence types:

  • Declarative, example: I will go to the book store.
  • Interrogative, example: Will you go to the book store?.
  • Exclamatory, example: Alex went to the book store!.
  • Imperative, example: go to the book store.

Note: it works even when the sentence end punctuation (e.g. ".", "?", "!") isn't there.

Note: The sentences Would you go to the book store? and could you open the door? will be considered both imperative and interrogative, however, you'll see a confidence score of it being interrogative more than imperative.

Installation

npm i --save fin-sentence-type

Usage

import * as Fin from "finnlp";
import "fin-sentence-type";

const a = new Fin.Run("I'll go to the book store").sentenceType();
const b = new Fin.Run("should I go to the book store").sentenceType();
const c = new Fin.Run("Send the mail tonight");
const d = new Fin.Run("wow, that was awesome");

console.log(a);
console.log(b);
console.log(c);
console.log(d);

The above example would give the following result

[
    // each sentence will have an array of the possible types
    [
        {
            type:"declarative",
            confidence:80
        }
    ]
]
[
    [
        {
            type:"interrogative",
            confidence:70
        }
    ]
]
[
    [
        {
            type:"imperative",
            confidence:80
        }
    ]
]
[
    [
        {
            type:"exclamatory",
            confidence:30
        }
    ]
]

About

๐Ÿ” [Detector] Sentence type detection for FIN

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published