Crate gematria_rs

Source
Expand description

Gematria-rs Library API

This module provides an implementation of the Gematria, a traditional Hebrew numerology system. It supports various methods such as Mispar Hechrechi, Mispar Gadol, Mispar Katan, and Otiyot BeMilui.

The core functionality is encapsulated in the GematriaContext struct, which offers methods to calculate gematria values for Hebrew characters and words. It supports optional caching for improved performance and can be configured to preserve or remove Hebrew vowels in the calculations.

GematriaBuilder facilitates a flexible construction of GematriaContext with various configuration options.

Example usage:

use gematria_rs::{GematriaBuilder, GematriaMethod};

let gmctx = GematriaBuilder::new()
    .with_method(GematriaMethod::MisparHechrechi)
    .with_cache(true)
    .with_vowels(true)
    .init_gematria();

let hello = "שָׁלוֹם";
let res_1 = gmctx.calculate_value(hello);
println!("Gematria value: {}", res_1.value());
// The word original vowels preserved on the result
let hello_without_vowels = "שלום";
let res_2 = gmctx.calculate_value(hello_without_vowels);
assert_eq!(res_1.word(), hello);
assert_ne!(res_1.word(), hello_without_vowels);
assert_eq!(res_1.value(), res_2.value());

Author: Amit Shmulevitch

Structs§

GematriaBuilder
GematriaBuilder provides a builder pattern for constructing GematriaContext. It allows specifying the gematria calculation method, whether to enable caching, and vowel preservation. Example usage:
GematriaContext
GematriaContext holds the core logic for gematria calculations. It encapsulates the mapping of Hebrew characters to their numeric values and the chosen calculation strategy. Optionally, it can cache calculated values for improved performance and handle vowel preservation in input words.
GematriaResult
GematriaResult represents the result of a gematria calculation, including the calculated value, the method used, and the original word.
HebrewCharacterMap
HebrewCharacterMap maps Hebrew characters to their corresponding numeric indices.
MisparGadol
MisparHechrechi
MisparKatan

Enums§

GematriaMethod
Enumerates various gematria calculation methods. Includes traditional and specialized methods like Mispar Hechrechi and Otiyot BeMilui.

Traits§

GematriaCalculation
A trait defining the common functionality for gematria calculations.

Functions§

std_gematria_value
Calculates the standard gematria value for a given Hebrew letter based on its index.

Type Aliases§

CharMap
FullCharMap