Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

findahaiku

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

findahaiku

Split up text into the lines of a haiku

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by33.33%
Maintainers
0
Weekly downloads
 
Created
Source

findahaiku

Split up text into the lines of a haiku, if it is possible to split it up into lines of 5-7-5 syllables.

If a haiku cannot be made from the text, returns an empty list.

Uses the CMU Pronouncing Dictionary (contains over 134k words, ~1MB packed) to test words for syllable counts. If a word is not in the dictionary, a haiku will not be able to be made.

Install

npm install findahaiku

Usage

import findahaiku from 'findahaiku';

findahaiku('An old silent pond, a frog jumps into the pond! Splash; silence - again...');
//=> ['An old silent pond,', 'a frog jumps into the pond!', 'Splash; silence - again...']

findahaiku('Not a haiku!');
//=> []

findahaiku('This is much much much much much much much much much much much much much much much much much much much much too long to be a haiku.');
//=> []

findahaiku('This may be a real haiku, but it contains a word that is unknnnooooowwwwnnn!');
//=> []

findahaiku('This is much much much much much much much much much much much much much much much much much much much much too long to be a haiku.', { strict: false });
//=> ['This is much much much', 'much much much much much much much', 'much much much much much']

API

findahaiku(input, options?)

input

Type: string

Text to generate a haiku from.

options

Type: object

strict

Type: boolean
Default: true

Whether to only return if the entire given text is a haiku.

If false, returns a haiku if the first part of the given text is a haiku.

Keywords

FAQs

Package last updated on 04 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc