Commit 5b18ed44 authored by jfschaefer's avatar jfschaefer
Browse files

support simple apposition

parent 9f1fe1c9
-- abstract grammar for formulae
abstract FGrammar = MCats ** {
fun
fidentifier_to_fcomplexidentifier : FIdentifier -> FComplexIdentifier; -- n -> mi ( n )
fcomplexidentifier_to_mathcn : FComplexIdentifier -> MathCN; -- mi ( n ) => $ mi ( cn )
}
concrete FGrammarEng of FGrammar = MCatsEng ** open ParadigmsEng in {
oper
wrap_mml : Str -> Str -> Str = \wrapper,content -> wrapper ++ "(" ++ content ++ ")";
lin
fidentifier_to_fcomplexidentifier i = wrap_mml "mi" i;
fcomplexidentifier_to_mathcn fci = lin CN {
s = table { singular => table { _ => "$" ++ fci ++ "$" } };
g = nonhuman };
}
-- lexicon for formulae (identifiers, operatores, ...)
abstract FLexicon = MCats ** {
fun
n_FIdentifier : FIdentifier;
}
concrete FLexiconEng of FLexicon = MCatsEng ** {
lin
n_FIdentifier = "n";
}
-- 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
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
FIdentifier; -- identifier literals in formulae (e.g. "n")
FComplexIdentifier; -- complex identifier in formuale (e.g. "x_1")
MathCN; -- math common noun (e.g. $ mo ( n ) $)
}
......@@ -7,4 +7,8 @@ concrete MCatsEng of MCats = open SyntaxEng in {
StatementFin = S;
Definition = Cl;
Utterance = Utt;
FIdentifier = Str;
FComplexIdentifier = Str;
MathCN = CN;
}
-- Collects all the stuff we have for parsing math
abstract MNlp = NLexicon, NGrammar ** {
abstract MNlp = NLexicon, NGrammar, FGrammar, FLexicon ** {
flags
startcat = Utterance;
}
concrete MNlpEng of MNlp = NLexiconEng, NGrammarEng ** {
concrete MNlpEng of MNlp = NLexiconEng, NGrammarEng, FGrammarEng, FLexiconEng ** {
}
......@@ -3,6 +3,7 @@ abstract NGrammar = MCats, Grammar, Extra, ExtraEngAbs ** {
fun
restrict_mobj : MObjProp -> MObj -> MObj; -- "even" -> "integer" -> "even integer"
def_descr_mobj : MObj -> DefMObj; -- "cube" -> "the cube"
appo_mobj : MObj -> MathCN -> MObj; -- "an integer $ mi ( n ) $
exists_statement : MObj -> Statement; -- "integer" -> "there is an integer"
not_exists_statement : MObj -> Statement; -- "integer" -> "there is no integer"
......
......@@ -2,6 +2,7 @@ concrete NGrammarEng of NGrammar = MCatsEng, GrammarEng, ExtraEng ** open Syntax
lin
restrict_mobj prop obj = mkCN prop obj;
def_descr_mobj obj = mkNP the_Art obj;
appo_mobj obj mcn = lin CN { s = \\number,case_ => obj.s ! number ! case_ ++ mcn.s ! number ! case_; g = obj.g };
exists_statement obj = mkCl obj | ExistsNP (mkNP aSg_Det obj);
not_exists_statement obj = mkCl (mkNP no_Quant obj) | ExistsNP (mkNP no_Quant obj);
......
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