Commit 9f1fe1c9 authored by jfschaefer's avatar jfschaefer
Browse files

add new GF attempt

parent 03e4eecc
-- categories
abstract MCats = {
cat
DefMObj; -- definite math object ("the largest element", ...)
MObj; -- math object ("prime number", "group", ...)
MObjProp; -- math object properties ("eve", "prime", "divisble by 2", ...)
Statement; -- statement ("every prime number is an integer")
StatementFin; -- finished statement
Definition; -- definition
Utterance; -- (finished) statement or definition
}
concrete MCatsEng of MCats = open SyntaxEng in {
lincat
DefMObj = NP;
MObj = CN;
MObjProp = AP;
Statement = Cl;
StatementFin = S;
Definition = Cl;
Utterance = Utt;
}
-- Collects all the stuff we have for parsing math
abstract MNlp = NLexicon, NGrammar ** {
flags
startcat = Utterance;
}
concrete MNlpEng of MNlp = NLexiconEng, NGrammarEng ** {
}
-- abstract grammar for natural language
abstract NGrammar = MCats, Grammar, Extra, ExtraEngAbs ** {
fun
restrict_mobj : MObjProp -> MObj -> MObj; -- "even" -> "integer" -> "even integer"
def_descr_mobj : MObj -> DefMObj; -- "cube" -> "the cube"
exists_statement : MObj -> Statement; -- "integer" -> "there is an integer"
not_exists_statement : MObj -> Statement; -- "integer" -> "there is no integer"
eq_defmobj_defmobj : DefMObj -> DefMObj -> Statement; -- "the largest element is the maximum"
state : Statement -> StatementFin; -- essentially identity
neg_state : Statement -> StatementFin; -- negation
iff_statementfin : StatementFin -> StatementFin -> StatementFin;
and_statementfin : StatementFin -> StatementFin -> StatementFin;
or_statementfin : StatementFin -> StatementFin -> StatementFin;
def_mobj_mobjprop : MObj -> MObjProp -> Definition; -- "an integer is called prime"
utter_statement : StatementFin -> Utterance; -- essentially identity
utter_definition : Definition -> Utterance; -- essentially identity
}
concrete NGrammarEng of NGrammar = MCatsEng, GrammarEng, ExtraEng ** open SyntaxEng, ParadigmsEng in {
lin
restrict_mobj prop obj = mkCN prop obj;
def_descr_mobj obj = mkNP the_Art obj;
exists_statement obj = mkCl obj | ExistsNP (mkNP aSg_Det obj);
not_exists_statement obj = mkCl (mkNP no_Quant obj) | ExistsNP (mkNP no_Quant obj);
eq_defmobj_defmobj a b = mkCl a b;
state s = mkS GrammarEng.PPos s;
neg_state s = mkS GrammarEng.PNeg s;
iff_statementfin a b = mkS (mkConj "iff") a b;
and_statementfin a b = mkS (mkConj "and") a b;
or_statementfin a b = mkS (mkConj "or") a b;
def_mobj_mobjprop obj prop = mkCl
(mkNP aSg_Det obj)
(PastPartAP (mkVPSlash (mkV2A (mkV "call" "calls" "called" "called" "calling") noPrep) prop));
utter_statement s = mkUtt s;
utter_definition s = mkUtt s;
-- copied from ExtendEng.gf
PastPartAP vp = {
s = \\a => vp.ad ! a ++ vp.ptp ++ vp.p ++ vp.c2 ++ vp.s2 ! a ++ vp.ext ;
isPre = vp.isSimple -- depends on whether there are complements
} ;
}
-- natural language lexicon
abstract NLexicon = MCats ** {
fun
integer_MObj : MObj;
even_MObjProp : MObjProp;
}
concrete NLexiconEng of NLexicon = MCatsEng ** open SyntaxEng, ParadigmsEng in {
lin
integer_MObj = mkCN (mkN "integer");
even_MObjProp = mkAP (mkA "even");
}
This is a new attempt to have a semantic grammar for mathematics, using the knowledge from our purely syntactic approach.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment