Grammar #
Grammar comparison interface and empirical testing infrastructure.
Defines:
ClauseType— sentence types (declarative, question variants)Grammartypeclass — assigns derivations to stringsMinimalPair/PhenomenonData— word-based grammaticality testingSentencePair/StringPhenomenonData— theory-neutral string-based testing- Capture predicates and agreement theorems
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instReprV2Data = { reprPrec := instReprV2Data.repr }
Equations
- One or more equations did not get rendered due to their size.
- instBEqV2Data.beq x✝¹ x✝ = false
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Clause types - determines constraints on word order.
- declarative : ClauseType
- matrixQuestion : ClauseType
- embeddedQuestion : ClauseType
- echo : ClauseType
Instances For
Equations
- instReprClauseType = { reprPrec := instReprClauseType.repr }
Equations
- instReprClauseType.repr ClauseType.declarative prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "ClauseType.declarative")).group prec✝
- instReprClauseType.repr ClauseType.matrixQuestion prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "ClauseType.matrixQuestion")).group prec✝
- instReprClauseType.repr ClauseType.embeddedQuestion prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "ClauseType.embeddedQuestion")).group prec✝
- instReprClauseType.repr ClauseType.echo prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "ClauseType.echo")).group prec✝
Instances For
Is this a nominal category that can be a subject?
Equations
- isSubjectCat c = (c == UD.UPOS.PROPN || c == UD.UPOS.NOUN || c == UD.UPOS.PRON)
Instances For
Does the auxiliary precede the subject?
Equations
- auxPrecedesSubject ws = precedes (fun (x : Word) => x.cat == UD.UPOS.AUX) isSubject ws
Instances For
Does the subject precede the auxiliary?
Equations
- subjectPrecedesAux ws = precedes isSubject (fun (x : Word) => x.cat == UD.UPOS.AUX) ws
Instances For
A Grammar assigns derivations to strings. Derivations are proof objects.
- Derivation : Type
The type of derivations/analyses this grammar produces
- realizes : Derivation G → List Word → ClauseType → Prop
Whether a derivation yields a given string with given clause type
- derives : G → List Word → ClauseType → Prop
Whether the grammar can produce some derivation for a string
Instances
Collection of minimal pairs for a phenomenon
- name : String
- pairs : List MinimalPair
- generalization : String
Instances For
Check if a grammaticality predicate captures a minimal pair.
Captures the pair iff the predicate accepts the grammatical sentence and rejects the ungrammatical sentence.
Equations
- capturesMinimalPairBy pred pair = (pred pair.grammatical && !pred pair.ungrammatical)
Instances For
Check if a grammaticality predicate captures all minimal pairs in a phenomenon dataset.
Equations
- capturesPhenomenonData pred phenom = phenom.pairs.all (capturesMinimalPairBy pred)
Instances For
A grammar captures a minimal pair if it derives the good one and blocks the bad one
Equations
- Grammar.capturesPair G g pair = (Grammar.derives g pair.grammatical pair.clauseType ∧ ¬Grammar.derives g pair.ungrammatical pair.clauseType)
Instances For
A grammar captures a phenomenon if it captures all its minimal pairs
Equations
- Grammar.capturesPhenomenon G g phenom = ∀ (pair : MinimalPair), pair ∈ phenom.pairs → Grammar.capturesPair G g pair
Instances For
If two grammars both capture a phenomenon, they agree on grammatical sentences
String-based minimal pair for theory-neutral phenomena.
Unlike MinimalPair which uses List Word (requiring feature specifications),
this type uses raw strings that can be parsed by any theory. This keeps
empirical data in Phenomena/ free from theoretical commitments.
- grammatical : String
The grammatical sentence
- ungrammatical : String
The ungrammatical sentence
- clauseType : ClauseType
Clause type (declarative, question, etc.)
- description : String
Description of what the pair tests
Optional citation for the data
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instReprSentencePair = { reprPrec := instReprSentencePair.repr }
Equations
Equations
- One or more equations did not get rendered due to their size.
- instBEqSentencePair.beq x✝¹ x✝ = false
Instances For
String-based phenomenon data for theory-neutral representation.
This is the string-based analogue of PhenomenonData. Phenomena files
should use this type so that empirical data is decoupled from any
particular grammatical theory's representation.
- name : String
Name of the phenomenon
- pairs : List SentencePair
List of minimal pairs
- generalization : String
Generalization captured by this data
Instances For
Equations
- instReprStringPhenomenonData = { reprPrec := instReprStringPhenomenonData.repr }
Equations
- One or more equations did not get rendered due to their size.