Attention: Maintenance on monday 19.04.2021 from 07:00 - 13:00 (Gitlab and Mattermost are offline!)

Commit 2927e316 by jfschaefer

### can parse more examples now

parent 0c370d94
 abstract MathLex = Cat ** { cat MathNP; MathNP; -- do we really need this? MathExpr; MathBinRel; -- binary relation MathBinOp; -- binary operator MathPrefixedAdj; -- like "_-dimensional" fun positive_A : A ; prime_A : A ; cartesian_A : A ; element_N : N ; integer_N : N ; call_V2A : V2A; iff_Subj : Subj; product_N : N ; space_N : N ; set_N : N ; dimensional_MPA : MathPrefixedAdj; three_PN : PN; -- for the Math Grammar call_V2A : V2A; -- we call it prime call_V3 : V3; -- we call it an integer iff_Subj : Subj; appo : N -> MathNP -> N; AdvSInEnd : Adv -> S -> S; -- for the Math Grammar mathPrefixAdj : MathNP -> MathPrefixedAdj -> A; applyRel : MathBinRel -> MathExpr -> MathExpr -> MathExpr; exprToMathNP : MathExpr -> MathNP; exprToCl : MathExpr -> Cl; applyOp : MathBinOp -> MathExpr -> MathExpr -> MathExpr; mathIndex : MathExpr -> MathExpr -> MathExpr; exprToMathNP : MathExpr -> MathNP; -- an integer $i$ exprToCl : MathExpr -> Cl; -- since $m = n$ exprToN : MathExpr -> N; -- for all $n \in A$ divides_MathBinRel : MathBinRel; power_MathBinOp : MathBinOp; xtimes_MathBinOp : MathBinOp; lessThan_MathBinRel : MathBinRel; equals_MathBinRel : MathBinRel; i_MathExpr : MathExpr; n_MathExpr : MathExpr; m_MathExpr : MathExpr; ldots_MathExpr : MathExpr; bigA_MathExpr : MathExpr; one_MathExpr : MathExpr; }
 --# -path=.:prelude concrete MathLexEng of MathLex = CatEng ** open ParadigmsEng, IrregEng, Prelude in { open ParadigmsEng, ResEng, IrregEng, Prelude in { flags optimize=values ; ... ... @@ -10,24 +10,51 @@ lincat MathNP = Str; MathExpr = Str; MathBinRel = Str; MathBinOp = Str; MathPrefixedAdj = A; lin positive_A = regA "positive" ; prime_A = regA "prime" ; cartesian_A = regA "cartesian" ; integer_N = regN "integer" ; element_N = regN "element" ; product_N = regN "product" ; space_N = regN "space" ; set_N = regN "set" ; dimensional_MPA = regA "dimensional" ; three_PN = mkPN (mkN nonhuman (mkN "three")) ; call_V2A = mkV2A (mkV "call" "calls" "called" "called" "calling") noPrep ; call_V3 = mkV3 "call" ; iff_Subj = mkSubj "iff"; three_PN = mkPN (mkN nonhuman (mkN "three")) ; -- for the Math Grammar appo n a = lin N {s = \\x,y => n.s ! x ! y ++ a; g=n.g}; AdvSInEnd a s = lin S { s = s.s ++ a.s } ; -- for the Math Grammar mathPrefixAdj mathnp adj = lin A { s = \\x => mathnp ++ "-" ++ adj.s ! x }; applyRel rel a b = a ++ rel ++ b; -- e.g. "m < n" applyOp op a b = a ++ op ++ b; -- e.g. "m + n" exprToMathNP expr = "$" ++ expr ++ "$"; exprToCl expr = { s = table { _ => table { _ => table { _ => table { _=> "$" ++ expr ++ "$" } } } } }; mathIndex a b = a ++ "_" ++ b; exprToCl expr = { s = table { _ => table { _ => table { _ => table { _=> "$" ++ expr ++ "$" } } } } }; --TODO: At least exclude negative polarity!! exprToN expr = lin N { s = table { _ => table { _ => "$" ++ expr ++ "$" } } ; g = Neutr }; -- N = {s : Number => Case => Str ; g : Gender} ; divides_MathBinRel = "\\divides"; lessThan_MathBinRel = "<"; equals_MathBinRel = "="; power_MathBinOp = "^"; xtimes_MathBinOp = "\\times"; i_MathExpr = "i"; n_MathExpr = "n"; m_MathExpr = "m"; ldots_MathExpr = "\\ldots"; bigA_MathExpr = "A"; one_MathExpr = "1"; }
gf/examples.gfs 0 → 100644
 import MathEng.gf parse "we call a positive integer $n$ prime , iff there is no integer $1 < m < n$ such that $m \\divides n$" parse "the empty set is the set withouth elements" parse "we call a set empty , iff it is the empty set" -- Warning: the following sentence has very many parse trees! (last time I checked: 467712) -- parse "we call an $n$ - dimensional cartesian product $A _ 1 \\times \\ldots \\times A _ n$ an $n$ - dimensional cartesian space , iff $A _ i = A$ for some set $A$ for all $i$"
 import MathEng.gf parse "we call a positive integer $n$ prime , iff there is no integer $1 < m < n$ such that $m \\divides n$"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!