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§
- Gematria
Builder GematriaBuilder
provides a builder pattern for constructingGematriaContext
. It allows specifying the gematria calculation method, whether to enable caching, and vowel preservation. Example usage:- Gematria
Context 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.- Gematria
Result GematriaResult
represents the result of a gematria calculation, including the calculated value, the method used, and the original word.- Hebrew
Character Map HebrewCharacterMap
maps Hebrew characters to their corresponding numeric indices.- Mispar
Gadol - Mispar
Hechrechi - Mispar
Katan
Enums§
- Gematria
Method - Enumerates various gematria calculation methods. Includes traditional and specialized methods like Mispar Hechrechi and Otiyot BeMilui.
Traits§
- Gematria
Calculation - 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.