vidyut-chandas

Crates.iovidyut-chandas
lib.rsvidyut-chandas
version0.1.0
sourcesrc
created_at2024-05-30 05:16:47.318478
updated_at2024-05-30 05:16:47.318478
descriptionA Sanskrit metrical classifier
homepagehttps://github.com/ambuda-org/vidyut
repositoryhttps://github.com/ambuda-org/vidyut
max_upload_size
id1256526
size45,472
Arun Prasad (akprasad)

documentation

README

vidyut-chandas

A Sanskrit metrical classifier

vidyut-chandas is an experimental classifier for Sanskrit meters.

This crate is under active development as part of the Ambuda project. If you enjoy our work and wish to contribute to it, we encourage you to join our Discord server, where you can meet other Sanskrit programmers and enthusiasts.

An online demo is available here.

Overview

Sanskrit poetry uses a variety of meters, which specify the syllable patterns that a verse must follow. vidyut-chandas aims to provide a simple API for identifying the meter that a given verse uses.

vidyut-chandas is experimental code and follows in the footsteps of great projects like sanskritmetres and Skrutable.

Usage

(This API is unstable.)

We recommend using vidyut-chandas through our Chandas API:

use vidyut_chandas::{Chandas, MatchType, Vrtta};

let vrttas: Vec<Vrtta> = vec![
    "vasantatilakA\tvrtta\tGGLGLLLGLLGLGG".try_into().unwrap(),
    "mandAkrAntA\tvrtta\tGGGGLLLLLGGLGGLGG".try_into().unwrap(),
    "puzpitAgrA\tvrtta\tLLLLLLGLGLGG/LLLLGLLGLGLGG".try_into().unwrap(),
    "udgatA\tvrtta\tLLGLGLLLGL/LLLLLGLGLG/GLLLLLLGLLG/LLGLGLLLGLGLG".try_into().unwrap()
];
let chandas = Chandas::new(vrttas);

let result = chandas.classify("mAtaH samastajagatAM maDukEwaBAreH");
assert_eq!(result.vrtta().as_ref().unwrap().name(), "vasantatilakA");
assert_eq!(result.match_type(), MatchType::Pada);
Commit count: 166

cargo fmt