Lexicon Builder #
Dispatch layer connecting Fragment classificatory data to compositional semantics. Provides:
Type dispatch (
ComplementType.toTy): deterministic mapping from verb complement type to Montague semantic type.Lexicon construction (
buildLexicon): assembles aLexicon Ffrom a list of named entries, replacing the hand-written match-on-strings pattern that Studies currently use.Entry construction (
VerbCore.mkLexEntry): given a VerbCore and a denotation of the appropriate type, produce aLexEntry F.
Design #
The dispatch layer does NOT generate denotations from features — that would
be too theory-laden. It provides the type and the scaffolding; the Study
still supplies the denotation. Domain-specific denotation builders
(VerbCore.getCoSSemantics, VerbCore.veridicality, etc.) remain in
Theories/Semantics/Lexical/Verb/VerbEntry.lean.
Usage pattern #
-- In a Study file:
import Linglib.Theories.Semantics.Composition.LexiconBuilder
import Linglib.Fragments.English.Predicates.Verbal
open Semantics.Composition.LexiconBuilder (buildLexicon)
open Semantics.Montague (LexEntry)
def myLexicon : Lexicon myModel :=
buildLexicon [
("john", ⟨.e, john_sem⟩),
("sleeps", ⟨.et, sleeps_sem⟩),
("sees", ⟨.eet, sees_sem⟩)
]
Type Dispatch #
Map a verb's complement type to its Montague semantic type.
- Intransitives (
none):e → t(1-place predicate) - Transitives (
np):e → e → t(2-place, object then subject) - Ditransitives (
np_np):e → e → e → t(IO, DO, subject) - NP+PP (
np_pp):e → e → e → t(same arity as ditransitive) - Finite clause (
finiteClause):t → e → t(proposition-taking) - Infinitival (
infinitival):(e → t) → e → t(property-taking) - Gerund (
gerund):(e → t) → e → t(same as infinitival) - Small clause (
smallClause):(e → t) → e → t(resultative predicate) - Question (
question):(e → t) → e → t(question-embedding)
Equations
- Semantics.Lexical.ComplementType.none.toTy = (Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t)
- Semantics.Lexical.ComplementType.np.toTy = (Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t)
- Semantics.Lexical.ComplementType.np_np.toTy = (Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t)
- Semantics.Lexical.ComplementType.np_pp.toTy = (Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t)
- Semantics.Lexical.ComplementType.finiteClause.toTy = (Core.Logic.Intensional.Ty.t ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t)
- Semantics.Lexical.ComplementType.infinitival.toTy = ((Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t) ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t)
- Semantics.Lexical.ComplementType.gerund.toTy = ((Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t) ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t)
- Semantics.Lexical.ComplementType.smallClause.toTy = ((Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t) ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t)
- Semantics.Lexical.ComplementType.question.toTy = ((Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t) ⇒ Core.Logic.Intensional.Ty.e ⇒ Core.Logic.Intensional.Ty.t)
Instances For
The semantic type of a verb, determined by its complement type.
Equations
- v.semanticType = v.complementType.toTy
Instances For
Lexicon Construction #
Build a Lexicon F from a list of named entries.
Replaces the pattern of hand-written match expressions on strings that Studies currently use. Lookup is linear in the entry list; this is fine for the small lexicons (5–30 entries) typical of Study files.
def myLex : Lexicon myModel := buildLexicon [
("john", ⟨.e, john_sem⟩),
("sleeps", ⟨.et, sleeps_sem⟩)
]
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extend a lexicon with additional entries. Later entries shadow earlier ones with the same name.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Merge two lexicons. The first lexicon takes priority on conflicts.
Equations
- Semantics.Composition.LexiconBuilder.mergeLexicons lex1 lex2 s = (lex1 s).orElse fun (x : Unit) => lex2 s
Instances For
Entry Construction #
Create a LexEntry for a verb, using complementType.toTy to determine
the semantic type. The caller provides a denotation of the appropriate type.
This ensures the entry's type tag matches the verb's argument structure by construction.
Equations
- Semantics.Composition.LexiconBuilder.VerbCore.mkLexEntry v F denot = { ty := v.semanticType, denot := denot }
Instances For
Convenience #
The empty lexicon.
Equations
Instances For
A single-entry lexicon.
Equations
- Semantics.Composition.LexiconBuilder.singletonLexicon name entry s = if (s == name) = true then some entry else none