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 : N3 -> 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
@@ -126,7 +130,12 @@ incomplete resource Combinators = open Grammar in {
app : N2 -> NP -> NP -> NP
= \n,x,y -> (DetArtSg DefArt (ComplN2 n (ConjNP and_Conj (BaseNP x y)))) ;
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 {

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 : Numeral -> Num ; -- 1. twenty
mkNum : Digits -> Num ; -- 2. 51
mkNum : Card -> Num ; -- 3. twenty
-- 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.
@@ -1136,7 +1137,7 @@ incomplete resource Constructors = open Grammar in {
= \d -> NumCard (NumDigits d) ;
mkNum : Digit -> Num
= \d -> NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 d)))))) ;
mkNum : Card -> Num = NumCard ;
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) ;
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.

View File

@@ -1,11 +1,12 @@
--1 Symbolic: Noun Phrases with mathematical symbols
incomplete resource Symbolic = open Symbol, Grammar in {
incomplete resource Symbolic = open
Symbol, Grammar, PredefCnc in {
oper
symb : overload {
symb : Str -> NP ; -- x
symb : Integer -> NP ; -- 23
symb : Int -> NP ; -- 23
symb : Float -> NP ; -- 0.99
symb : N -> Digits -> NP ; -- level 4
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 -> CN -> Card -> NP ; -- the even number four
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 ;
mkInteger : Predef.Int -> Integer ;
mkFloating : Predef.Float -> Floating ;
mkSymb : Str -> Symb ;
mkInt : Str -> PredefCnc.Int ;
mkFloat : Str -> PredefCnc.Float ;
--.
symb = overload {
symb : Str -> NP
= \s -> UsePN (SymbPN (mkSymb s)) ;
symb : Integer -> NP
symb : Int -> NP
= \i -> UsePN (IntPN i) ;
symb : Floating -> NP
symb : Float -> NP
= \i -> UsePN (FloatPN i) ;
symb : N -> Digits -> NP
= \c,i -> CNNumNP (UseN c) (NumDigits i) ;
@@ -42,15 +46,19 @@ incomplete resource Symbolic = open Symbol, Grammar in {
symb : Det -> N -> Str -> Str -> NP
= \c,n,x,y -> CNSymbNP c (UseN n) (BaseSymb (mkSymb x) (mkSymb y)) ;
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 = <>} ;
mkInteger i = {s = Predef.show Predef.Int i ; lock_Int = <>} ;
mkFloating f = {s = Predef.show Predef.Float f ; lock_Float = <>} ;
mkInt i = {s = i ; lock_Int = <>} ;
mkFloat f = {s = f ; lock_Float = <>} ;
Integer : Type = {s : Str ; lock_Int : {}} ;
Floating : Type = {s : Str ; lock_Float : {}} ;
-- Integer : Type = {s : Str ; lock_Int : {}} ;
-- Floating : Type = {s : Str ; lock_Float : {}} ;
}

View File

@@ -72,7 +72,7 @@
<div id="translator">
<form onsubmit="update(); return false;">
<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>
<label>From: <select id="fromLang" onchange="update()"><option value="" selected="selected">Any language</option></select></label>