completing resource api with things needed in WebALT

This commit is contained in:
aarne
2008-09-12 22:31:13 +00:00
parent 1c16b6b6e2
commit 219eab4c1f
5 changed files with 43 additions and 18 deletions

View File

@@ -34,7 +34,11 @@ incomplete resource Combinators = open Grammar in {
app : N2 -> NP -> NP ; app : N2 -> NP -> NP ;
app : N3 -> NP -> NP -> NP ; app : N3 -> NP -> NP -> NP ;
app : N2 -> NP -> NP -> NP ; app : N2 -> NP -> NP -> NP ;
app : N2 -> N -> CN app : N2 -> N -> CN ;
app : N2 -> NP -> CN ; -- divisor of x
app : N3 -> NP -> NP -> CN ; -- path from x to y
app : N2 -> NP -> NP -> CN ; -- path between x and y
} ; } ;
--2 Coordination --2 Coordination
@@ -126,7 +130,12 @@ incomplete resource Combinators = open Grammar in {
app : N2 -> NP -> NP -> NP app : N2 -> NP -> NP -> NP
= \n,x,y -> (DetArtSg DefArt (ComplN2 n (ConjNP and_Conj (BaseNP x y)))) ; = \n,x,y -> (DetArtSg DefArt (ComplN2 n (ConjNP and_Conj (BaseNP x y)))) ;
app : N2 -> N -> CN app : N2 -> N -> CN
= \f,n -> ComplN2 f (DetArtPl (IndefArt) (UseN n)) = \f,n -> ComplN2 f (DetArtPl (IndefArt) (UseN n)) ;
app : N2 -> NP -> CN = ComplN2 ;
app : N3 -> NP -> NP -> CN = \n,x,y -> ComplN2 (ComplN3 n x) y ;
app : N2 -> NP -> NP -> CN = \n,x,y ->
ComplN2 n (ConjNP and_Conj (BaseNP x y)) ;
} ; } ;
coord = overload { coord = overload {

View File

@@ -0,0 +1,3 @@
--# -path=.:alltenses:prelude
resource CombinatorsSwe = Combinators with (Grammar = GrammarSwe) ;

View File

@@ -444,10 +444,11 @@ incomplete resource Constructors = open Grammar in {
mkNum : overload { mkNum : overload {
mkNum : Numeral -> Num ; -- 1. twenty mkNum : Numeral -> Num ; -- 1. twenty
mkNum : Digits -> Num ; -- 2. 51 mkNum : Digits -> Num ; -- 2. 51
mkNum : Card -> Num ; -- 3. twenty
-- A numeral can be modified by an adnumeral. -- A numeral can be modified by an adnumeral.
mkNum : AdN -> Num -> Num -- 3. almost ten mkNum : AdN -> Card -> Num -- 4. almost ten
} ; } ;
-- Dummy numbers are sometimes to select the grammatical number of a determiner. -- Dummy numbers are sometimes to select the grammatical number of a determiner.
@@ -1136,7 +1137,7 @@ incomplete resource Constructors = open Grammar in {
= \d -> NumCard (NumDigits d) ; = \d -> NumCard (NumDigits d) ;
mkNum : Digit -> Num mkNum : Digit -> Num
= \d -> NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 d)))))) ; = \d -> NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 d)))))) ;
mkNum : Card -> Num = NumCard ;
mkNum : AdN -> Card -> Num = \a,c -> NumCard (AdNum a c) mkNum : AdN -> Card -> Num = \a,c -> NumCard (AdNum a c)
} ; } ;
@@ -1639,6 +1640,10 @@ incomplete resource Constructors = open Grammar in {
those_NP : NP = DetNP (DetQuant that_Quant plNum) ; those_NP : NP = DetNP (DetQuant that_Quant plNum) ;
these_NP : NP = DetNP (DetQuant this_Quant plNum) ; these_NP : NP = DetNP (DetQuant this_Quant plNum) ;
ListAdv : Type = Grammar.ListAdv ;
ListAP : Type = Grammar.ListAP ;
ListNP : Type = Grammar.ListNP ;
ListS : Type = Grammar.ListS ;
{- {-
-- The definite and indefinite articles are commonly used determiners. -- The definite and indefinite articles are commonly used determiners.

View File

@@ -1,11 +1,12 @@
--1 Symbolic: Noun Phrases with mathematical symbols --1 Symbolic: Noun Phrases with mathematical symbols
incomplete resource Symbolic = open Symbol, Grammar in { incomplete resource Symbolic = open
Symbol, Grammar, PredefCnc in {
oper oper
symb : overload { symb : overload {
symb : Str -> NP ; -- x symb : Str -> NP ; -- x
symb : Integer -> NP ; -- 23 symb : Int -> NP ; -- 23
symb : Float -> NP ; -- 0.99 symb : Float -> NP ; -- 0.99
symb : N -> Digits -> NP ; -- level 4 symb : N -> Digits -> NP ; -- level 4
symb : N -> Card -> NP ; -- level four symb : N -> Card -> NP ; -- level four
@@ -13,21 +14,24 @@ incomplete resource Symbolic = open Symbol, Grammar in {
symb : Det -> N -> Card -> NP ; -- the number four symb : Det -> N -> Card -> NP ; -- the number four
symb : Det -> CN -> Card -> NP ; -- the even number four symb : Det -> CN -> Card -> NP ; -- the even number four
symb : Det -> N -> Str -> Str -> NP ; -- the levels i and j symb : Det -> N -> Str -> Str -> NP ; -- the levels i and j
symb : Det -> CN -> [Symb] -> NP -- the basic levels i, j, and k symb : Det -> CN -> [Symb] -> NP ; -- the basic levels i, j, and k
symb : Symb -> S ; -- A
symb : Symb -> Card ; -- n
symb : Symb -> Ord -- n'th
} ; } ;
mkSymb : Str -> Symb ; mkSymb : Str -> Symb ;
mkInteger : Predef.Int -> Integer ; mkInt : Str -> PredefCnc.Int ;
mkFloating : Predef.Float -> Floating ; mkFloat : Str -> PredefCnc.Float ;
--. --.
symb = overload { symb = overload {
symb : Str -> NP symb : Str -> NP
= \s -> UsePN (SymbPN (mkSymb s)) ; = \s -> UsePN (SymbPN (mkSymb s)) ;
symb : Integer -> NP symb : Int -> NP
= \i -> UsePN (IntPN i) ; = \i -> UsePN (IntPN i) ;
symb : Floating -> NP symb : Float -> NP
= \i -> UsePN (FloatPN i) ; = \i -> UsePN (FloatPN i) ;
symb : N -> Digits -> NP symb : N -> Digits -> NP
= \c,i -> CNNumNP (UseN c) (NumDigits i) ; = \c,i -> CNNumNP (UseN c) (NumDigits i) ;
@@ -42,15 +46,19 @@ incomplete resource Symbolic = open Symbol, Grammar in {
symb : Det -> N -> Str -> Str -> NP symb : Det -> N -> Str -> Str -> NP
= \c,n,x,y -> CNSymbNP c (UseN n) (BaseSymb (mkSymb x) (mkSymb y)) ; = \c,n,x,y -> CNSymbNP c (UseN n) (BaseSymb (mkSymb x) (mkSymb y)) ;
symb : Det -> CN -> [Symb] -> NP symb : Det -> CN -> [Symb] -> NP
= CNSymbNP = CNSymbNP ;
symb : Symb -> S = SymbS ;
symb : Symb -> Card = SymbNum ;
symb : Symb -> Ord = SymbOrd
} ; } ;
mkSymb : Str -> Symb = \s -> {s = s ; lock_Symb = <>} ; mkSymb : Str -> Symb = \s -> {s = s ; lock_Symb = <>} ;
mkInteger i = {s = Predef.show Predef.Int i ; lock_Int = <>} ; mkInt i = {s = i ; lock_Int = <>} ;
mkFloating f = {s = Predef.show Predef.Float f ; lock_Float = <>} ; mkFloat f = {s = f ; lock_Float = <>} ;
Integer : Type = {s : Str ; lock_Int : {}} ; -- Integer : Type = {s : Str ; lock_Int : {}} ;
Floating : Type = {s : Str ; lock_Float : {}} ; -- Floating : Type = {s : Str ; lock_Float : {}} ;
} }

View File

@@ -72,7 +72,7 @@
<div id="translator"> <div id="translator">
<form onsubmit="update(); return false;"> <form onsubmit="update(); return false;">
<p> <p>
<input type="text" id="inputText" value="this cheese is warm" size="50" /> <input type="text" id="inputText" value="determine the sine of 1 ." size="50" />
</p> </p>
<p> <p>
<label>From: <select id="fromLang" onchange="update()"><option value="" selected="selected">Any language</option></select></label> <label>From: <select id="fromLang" onchange="update()"><option value="" selected="selected">Any language</option></select></label>