# singularity-tagger

> Portuguese POS-Tagger writen in core Node.JS, specially designed to work with streams.

Latest version **1.0.3** (published 2021-02-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install singularity-tagger
pnpm add singularity-tagger
yarn add singularity-tagger
bun add singularity-tagger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2021-02-15 |
| First published | 2021-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Lucas Ribeiro |
| Maintainers | loribeiro |
| Keywords | HMM, Viterbi, POS-Tagger, Portuguese Tagger, NLP |

## Links

- npm: https://www.npmjs.com/package/singularity-tagger
- Repository: https://github.com/loribeiro/Singularity-POS-Tagger
- Homepage: https://github.com/loribeiro/Singularity-POS-Tagger#readme
- Issues: https://github.com/loribeiro/Singularity-POS-Tagger/issues
- npm.io page: https://npm.io/package/singularity-tagger

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2021-02-15
- 1.0.2 — 2021-02-12
- 1.0.1 — 2021-02-12
- 1.0.0 — 2021-02-12

## README

# Singularity-POS-Tagger
Portuguese POS-Tagger writen in core Node.JS, without any external modules. 

I developed this library to use as base for another personal project. There are planing of room to improve accuracy with heuristics and twiks.

It's designed specially for Node.Js Streams, which can improve speed and memory use when working on servers or large corpus of data. Nonethless, one can still use a built in method to work with strings.

There is no need to pre-processing the corpus, there is a built in function that cleans everything before the POS classification.

Because the nature of JavaScript be single threaded and NLP jobs are usually very resource intense, almost everything in this package runs asynchronous.

# Installation 
In a Node.JS environment you can run on your terminal. 
>npm i singularity-tagger

# What is a POS Tagger?

A POS Tagger or Part of Speach Tagger is a piece of software that analyzes a corpus and taggs the words with it's respective gramatical class. 

# Applications of POS Taggers
  - Sentiment analysis
  - Question answering
  - Word sense disambiguation
  
Basically every Natural Language Processing task uses a POS tagger as sub task.

# Implementation 
- Model trained on Mac-Morpho's anotated corpus available on: http://nilc.icmc.usp.br/macmorpho/
- Stochastic algorithm used: 
  * Hidden Markov Model (HMM) with Viterbi Algorithm
  

- Algorithm implemented based on Stanford's document available on: https://web.stanford.edu/~jurafsky/slp3/8.pdf
  
# How to use
*__Singularity__* is designed to be used on async functions or as ECMS6 promise.
There are two main methods available:
- __analyzeString__
    * receive as parameter one string and returns an array with normalized words
    along side the tags of the string
- __analyzeStream__
    * receive as parameter an input stream and output stream and returns to the output stream the normalized text along side the tags
## Code example
- __Inside Asynchronous functions__:
    * analyzeString:
      * > const PosTagger = require("singularity-tagger") 
        >
        >...
        >
        > const tagger = await PosTagger()
        >
        > const taggedArray = await tagger.analyzeString(string)
        >
        > console.log(await taggedArray)
    * analyzeStream:
      * > const PosTagger = require("singularity-tagger") 
        >
        >...
        >
        > const tagger = await PosTagger()
        >
        > await tagger.analyzeStream(process.stdin, process.stdout) // can be any stream interface
- __Inside Synchronous functions__:
    * analyzeString:
      * > const PosTagger = require("singularity-tagger") 
        >
        >...
        >
        > PosTagger().then((tagger)=> tagger.analyzeString(string)).then(resp=> console.log()).catch(err=>console.log(err))
    * analyzeStream:
      * > const PosTagger = require("singularity-tagger") 
        >
        >...
        >
        > PosTagger().then((tagger)=> tagger.analyzeStream(inputStream, outputStream)).catch(err=>console.log(err))
  
# Tags meaning table

![image info](./assets/table.png)

---
_Source: https://npm.io/package/singularity-tagger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
