word2vec/lib.rs
1//! # word2vec
2//!
3//! A Word2Vec implementation in Rust supporting both
4//! Skip-gram and CBOW architectures with Negative Sampling.
5//!
6//! ## Architecture
7//!
8//! - [`vocab`] — Vocabulary construction, subsampling, and unigram noise table
9//! - [`model`] — Skip-gram and CBOW forward/backward pass
10//! - [`trainer`] — Training loop with monitoring and checkpointing
11//! - [`embeddings`] — Post-training embedding access, similarity, analogy
12//! - [`config`] — Hyperparameter configuration
13//! - [`error`] — Unified error type
14//! - [`plot`] — Loss curves and 2D PCA projection plots
15//!
16//! ## Quick Start
17//!
18//! ```rust,no_run
19//! use word2vec::{Config, ModelType, Trainer};
20//!
21//! let config = Config {
22//! embedding_dim: 100,
23//! window_size: 5,
24//! negative_samples: 5,
25//! epochs: 5,
26//! model: ModelType::SkipGram,
27//! ..Config::default()
28//! };
29//!
30//! let corpus = vec![
31//! "the quick brown fox jumps over the lazy dog".to_string(),
32//! ];
33//!
34//! let mut trainer = Trainer::new(config);
35//! let embeddings = trainer.train(&corpus).unwrap();
36//!
37//! let similar = embeddings.most_similar("fox", 5);
38//! println!("{:?}", similar);
39//! ```
40
41pub mod config;
42pub mod embeddings;
43pub mod error;
44pub mod model;
45pub mod plot;
46pub mod trainer;
47pub mod vocab;
48
49pub use config::{Config, ModelType};
50pub use embeddings::Embeddings;
51pub use error::Word2VecError;
52pub use trainer::Trainer;