Crate logicaffeine_lexicon

Crate logicaffeine_lexicon 

Source
Expand description

English vocabulary types and runtime lexicon loading.

This crate provides the core lexicon infrastructure for the logicaffeine English-to-First-Order-Logic transpiler. It defines the type system for representing linguistic knowledge and optionally provides runtime lexicon loading for faster development iteration.

§Core Types

The types module defines the fundamental linguistic categories:

§Architecture

The lexicon supports two modes of operation:

  1. Compile-time (default): The main logicaffeine_language crate generates Rust code from lexicon.json at build time, providing type-safe lookups with zero runtime parsing overhead.

  2. Runtime (feature dynamic-lexicon): The runtime module loads and parses lexicon.json at runtime, trading compile-time safety for faster edit-compile cycles during development.

§Feature Flags

FeatureDescription
dynamic-lexiconEnable runtime JSON lexicon loading via the runtime module

§Example

use logicaffeine_lexicon::{VerbClass, Feature, Sort};

// Check verb aspectual properties
let class = VerbClass::Activity;
assert!(!class.is_stative());
assert!(class.is_durative());

// Parse features from strings
let feature = Feature::from_str("Transitive");
assert_eq!(feature, Some(Feature::Transitive));

// Check sort compatibility
assert!(Sort::Human.is_compatible_with(Sort::Animate));

Re-exports§

pub use types::*;

Modules§

runtime
Runtime JSON-based lexicon loading (requires dynamic-lexicon feature).
types
Lexicon type definitions for grammatical and semantic categories. Lexicon type definitions