Crates.io | rhyme-type |
lib.rs | rhyme-type |
version | 0.1.0 |
source | src |
created_at | 2024-11-09 17:21:00.458675 |
updated_at | 2024-11-09 17:21:00.458675 |
description | A crate for representing and generating different types of rhymes. |
homepage | https://github.com/klebs6/klebs-general |
repository | https://github.com/klebs6/klebs-general |
max_upload_size | |
id | 1442238 |
size | 37,415 |
The rhyme-type
crate provides enums and utilities for representing different types of rhymes, rhyme schemes, positions, stresses, and special rhyme forms. It's designed for applications that generate or analyze poetry, lyrics, or other rhyming text.
serde
.Add the following to your Cargo.toml
:
[dependencies]
rhyme-type = "0.1.0"
Then, include it in your crate root:
extern crate rhyme_type;
Here's a basic example of how to use the rhyme-type
crate:
use rhyme_type::RhymeType;
fn main() {
// Generate a random rhyme type
let rhyme_type = RhymeType::random();
// Print the rhyme type details
println!("{:#?}", rhyme_type);
// Generate a description of the rhyme type
let description = rhyme_type.generate_description();
println!("{}", description);
}
Sample Output:
RhymeType {
quality: Perfect,
position: Some(End),
stress: None,
scheme: Some(Couplet),
special: None,
}
Use perfect rhymes, where both consonant and vowel sounds match exactly. The rhymes should occur at the end of lines. Follow a couplet rhyme scheme (AABB).
You can generate a random RhymeType
using the random
method:
use rhyme_type::RhymeType;
let rhyme_type = RhymeType::random();
Generate a description suitable for instructing an AI or for documentation:
let description = rhyme_type.generate_description();
println!("{}", description);
Represents the quality of the rhyme based on sound similarity.
Variants:
Perfect
: Exact match of sounds in both consonants and vowels.Slant
: Similar but not identical sounds.Eye
: Words that look like they should rhyme but don't.Identical
: Using the same word twice in rhyming positions.Rich
: Rhyme using homonyms.Wrenched
: Forcing a rhyme by distorting pronunciation.Light
: Rhyming of a stressed syllable with an unstressed syllable.MultiSyllabic
: Rhyming involving multiple syllables.Compound
: Rhyming of two or more compound words.Broken
: Rhyme using a hyphenated word or a word broken across lines.Macaronic
: Rhyme with words from different languages.Indicates the position of the rhyme within the line or stanza.
Variants:
End
: Rhyming at the end of lines.Internal
: Rhyming within a single line of verse.Head
: Rhyming of the initial sounds (alliteration).Interlaced
: Rhyming words appear in the middle of one line and at the end of the next.Linked
: Rhyming the end of one stanza with the beginning of the next.Holorhyme
: Rhyming entire lines with each other.Tail
: Rhyming of the final words of lines, especially in concluding lines.Represents syllable stress patterns in the rhyme.
Variants:
Masculine
: Rhyming of the final stressed syllable.Feminine
: Rhyming of the final two syllables, with the penultimate syllable stressed.Triple
: Rhyming of the final three syllables, with the first syllable stressed.Defines specific rhyme schemes.
Variants:
Couplet
: AABBAlternate
: ABABEnclosed
: ABBAChain
: ABA BCB CDC...Monorhyme
: AAAALimerick
: AABBAVillanelle
: ABA ABA ABA ABA ABA ABAASonnetShakespearean
: ABAB CDCD EFEF GGSonnetPetrarchan
: ABBA ABBA CDE CDETerzaRima
: ABA BCB CDC...Custom(String)
: Custom rhyme scheme.Includes special rhyme forms.
Variants:
Cross
: Rhyming in a cross pattern (e.g., ABBA).Sporadic
: Irregular rhyme scheme without a set pattern.FreeVerse
: No consistent rhyme.BlankVerse
: Unrhymed iambic pentameter.Enjambment
: Continuing sentences beyond line breaks.Acrostic
: First letters of lines spell out a word.RhymeType::random() -> RhymeType
: Generates a random RhymeType
.RhymeType::generate_description() -> String
: Generates a description suitable for instructing an AI or for documentation.Each enum provides:
random<R: Rng>(rng: &mut R) -> Self
: Generates a random variant.description(&self) -> String
: Provides a description of the variant.Contributions are welcome! Please follow these steps:
cargo test
.Please make sure to adhere to the existing coding style and include documentation for new features.
This project is licensed under either of
at your option.
If you have any questions or issues, please open an issue on the GitHub repository.