Skip to main content

logicaffeine_lexicon/
types.rs

1//! Lexicon type definitions
2//!
3//! Core types used by the generated lexicon lookup functions.
4
5/// Article definiteness for noun phrases.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7pub enum Definiteness {
8    /// The referent is uniquely identifiable ("the").
9    Definite,
10    /// The referent is not uniquely identifiable ("a", "an").
11    Indefinite,
12    /// The referent is near the speaker ("this", "these").
13    Proximal,
14    /// The referent is far from the speaker ("that", "those").
15    Distal,
16}
17
18/// Temporal reference for verb tense.
19#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
20pub enum Time {
21    /// Event occurred before speech time.
22    Past,
23    /// Event overlaps with speech time.
24    Present,
25    /// Event occurs after speech time.
26    Future,
27    /// No temporal specification (infinitives, bare stems).
28    None,
29}
30
31/// Grammatical aspect (viewpoint aspect).
32#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
33pub enum Aspect {
34    /// Event viewed as a whole, completed action.
35    Simple,
36    /// Event viewed as ongoing, in progress.
37    Progressive,
38    /// Event completed with present relevance.
39    Perfect,
40}
41
42/// Vendler's Lexical Aspect Classes (Aktionsart)
43#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Hash)]
44pub enum VerbClass {
45    /// +static, +durative, -telic: know, love, exist
46    State,
47    /// -static, +durative, -telic: run, swim, drive
48    #[default]
49    Activity,
50    /// -static, +durative, +telic: build, draw, write
51    Accomplishment,
52    /// -static, -durative, +telic: win, find, die
53    Achievement,
54    /// -static, -durative, -telic: knock, cough, blink
55    Semelfactive,
56}
57
58impl VerbClass {
59    /// Returns true if this is a stative verb class (no change of state).
60    ///
61    /// States denote properties or relations that hold without change: "know", "love", "exist".
62    pub fn is_stative(&self) -> bool {
63        matches!(self, VerbClass::State)
64    }
65
66    /// Returns true if this verb class denotes events with duration.
67    ///
68    /// Durative events: States, Activities, and Accomplishments all have temporal extent.
69    /// Non-durative: Achievements and Semelfactives are punctual.
70    pub fn is_durative(&self) -> bool {
71        matches!(
72            self,
73            VerbClass::State | VerbClass::Activity | VerbClass::Accomplishment
74        )
75    }
76
77    /// Returns true if this verb class has an inherent endpoint (telic).
78    ///
79    /// Telic events: Accomplishments and Achievements reach a natural endpoint.
80    /// Atelic events: States, Activities, and Semelfactives have no inherent endpoint.
81    pub fn is_telic(&self) -> bool {
82        matches!(self, VerbClass::Accomplishment | VerbClass::Achievement)
83    }
84}
85
86/// Semantic sorts for type checking.
87#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
88pub enum Sort {
89    /// Top of the hierarchy; any individual.
90    Entity,
91    /// Concrete, spatially located objects.
92    Physical,
93    /// Living beings capable of self-motion.
94    Animate,
95    /// Persons with intentional agency.
96    Human,
97    /// Non-animal living organisms.
98    Plant,
99    /// Locations and regions.
100    Place,
101    /// Temporal intervals and points.
102    Time,
103    /// Non-physical, conceptual entities.
104    Abstract,
105    /// Propositional content and data.
106    Information,
107    /// Occurrences and happenings.
108    Event,
109    /// Stars, planets, and astronomical bodies.
110    Celestial,
111    /// Numeric or monetary amounts.
112    Value,
113    /// Hardware signals, wires, clocks, and buses.
114    Signal,
115    /// Collections of individuals.
116    Group,
117}
118
119impl Sort {
120    /// Check if this sort can be used where `other` is expected.
121    ///
122    /// Sort compatibility follows a subsumption hierarchy:
123    /// - Human ⊆ Animate ⊆ Physical ⊆ Entity
124    /// - Plant ⊆ Animate ⊆ Physical ⊆ Entity
125    /// - Everything ⊆ Entity
126    ///
127    /// For example, a Human noun can fill an Animate slot, but not vice versa.
128    pub fn is_compatible_with(self, other: Sort) -> bool {
129        if self == other {
130            return true;
131        }
132        match (self, other) {
133            (Sort::Human, Sort::Animate) => true,
134            (Sort::Plant, Sort::Animate) => true,
135            (Sort::Animate, Sort::Physical) => true,
136            (Sort::Human, Sort::Physical) => true,
137            (Sort::Plant, Sort::Physical) => true,
138            (_, Sort::Entity) => true,
139            _ => false,
140        }
141    }
142
143    /// Whether this sort denotes an OCCASION — an occurrence or happening whose
144    /// head noun behaves as a soft type. For occasion sorts, "the \[modifier\]
145    /// \[head\]" lets the modifier do the referring (the same event can be a
146    /// "trip", a "vacation", or a "holiday"), so two such definite descriptions
147    /// corefer when their modifier matches and their head sorts agree.
148    ///
149    /// Concrete physical objects (box, ball) are NOT occasions: "the red box"
150    /// and "the red ball" are distinct things even though both are `Physical`,
151    /// so they must never corefer through a shared modifier.
152    pub fn is_occasion(self) -> bool {
153        matches!(self, Sort::Event)
154    }
155}
156
157/// Grammatical number for nouns and agreement.
158#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
159pub enum Number {
160    /// Denotes a single individual.
161    Singular,
162    /// Denotes multiple individuals.
163    Plural,
164}
165
166/// Grammatical gender (for pronouns and agreement).
167#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
168pub enum Gender {
169    /// Masculine gender ("he", "him", "his").
170    Male,
171    /// Feminine gender ("she", "her", "hers").
172    Female,
173    /// Neuter gender ("it", "its").
174    Neuter,
175    /// Gender unspecified or indeterminate.
176    Unknown,
177}
178
179/// Grammatical case (for pronouns).
180#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
181pub enum Case {
182    /// Nominative case for subjects ("I", "he", "she").
183    Subject,
184    /// Accusative case for objects ("me", "him", "her").
185    Object,
186    /// Genitive case for possession ("my", "his", "her").
187    Possessive,
188}
189
190/// Lexical polarity for canonical mappings.
191#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
192pub enum Polarity {
193    /// Preserves the meaning (synonym mapping).
194    Positive,
195    /// Inverts the meaning (antonym mapping).
196    Negative,
197}
198
199/// Lexical features that encode grammatical and semantic properties of words.
200///
201/// Features are assigned to lexical entries in the lexicon database and control
202/// how words combine syntactically and what semantic representations they produce.
203/// The feature system follows the tradition of feature-based grammar formalisms
204/// like HPSG and LFG.
205#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
206pub enum Feature {
207    // -------------------------------------------------------------------------
208    // Verb Transitivity Features
209    // -------------------------------------------------------------------------
210    /// Verb requires a direct object (NP complement).
211    ///
212    /// Transitive verbs denote binary relations between an agent and a patient/theme.
213    /// In first-order logic, they translate to two-place predicates: `Verb(x, y)`.
214    ///
215    /// Examples: "see", "hit", "love", "build"
216    Transitive,
217
218    /// Verb takes no object (unary predicate).
219    ///
220    /// Intransitive verbs denote properties of a single argument (the subject).
221    /// They translate to one-place predicates: `Verb(x)`.
222    ///
223    /// Examples: "sleep", "arrive", "exist", "die"
224    Intransitive,
225
226    /// Verb takes two objects (direct + indirect).
227    ///
228    /// Ditransitive verbs denote ternary relations, typically involving transfer
229    /// of possession. They translate to three-place predicates: `Verb(x, y, z)`.
230    ///
231    /// Examples: "give", "tell", "show", "send"
232    Ditransitive,
233
234    // -------------------------------------------------------------------------
235    // Control Theory Features
236    // -------------------------------------------------------------------------
237    /// The subject of the matrix clause controls the PRO subject of the embedded clause.
238    ///
239    /// In "John promised Mary to leave", John (subject) is understood as the one leaving.
240    /// Formally: promise(j, m, leave(PRO_j)) where PRO is coindexed with the subject.
241    ///
242    /// Examples: "promise", "try", "want", "decide"
243    SubjectControl,
244
245    /// The object of the matrix clause controls the PRO subject of the embedded clause.
246    ///
247    /// In "John persuaded Mary to leave", Mary (object) is understood as the one leaving.
248    /// Formally: persuade(j, m, leave(PRO_m)) where PRO is coindexed with the object.
249    ///
250    /// Examples: "persuade", "force", "convince", "order"
251    ObjectControl,
252
253    /// Raising verb that does not assign a theta-role to its surface subject.
254    ///
255    /// In "John seems to be happy", "John" originates in the embedded clause and
256    /// raises to matrix subject position. No control relation; subject is shared.
257    /// Contrast with control: raising allows expletive subjects ("It seems that...").
258    ///
259    /// Examples: "seem", "appear", "happen", "tend"
260    Raising,
261
262    // -------------------------------------------------------------------------
263    // Semantic Features
264    // -------------------------------------------------------------------------
265    /// Creates an opaque (intensional) context blocking substitution of co-referential terms.
266    ///
267    /// In opaque contexts, Leibniz's Law fails: even if a=b, P(a) does not entail P(b).
268    /// "John believes Clark Kent is weak" does not entail "John believes Superman is weak"
269    /// even if Clark Kent = Superman. Requires possible-worlds semantics.
270    ///
271    /// Examples: "believe", "think", "want", "seek"
272    Opaque,
273
274    /// Presupposes the truth of its complement clause.
275    ///
276    /// Factive verbs entail the truth of their embedded proposition regardless of
277    /// the matrix clause's truth value. "John regrets that it rained" presupposes
278    /// that it rained, even under negation: "John doesn't regret that it rained."
279    ///
280    /// Examples: "know", "regret", "realize", "discover"
281    Factive,
282
283    /// Uttering the verb constitutes performing the action it describes.
284    ///
285    /// Performative verbs, when uttered in first person present, do not describe
286    /// an action but perform it. "I promise to come" is itself the act of promising.
287    /// Austin's speech act theory: saying is doing.
288    ///
289    /// Examples: "promise", "declare", "pronounce", "bet"
290    Performative,
291
292    /// Requires a plural or group subject; describes collective action.
293    ///
294    /// Collective predicates cannot distribute over atomic individuals.
295    /// "The students gathered" is true of the group, not of each student individually.
296    /// Contrast with distributive: "gathered" vs "slept".
297    ///
298    /// Examples: "gather", "meet", "disperse", "surround"
299    Collective,
300
301    /// Can be interpreted either collectively or distributively.
302    ///
303    /// Mixed predicates are ambiguous between collective and distributive readings.
304    /// "The students lifted the piano" can mean they lifted it together (collective)
305    /// or each lifted a piano (distributive). Context disambiguates.
306    ///
307    /// Examples: "lift", "carry", "build", "write"
308    Mixed,
309
310    /// Distributes over atomic individuals in a plurality.
311    ///
312    /// Distributive predicates apply to each member of a plural subject individually.
313    /// "The students slept" entails that each student slept. Formally: ∀x(student(x) → slept(x)).
314    ///
315    /// Examples: "sleep", "smile", "breathe", "think"
316    Distributive,
317
318    /// Impersonal verb describing meteorological phenomena; takes expletive subject.
319    ///
320    /// Weather verbs have no semantic subject; "it" in "it rains" is a dummy expletive.
321    /// In formal semantics, they are zero-place predicates or predicates of times/events.
322    ///
323    /// Examples: "rain", "snow", "thunder", "drizzle"
324    Weather,
325
326    /// Intransitive verb whose subject is a theme/patient, not an agent.
327    ///
328    /// Unaccusative verbs have an underlying object that surfaces as subject.
329    /// Evidence: auxiliary selection in Italian/German, participle agreement.
330    /// "The ice melted" - the ice undergoes melting, doesn't cause it.
331    ///
332    /// Examples: "arrive", "fall", "melt", "appear"
333    Unaccusative,
334
335    /// Takes a proposition and evaluates it relative to possible worlds.
336    ///
337    /// Intensional predicates don't just operate on truth values but on intensions
338    /// (functions from worlds to extensions). Required for modal and attitude reports.
339    /// "John believes it might rain" involves multiple world quantification.
340    ///
341    /// Examples: "believe", "know", "hope", "doubt"
342    IntensionalPredicate,
343
344    /// Causative change-of-state verb that licenses a RESULTATIVE secondary
345    /// predicate: the object's resulting state is brought about by the event.
346    /// "paint the door RED" (the door becomes red), "hammer the metal FLAT".
347    /// Verbs without this feature take a post-object AP as a DEPICTIVE instead
348    /// ("eat the meat RAW" — the meat is raw during, not caused by, the eating).
349    ///
350    /// Examples: "paint", "dye", "break", "flatten", "freeze"
351    Resultative,
352
353    /// Perception verb (see, hear, watch, …) taking a small-clause complement
354    /// "NP bare-VP" that denotes the PERCEIVED EVENT (§3.2): "Mary heard the bell
355    /// RING" → Hear(mary, ⟨Ring(bell)⟩).
356    ///
357    /// Examples: "see", "hear", "watch", "feel", "notice", "observe"
358    Perception,
359
360    /// Addressee-oriented attitude verb that, in an "if you V …" antecedent, marks a
361    /// BISCUIT / relevance conditional (§4.2): the consequent is asserted and the
362    /// if-clause restricts relevance, not truth ("If you WANT tea, the kettle is hot").
363    ///
364    /// Examples: "want", "need", "wonder", "care", "desire", "wish", "like"
365    Relevance,
366
367    // -------------------------------------------------------------------------
368    // Noun Features
369    // -------------------------------------------------------------------------
370    /// Noun can be counted; takes singular/plural marking and numerals directly.
371    ///
372    /// Count nouns denote atomic, individuated entities. They combine with numerals
373    /// and indefinite articles: "three cats", "a dog". Semantically, they have
374    /// natural atomic minimal parts.
375    ///
376    /// Examples: "cat", "idea", "student", "book"
377    Count,
378
379    /// Noun denotes stuff without natural units; requires measure phrases for counting.
380    ///
381    /// Mass nouns are cumulative and divisive: any part of water is water, and
382    /// water plus water is water. Cannot directly combine with numerals;
383    /// require classifiers: "three glasses of water", not "three waters".
384    ///
385    /// Examples: "water", "rice", "information", "furniture"
386    Mass,
387
388    /// Noun is a proper name denoting a specific individual.
389    ///
390    /// Proper nouns are rigid designators that refer to the same individual in
391    /// all possible worlds. They typically lack articles and don't take plural
392    /// marking. Semantically, they denote individuals directly, not sets.
393    ///
394    /// Examples: "Socrates", "Paris", "Microsoft", "Monday"
395    Proper,
396
397    // -------------------------------------------------------------------------
398    // Gender Features
399    // -------------------------------------------------------------------------
400    /// Grammatically masculine; triggers masculine agreement on dependents.
401    ///
402    /// In languages with grammatical gender, masculine nouns control agreement
403    /// on articles, adjectives, and pronouns. In English, primarily affects
404    /// pronoun selection for animate referents.
405    ///
406    /// Examples: "man", "king", "actor", "waiter"
407    Masculine,
408
409    /// Grammatically feminine; triggers feminine agreement on dependents.
410    ///
411    /// Feminine nouns control feminine agreement patterns. In English, primarily
412    /// relevant for pronoun selection with human referents.
413    ///
414    /// Examples: "woman", "queen", "actress", "waitress"
415    Feminine,
416
417    /// Grammatically neuter; triggers neuter agreement on dependents.
418    ///
419    /// Neuter is the default for inanimate objects in English. Used for entities
420    /// where natural gender is absent or unknown. "It" is the neuter pronoun.
421    ///
422    /// Examples: "table", "rock", "system", "idea"
423    Neuter,
424
425    // -------------------------------------------------------------------------
426    // Animacy Features
427    // -------------------------------------------------------------------------
428    /// Denotes an entity capable of self-initiated action or sentience.
429    ///
430    /// Animacy is a semantic feature affecting argument realization. Animate
431    /// entities can be agents, experiencers, recipients. Affects pronoun choice
432    /// ("who" vs "what") and relative clause formation.
433    ///
434    /// Examples: "dog", "person", "bird", "robot" (ambiguous)
435    Animate,
436
437    /// Denotes a non-sentient entity incapable of self-initiated action.
438    ///
439    /// Inanimate entities typically serve as themes, patients, or instruments.
440    /// Cannot be agents in the semantic sense. "What" rather than "who".
441    ///
442    /// Examples: "rock", "table", "water", "idea"
443    Inanimate,
444
445    // -------------------------------------------------------------------------
446    // Adjective Features
447    // -------------------------------------------------------------------------
448    /// Adjective meaning combines by set intersection with noun meaning.
449    ///
450    /// For intersective adjectives, "A N" denotes things that are both A and N.
451    /// "Red ball" means {x : red(x) ∧ ball(x)}. The adjective has a context-independent
452    /// extension that intersects with the noun's extension.
453    ///
454    /// Examples: "red", "round", "wooden", "French"
455    Intersective,
456
457    /// Adjective meaning cannot be computed by simple intersection.
458    ///
459    /// Non-intersective adjectives require the noun to determine their extension.
460    /// "Fake gun" is not a gun at all, so fake(x) ∧ gun(x) gives wrong results.
461    /// Includes privative ("fake", "former") and modal ("alleged", "potential").
462    ///
463    /// Examples: "fake", "alleged", "former", "potential"
464    NonIntersective,
465
466    /// Adjective picks out a subset of the noun denotation relative to a comparison class.
467    ///
468    /// Subsective adjectives entail the noun: a "skillful surgeon" is a surgeon.
469    /// But "skillful" is relative: skillful for a surgeon, not skillful absolutely.
470    /// "Small elephant" is large for an animal but small for an elephant.
471    ///
472    /// Examples: "skillful", "good", "large", "small"
473    Subsective,
474
475    /// Adjective has a degree argument and supports comparison morphology.
476    ///
477    /// Gradable adjectives place entities on a scale with a contextual standard.
478    /// "Tall" means exceeding some contextual standard of height. Supports
479    /// comparatives ("taller"), superlatives ("tallest"), and degree modification.
480    ///
481    /// Examples: "tall", "expensive", "heavy", "smart"
482    Gradable,
483
484    /// Adjective that modifies the event denoted by the verb, not the noun.
485    ///
486    /// Event-modifying adjectives (when used adverbially) characterize manner or
487    /// other event properties. "Careful surgeon" suggests careful in operating,
488    /// not careful as a person. Related to adverb formation.
489    ///
490    /// Examples: "careful", "slow", "quick", "deliberate"
491    EventModifier,
492
493    /// Denominal, non-predicating adjective denoting a relation to a base noun.
494    ///
495    /// Relational (pertainymic) adjectives — "dental" ← tooth, "coastal" ← coast,
496    /// "nuclear" ← nucleus — are NOT intersective: "a dental procedure" is not
497    /// {dental things} ∩ {procedures}; the adjective relates the procedure to
498    /// teeth. They are predicates of KINDS (McNally & Boleda 2004), modeled as
499    /// `Noun(x) ∧ Rel(x, ^Base)` (kind-level, default) or
500    /// `Noun(x) ∧ ∃y(Base(y) ∧ Rel(x, y))` (instance-level override).
501    ///
502    /// Examples: "dental", "coastal", "nuclear", "marine", "postal", "solar"
503    Relational,
504
505    /// Gradable adjective with borderline cases and sorites behavior (§8.5): the
506    /// threshold has a PENUMBRA (a vague region θ_low < d < θ_high), not a sharp
507    /// cutoff. Implies a degree-standard reading plus a borderline marker.
508    ///
509    /// Examples: "bald", "tall", "heavy", "rich", "old", "big"
510    Vague,
511
512    /// Negative-pole (decreasing) gradable adjective: the comparative denotes a
513    /// SMALLER value on the canonical measured scale, so an arithmetic comparative
514    /// subtracts rather than adds ("narrower" → less wingspan, "lighter" → less
515    /// weight). The unmarked positive pole ("wide", "long", "heavy") increases.
516    ///
517    /// Examples: "narrow", "short", "small", "light", "cheap", "slow", "young"
518    Decreasing,
519}
520
521impl Feature {
522    /// Parses a feature name from a string.
523    ///
524    /// Returns `Some(Feature)` if the string matches a known feature name (case-sensitive),
525    /// or `None` if unrecognized.
526    pub fn from_str(s: &str) -> Option<Feature> {
527        match s {
528            "Transitive" => Some(Feature::Transitive),
529            "Intransitive" => Some(Feature::Intransitive),
530            "Ditransitive" => Some(Feature::Ditransitive),
531            "SubjectControl" => Some(Feature::SubjectControl),
532            "ObjectControl" => Some(Feature::ObjectControl),
533            "Raising" => Some(Feature::Raising),
534            "Opaque" => Some(Feature::Opaque),
535            "Factive" => Some(Feature::Factive),
536            "Performative" => Some(Feature::Performative),
537            "Collective" => Some(Feature::Collective),
538            "Mixed" => Some(Feature::Mixed),
539            "Distributive" => Some(Feature::Distributive),
540            "Weather" => Some(Feature::Weather),
541            "Unaccusative" => Some(Feature::Unaccusative),
542            "IntensionalPredicate" => Some(Feature::IntensionalPredicate),
543            "Resultative" => Some(Feature::Resultative),
544            "Perception" => Some(Feature::Perception),
545            "Relevance" => Some(Feature::Relevance),
546            "Count" => Some(Feature::Count),
547            "Mass" => Some(Feature::Mass),
548            "Proper" => Some(Feature::Proper),
549            "Masculine" => Some(Feature::Masculine),
550            "Feminine" => Some(Feature::Feminine),
551            "Neuter" => Some(Feature::Neuter),
552            "Animate" => Some(Feature::Animate),
553            "Inanimate" => Some(Feature::Inanimate),
554            "Intersective" => Some(Feature::Intersective),
555            "NonIntersective" => Some(Feature::NonIntersective),
556            "Subsective" => Some(Feature::Subsective),
557            "Gradable" => Some(Feature::Gradable),
558            "EventModifier" => Some(Feature::EventModifier),
559            "Relational" => Some(Feature::Relational),
560            "Vague" => Some(Feature::Vague),
561            "Decreasing" => Some(Feature::Decreasing),
562            _ => None,
563        }
564    }
565}
566
567/// Verb entry returned from irregular verb lookup.
568///
569/// This owned struct is returned when looking up inflected verb forms
570/// (e.g., "ran" → run, "went" → go). Contains the resolved morphological
571/// information needed for semantic processing.
572#[derive(Debug, Clone, PartialEq, Eq)]
573pub struct VerbEntry {
574    /// The dictionary form (infinitive) of the verb.
575    /// Example: "run" for input "ran", "go" for input "went".
576    pub lemma: String,
577
578    /// The temporal reference encoded by the inflection.
579    /// Example: Past for "ran", Present for "runs".
580    pub time: Time,
581
582    /// The grammatical aspect of the inflected form.
583    /// Example: Progressive for "running", Perfect for "run" (in "has run").
584    pub aspect: Aspect,
585
586    /// The Vendler aspectual class (Aktionsart) of the verb.
587    /// Determines compatibility with temporal adverbials and aspect markers.
588    pub class: VerbClass,
589}
590
591/// A verb's third-person singular present, from its lemma by English spelling rules:
592/// "see" → "sees", "watch" → "watches", "carry" → "carries", "have" → "has", "be" → "is".
593pub fn present_3s_of(lemma: &str) -> String {
594    let lemma = lemma.to_lowercase();
595    match lemma.as_str() {
596        "be" => return "is".to_string(),
597        "have" => return "has".to_string(),
598        _ => {}
599    }
600    if lemma.ends_with('s')
601        || lemma.ends_with('x')
602        || lemma.ends_with("ch")
603        || lemma.ends_with("sh")
604        || lemma.ends_with('o')
605    {
606        format!("{lemma}es")
607    } else if lemma.ends_with('y') && !["ay", "ey", "oy", "uy"].iter().any(|v| lemma.ends_with(v)) {
608        format!("{}ies", &lemma[..lemma.len() - 1])
609    } else {
610        format!("{lemma}s")
611    }
612}
613
614/// Static verb metadata from the lexicon database.
615///
616/// This borrowed struct provides zero-copy access to verb information
617/// stored in the generated lexicon. Used for verbs looked up by lemma
618/// rather than inflected form.
619#[derive(Debug, Clone, Copy, PartialEq, Eq)]
620pub struct VerbMetadata {
621    /// The dictionary form (infinitive) of the verb.
622    pub lemma: &'static str,
623
624    /// The Vendler aspectual class determining temporal behavior.
625    pub class: VerbClass,
626
627    /// The default temporal reference (usually [`Time::None`] for infinitives).
628    pub time: Time,
629
630    /// The default grammatical aspect (usually [`Aspect::Simple`]).
631    pub aspect: Aspect,
632
633    /// Lexical features controlling syntax and semantics.
634    /// See [`Feature`] for the full list of possible features.
635    pub features: &'static [Feature],
636}
637
638/// Static noun metadata from the lexicon database.
639///
640/// Provides lexical information for noun lookup including number
641/// and semantic features. Nouns are keyed by their surface form,
642/// with separate entries for singular and plural.
643#[derive(Debug, Clone, Copy, PartialEq, Eq)]
644pub struct NounMetadata {
645    /// The canonical form of the noun (usually singular).
646    pub lemma: &'static str,
647
648    /// The grammatical number of this surface form.
649    /// "cat" → Singular, "cats" → Plural.
650    pub number: Number,
651
652    /// Semantic features including count/mass, animacy, and gender.
653    pub features: &'static [Feature],
654}
655
656/// Static adjective metadata from the lexicon database.
657///
658/// Adjectives carry features that determine their semantic behavior
659/// when combined with nouns (intersective, subsective, etc.) and
660/// whether they support gradability and comparison.
661#[derive(Debug, Clone, Copy, PartialEq, Eq)]
662pub struct AdjectiveMetadata {
663    /// The base form of the adjective (positive degree).
664    pub lemma: &'static str,
665
666    /// Semantic features controlling modification behavior.
667    /// See [`Feature::Intersective`], [`Feature::Subsective`], etc.
668    pub features: &'static [Feature],
669}
670
671/// Canonical mapping for verb synonyms and antonyms.
672///
673/// Maps a verb to its canonical form for semantic normalization.
674/// Antonyms are mapped with negative polarity, synonyms with positive.
675/// Example: "despise" → ("hate", Positive), "love" → ("hate", Negative).
676#[derive(Debug, Clone, Copy, PartialEq, Eq)]
677pub struct CanonicalMapping {
678    /// The canonical verb lemma this word maps to.
679    pub lemma: &'static str,
680
681    /// Whether the mapping preserves (Positive) or inverts (Negative) polarity.
682    pub polarity: Polarity,
683}
684
685/// Morphological rule for derivational morphology.
686///
687/// Defines how suffixes transform words between categories.
688/// Used for productive morphological patterns like "-ness" (adj → noun)
689/// or "-ly" (adj → adv).
690#[derive(Debug, Clone, Copy, PartialEq, Eq)]
691pub struct MorphologicalRule {
692    /// The suffix that triggers this rule (e.g., "-ness", "-ly").
693    pub suffix: &'static str,
694
695    /// The part of speech or category produced (e.g., "noun", "adverb").
696    pub produces: &'static str,
697}