haiku 1.0.6 copy "haiku: ^1.0.6" to clipboard
haiku: ^1.0.6 copied to clipboard

Dart 1 only

Detect and create Hiakus from plain text.

Haiku #

Detect and create Haikus

Examples #

Detecting a haiku

final poem = '''
   This is my long poem. It is too long for haiku, because it's tail is quite large.
''';

final haikuPoem = '''
    An old silent pond... A frog jumps into the pond, splash! Silence again.
''';

HaikuComposer composer = new HaikuComposer();
print(composer.isHaiku(poem)); // False; 19 syllables
print(composer.isHaiku(haikuPoem)); // True

Creating a Haiku

final haiku = composer.create(haikuPoem);
print(haiku.firstLine); // ['An', 'old', 'silent', 'pond...'];
print(haiku.secondLine); // ['A', 'frog', 'jumps', 'into', 'the', 'pond'];
print(haiku.thirdLine); // ['splash!', 'Silence', 'again.'];

Printing a Haiku

print(const HaikuFormatter().format(haiku));

//  An old silent pond...
//  A frog jumps into the pond,
//  splash! Silence again.
0
likes
15
pub points
0%
popularity

Publisher

unverified uploader

Detect and create Hiakus from plain text.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

meta, packages, syllables

More

Packages that depend on haiku