classify-poetry
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

classify-poetry

NPM Version Build status

recognize the type of poetry in a given excerpt

Installation

This package is ESM only: Node 14+ is needed to use it and it must be imported instead of required.

npm install classify-poetry

Usage

Classify Poetry

import { classifyPoetry } from "classify-poetry";
const types = classifyPoetry(
  "detect a haiku \n pleased to do, says algorithm \n thanks algorithm"
);
console.log(types); // ["haiku"]

Detect Specific Type

ABC

import { abc } from "classify-poetry";
abc(sampleText); // => true or false

http://www.poeticterminology.net/01-abc-poem.htm

Couplet

import { couplet } from "classify-poetry";
couplet(sampleText); // => true or false

https://en.wikipedia.org/wiki/Couplet

Haiku

import { haiku } from "classify-poetry";
haiku(sampleText); // => true or false

https://en.wikipedia.org/wiki/Haiku_in_English

Limerick

import { limerick } from "classify-poetry";
limerick(sampleText); // => true or false

https://en.wikipedia.org/wiki/Limerick_(poetry)

Quatrain

import { quatrain } from "classify-poetry";
quatrain(sampleText); // => true or false

https://en.wikipedia.org/wiki/Quatrain

Sonnet

import { sonnet } from "classify-poetry";
sonnet(sampleText); // => true or false

https://en.wikipedia.org/wiki/Sonnet

Tanka

import { tanka } from "classify-poetry";
tanka(sampleText); // => true or false

https://en.wikipedia.org/wiki/Tanka

Terza Rima

import { terzaRima } from "classify-poetry";
terzaRima(sampleText); // => true or false

https://en.wikipedia.org/wiki/Terza_rima

Package Sidebar

Install

npm i classify-poetry

Weekly Downloads

7

Version

2.0.0

License

MIT

Unpacked Size

17.7 kB

Total Files

35

Last publish

Collaborators

  • christianmurphy