1
0
forked from GitHub/gf-rgl

Merge branch 'master' into new-website

# Conflicts:
#	doc/Makefile
This commit is contained in:
John J. Camilleri
2018-11-28 22:44:08 +01:00
48 changed files with 1313 additions and 174348 deletions

View File

@@ -20,6 +20,8 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then alias gf='gf.exe' && alias runghc='runghc.exe' ; fi
script:
- runghc Make.hs build prelude all --verbose ; rm -rf dist
- bash Make.sh --dest=dist-bash --verbose ; rm -rf dist
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cmd //c Make.bat --dest=dist-bat --verbose ; fi
- runghc Setup.hs build prelude all --verbose
- rm -rf dist
- mkdir dist-bash ; bash Setup.sh --dest=dist-bash --verbose
- rm -rf dist ; mkdir dist-bat
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cmd //c Setup.bat --dest=dist-bat --verbose ; fi

206
LICENSE Normal file
View File

@@ -0,0 +1,206 @@
The GF Resource Grammar Library is under GNU LESSER GENERAL PUBLIC LICENSE and BSD.
However the user has the right to choose any license for any application grammar derived from the resource grammar by using the grammar API.
The Resource Grammar Library also includes large coverage lexicons for some languages.
Since these lexicons are derived from external sources they might be under different licenses.
Look at the source file for every lexicon for details.
The rest of this document contains copies of the LGPL and BSD licenses
which are applicable to the different components of the Resource Grammar Library as described above.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
BSD LICENSE
Copyright (c) 1998, Grammatical Framework
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,6 +1,6 @@
# A simple wrapper over the Haskell-based RGL build script
RUNMAKE=runghc Make.hs
RUNMAKE=runghc Setup.hs
.PHONY: build copy install doc clean

View File

@@ -12,9 +12,9 @@ For more about the RGL, see the [synopsis page](http://www.grammaticalframework.
There are 3 ways to build and install the RGL:
- Haskell script `Make.hs`
- Shell script `Make.sh` (does not require Haskell)
- Windows batch file `Make.bat` (does not require Haskell)
- Haskell script `Setup.hs`
- Shell script `Setup.sh` (does not require Haskell)
- Windows batch file `Setup.bat` (does not require Haskell)
## Install locations
@@ -31,23 +31,23 @@ A list of all languages and their properties is maintained centrally in [`langua
This file should be kept up-to-date and all build methods should read this config file.
**If you see something wrong, please report/fix it.**
| Column | Description | Default |
|:--------------|:-----------------------------------------|:-------:|
| Code | e.g. `Eng` | - |
| Name | language name in English, e.g. `English` | - |
| Directory | folder name under `src`, e.g. `english` | - |
| Functor | (not used) | - |
| Unlexer | (not used) | - |
| Present | language is marked with `--# notpresent` | n |
| All | compile `All` module | y |
| Try | compile `Try` module | y |
| Symbolic | compile `Symbolic` module | y |
| Compatibility | complile `Compatibility` module | n |
| Synopsis | include language in the RGL synopsis | n |
| # | Column | Description | Default |
|:---|:--------------|:-----------------------------------------|:-------:|
| 1 | Code | 3-letter language code, e.g. `Eng` | - |
| 2 | Name | language name in English, e.g. `English` | - |
| 3 | Directory | folder name under `src`, e.g. `english` | - |
| 4 | Functor | functor name (not used) | - |
| 5 | Unlexer | unlexer (not used) | - |
| 6 | Present | language is marked with `--# notpresent` | n |
| 7 | All | compile `All` module | y |
| 8 | Try | compile `Try` module | y |
| 9 | Symbolic | compile `Symbolic` module | y |
| 10 | Compatibility | complile `Compatibility` module | n |
| 11 | Synopsis | include language in the RGL synopsis | n |
If default is `y` then anything other than `n`, including the empty string, is treated as true (and vice versa when default is `n`).
## Haskell script: `Make.hs`
## Haskell script: `Setup.hs`
This build method gives you most options.
You will need Haskell installed on your system.
@@ -69,7 +69,7 @@ There is also `make clean` available.
For more fine-grained control over the build process, you can run the build script directly:
```
runghc Make ...
runghc Setup.hs ...
```
Where `...` is one of:
@@ -99,7 +99,7 @@ If ommitted, the default command is `prelude all`.
- The path to GF installed on your system can be specified via the `--gf` flag (default is that the `gf` executable is in the global system path).
- The `--dest` flag can be used to manually specify where the compiled RGL modules should be copied/installed. This is the same place as `GF_LIB_PATH`.
## Shell script: `Make.sh`
## Shell script: `Setup.sh`
This method is provided as an alternative for those who don't have Haskell installed.
Simply run the script to build the entire RGL and install in the default location.
@@ -109,11 +109,11 @@ You can pass the following flags:
- `--gf=...` to specify the path to the `gf` executable, if not available on the system path
- `--verbose` or `-v` to show a list of files being built (errors will always be shown)
## Windows batch file: `Make.bat`
## Windows batch file: `Setup.bat`
This method is provided as an alternative for Windows users who don't have Haskell or Bash installed.
It is supposed to be a port of `Make.sh` and works in largely the same way.
It is supposed to be a port of `Setup.sh` and works in largely the same way.
In particular, it accepts the same flags (in the same format) as described above.
However it currently tries to build all modules for all languages and doesn't consider the details of which modules should be compiled for each language (specified in `languages.csv`)

View File

@@ -29,11 +29,28 @@ goto Loop
REM Try to determine install location
if "%dest%"=="" (
set dest=%GF_LIB_PATH%
REM Separate paths with search path separator ; and pick first one
for %%p in ("%GF_LIB_PATH:;=";"%") do (
set dest=%%~p
goto BreakLibPath
)
)
:BreakLibPath
set DATA_DIR=..\gf-core\DATA_DIR
if "%dest%"=="" (
REM TODO Look in ../gf-core/DATA=DIR
REM Look in already compiled GF folder
if exist %DATA_DIR% (
for /f "delims=" %%x in (%DATA_DIR%) do (
if not "%%x"=="" (
set dest=%%x\lib
goto BreakDataDir
)
)
)
)
:BreakDataDir
if "%dest%"=="" (
echo Unable to determine where to install the RGL. Please do one of the following:
echo - Pass the --dest=... flag to this script

View File

@@ -9,7 +9,7 @@ import System.IO.Error (catchIOError)
import System.Exit (ExitCode(..),exitFailure)
import System.Environment (getArgs,lookupEnv)
import System.Process (rawSystem)
import System.FilePath ((</>)) -- ,takeFileName,addExtension,dropExtension)
import System.FilePath ((</>),splitSearchPath) -- ,takeFileName,addExtension,dropExtension)
import System.Directory (createDirectoryIfMissing,copyFile,getDirectoryContents,removeDirectoryRecursive,findFile)
#if __GLASGOW_HASKELL__>=800
import System.Directory (getModificationTime,setModificationTime)
@@ -119,7 +119,7 @@ mkInfo = do
-- Look for install location in a few different places
let mflag = getFlag destination_flag args
mbuilt <- catchIOError (readFile "../gf-core/DATA_DIR" >>= \d -> return (Just (d </> "lib"))) (\e -> return Nothing)
menvar <- lookupEnv "GF_LIB_PATH"
menvar <- lookupEnv "GF_LIB_PATH" >>= return . fmap (head . splitSearchPath)
let
inst_dir =
case catMaybes [mflag,menvar,mbuilt] of

View File

@@ -36,7 +36,7 @@ done
# Try to determine install location
if [ -z "$dest" ]; then
dest="$GF_LIB_PATH"
dest=$(echo "$GF_LIB_PATH" | sed 's/:.*$//')
fi
if [ -z "$dest" ] && [ -f "../gf-core/DATA_DIR" ]; then
dest=$(cat ../gf-core/DATA_DIR)

View File

@@ -79,6 +79,7 @@ cat
fun
timeunitAdv : Card -> Timeunit -> Adv ; -- (for) three hours
timeunitRange : Card -> Card -> Timeunit -> Adv ; -- (cats live) ten to twenty years
oneHour : Hour ;
twoHour : Hour ;
@@ -105,8 +106,8 @@ fun
twentyThreeHour : Hour ;
twentyFourHour : Hour ;
timeHour : Hour -> Adv ; -- at three (o'clock / am / pm)
timeHourMinute : Hour -> Card -> Adv ; -- at forty past six
timeHour : Hour -> Adv ; -- at three a.m./p.m.
timeHourMinute : Hour -> Card -> Adv ; -- at six forty a.m./p.m.
weekdayPunctualAdv : Weekday -> Adv ; -- on Monday
weekdayHabitualAdv : Weekday -> Adv ; -- on Mondays

View File

@@ -70,7 +70,7 @@ abstract Sentence = Cat ** {
-- This covers subjunctive clauses, but they can also be added to the end.
SSubjS : S -> Subj -> S -> S ; -- I go home if she comes
SSubjS : S -> Subj -> S -> S ; -- I go home, if she comes
-- A sentence can be modified by a relative clause referring to its contents.

View File

@@ -44,4 +44,6 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in {
s = \\h,g,n,d,c => a.s ! AComp d c
};
-- : Ord -> AP ; -- warmest
AdjOrd ord = {s = \\h,g,n,s,c => ord.s ! g ! s ! c} ;
}

View File

@@ -2,21 +2,24 @@ concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in {
flags coding=utf8;
lin
PositAdvAdj a = {s = a.s ! APosit Masc Sg Indef Acc} ;
-- ComparAdvAdj cadv a np = {
-- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ np.s ! Gen
-- } ;
-- ComparAdvAdjS cadv a s = {
-- s = cadv.s ++ a.s ! AAdv ++ "تهَن" ++ s.s
-- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ s.s
-- } ;
PrepNP prep np = {s = prep.s ++ np.s ! prep.c} ;
-- AdAdv = cc2 ;
--
-- SubjS = cc2 ;
AdAdv ad av = cc2 av ad ;
-- : Subj -> S -> Adv ; -- when she sleeps
SubjS subj s = {s = subj.s ++ s.s ! subj.o} ;
-- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing
--
-- AdnCAdv cadv = {s = cadv.s ++ "تهَن"} ;
--
AdnCAdv cadv = {s = cadv.s ++ "مِنْ"} ;
}

View File

@@ -1,3 +1,3 @@
--# -path=.:../abstract:../common:../prelude
--# -path=.:../abstract:../common:../api:../prelude
concrete AllAra of AllAraAbs = LangAra ;

View File

@@ -11,9 +11,9 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
-- Tensed/Untensed
SSlash,
S = {s : Str} ;
S = {s : Order => Str} ; -- subordinate clause has nominal word order and subject in acc
QS = {s : QForm => Str} ;
RS = {s : Agr => Case => Str} ;
RS = {s : Agr => Case => Str} ; -- case because the relative pronoun inflects in case
-- Sentence
@@ -38,7 +38,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
VP = ResAra.VP ;
VPSlash = ResAra.VPSlash ; -- VP ** {c2:Preposition}
Comp = ResAra.Comp ; --{s : AAgr => Case => Str} ;
Comp = ResAra.Comp ** {obj : Obj ; isNP : Bool} ;
-- SC = {s : Str} ;
--
-- Adjective
@@ -72,15 +72,17 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
Conj = {s : Str ; n : ResAra.Number} ;
-- DConj = {s1,s2 : Str ; n : ResAra.Number} ;
-- Subj = {s : Str} ;
Subj = {s : Str ; o : Order} ;
Prep = ResAra.Preposition ;
-- Open lexical classes, e.g. Lexicon
V, VS, VQ, VA = ResAra.Verb ; -- = {s : VForm => Str} ;
V2, V2A = ResAra.Verb2 ;
VV, V2S, V2Q = ResAra.Verb2 ;
V2V, V3 = ResAra.Verb3 ;
VV = ResAra.Verb2 ** {sc : Preposition} ; -- c2 is for verb
V2S, V2Q = ResAra.Verb2 ;
V3 = ResAra.Verb3 ;
V2V = ResAra.Verb3 ** {sc : Preposition} ; -- c3 is for verb, c2 is for dir.obj
A = ResAra.Adj ;
A2 = ResAra.Adj2 ;
@@ -94,5 +96,6 @@ linref
CN = \cn -> uttCN cn ! Masc ;
N = \n -> uttCN (useN n) ! Masc ;
VP = \vp -> uttVP vp ! Masc ;
}

View File

@@ -1,45 +1,82 @@
concrete ConjunctionAra of Conjunction =
CatAra ** open ResAra, Coordination, Prelude in {
--
-- flags optimize=all_subs ;
--
-- lin
--
-- ConjS = conjunctSS ;
-- DConjS = conjunctDistrSS ;
--
-- ConjAdv = conjunctSS ;
-- DConjAdv = conjunctDistrSS ;
--
-- ConjNP conj ss = conjunctTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
-- DConjNP conj ss = conjunctDistrTable Case conj ss ** {
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
-- } ;
--
-- ConjAP conj ss = conjunctTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
-- DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
-- isPre = ss.isPre
-- } ;
--
---- These fun's are generated from the list cat's.
--
-- BaseS = twoSS ;
-- ConsS = consrSS comma ;
-- BaseAdv = twoSS ;
-- ConsAdv = consrSS comma ;
-- BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
-- ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
-- BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
-- ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
--
-- lincat
-- [S] = {s1,s2 : Str} ;
-- [Adv] = {s1,s2 : Str} ;
-- [NP] = {s1,s2 : Case => Str ; a : Agr} ;
-- [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
--
lincat
[S] = {s1,s2 : Order => Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : Case => Str ; a : Agr ; empty : Str} ;
[AP] = {s1,s2 : Species => Gender => Number => State => Case => Str} ;
lin
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
ConjAdv = conjunctSS ;
BaseS = twoTable Order ;
ConsS = consrTable Order comma ;
ConjS = conjunctTable Order ;
BaseNP x y = twoTable Case x y ** {
a = conjAgr x.a y.a ;
empty = []
} ;
ConsNP xs x = consrTable Case comma xs x ** {
a = conjAgr xs.a x.a ;
empty = []
} ;
ConjNP conj ss = conjunctTable Case conj ss ** {
a = let gn = pgn2gn ss.a.pgn in
{pgn = Per3 gn.g (conjNumber conj.n gn.n) ; isPron = False} ;
empty = []
} ;
BaseAP = twoTable5 Species Gender Number State Case ;
ConsAP = consrTable5 Species Gender Number State Case comma ;
ConjAP = conjunctTable5 Species Gender Number State Case ;
oper
conjAgr : Agr -> Agr -> Agr = \a,b -> {
isPron = False ;
pgn = let gnA = pgn2gn a.pgn ; gnB = pgn2gn b.pgn in
Per3 (conjGender gnA.g gnB.g) (conjNumber gnA.n gnB.n)
} ;
conjGender : Gender -> Gender -> Gender = \g,h ->
case g of {Fem => h ; _ => Masc} ;
conjNumber : Number -> Number -> Number = \m,n ->
case m of {Sg => n ; _ => Pl} ;
-- move to predef?
ListTable5 : PType -> PType -> PType -> PType -> PType -> Type = \P,Q,R,T,S ->
{s1,s2 : P => Q => R => T => S => Str} ;
twoTable5 : (P,Q,R,T,S : PType) -> (_,_ : {s : P => Q => R => T => S => Str}) ->
ListTable5 P Q R T S =
\_,_,_,_,_,x,y ->
{s1 = x.s ; s2 = y.s} ;
consrTable5 :
(P,Q,R,T,S : PType) -> Str -> {s : P => Q => R => T => S => Str} ->
ListTable5 P Q R T S -> ListTable5 P Q R T S =
\P,Q,R,T,S,c,x,xs ->
{s1 = \\p,q,r,t,s => xs.s1 ! p ! q ! r ! t ! s ++ c ++ xs.s2 ! p ! q ! r ! t ! s ;
s2 = x.s
} ;
conjunctTable5 :
(P,Q,R,T,S : PType) -> Conjunction -> ListTable5 P Q R T S -> {s : P => Q => R => T => S => Str} =
\P,Q,R,T,S,or,xs ->
{s = \\p,q,r,t,s => xs.s1 ! p ! q ! r ! t ! s ++ or.s ++ xs.s2 ! p ! q ! r ! t ! s} ;
-- conjunctDistrTable5 :
-- (P,Q,R,T,S : PType) -> ConjunctionDistr -> ListTable5 P Q R T S ->
-- {s : P => Q => R => T => S => Str} =
-- \P,Q,R,T,S,or,xs ->
-- {s = \\p,q,r,t,s => or.s1++ xs.s1 ! p ! q ! r ! t ! s ++ or.s2 ++ xs.s2 ! p ! q ! r ! t ! s} ;
}

View File

@@ -1,8 +1,10 @@
concrete ConstructionAra of Construction = CatAra ** open
Prelude,
ParadigmsAra,
SyntaxAra,
SymbolicAra,
StructuralAra,
(E=ExtendAra),
(R=ResAra),
(L=LexiconAra) in {
@@ -39,19 +41,26 @@ lin
-- n_units_AP
oper
-- hack used in the name constructions
toNP : Bool -> NP -> NP = \b -> if_then_else NP b R.emptyNP ;
lin
-- : NP -> NP -> Cl
have_name_Cl pe nm =
let subjPron : Pron = case pe.a.isPron of {
True => pe ;
False => case (R.pgn2gn pe.a.pgn).g of {
R.Fem => she_Pron ;
R.Masc => he_Pron }
} ;
have_name_Cl np nm =
let subjPron : Pron = R.np2pron np ;
me : NP = toNP np.a.isPron np ;
myName : NP = E.ApposNP me (mkNP (mkDet subjPron) L.name_N) ;
in mkCl myName nm ;
myName : NP = mkNP (mkDet subjPron) L.name_N ;
in mkCl myName nm ; --TODO: now it only works for pronouns, drops the NP
-- what_name_QCl =
-- : NP -> QCl
what_name_QCl np =
let subjPron : Pron = R.np2pron np ;
me : R.NP = toNP np.a.isPron np ;
myName : NP = E.ApposNP me (mkNP (mkDet subjPron) L.name_N) ;
what_IP : R.IP = R.mkIP "مَا هُوَ" R.Sg ;
in mkQCl what_IP myName ;
-- how_old_QCl
@@ -76,7 +85,7 @@ lin
oper mkLanguage : Str -> N = mkN ;
----------------------------------------------
---- lexicon of special names
---- lexicon of snpcial names
-- TODO in arabic
lin second_Timeunit = mkN "second" ;
@@ -131,7 +140,7 @@ lin finnish_Language = mkLanguage "فِنْلَنْدِيّة" ;
-- lin maltese_Language = mkLanguage "Maltese" ;
-- lin nepali_Language = mkLanguage "Nepali" ;
-- lin norwegian_Language = mkLanguage "Norwegian" ;
lin persian_Language = mkLanguage "فَارِسيّة" ;
lin nprsian_Language = mkLanguage "فَارِسيّة" ;
-- lin polish_Language = mkLanguage "Polish" ;
-- lin punjabi_Language = mkLanguage "Punjabi" ;
-- lin romanian_Language = mkLanguage "Romanian" ;

View File

@@ -6,34 +6,54 @@ concrete ExtendAra of Extend =
StrandRelSlash, ExistPluralCN, ExistMassCN, ExistCN, EmptyRelSlash, DetNPMasc, DetNPFem,
ComplBareVS, ComplDirectVS, ComplDirectVQ,
ICompAP,
VPS, MkVPS
VPS, MkVPS, PredVPS, BaseVPS, ConsVPS, ConjVPS,
ApposNP
]
with (Grammar=GrammarAra)
** open
Prelude,
ParamX,
ResAra,
ParamX
Prelude,
Coordination
in {
lin
GenNP np = {s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum,isPron,is1sg = False} ;
-- : NP -> NP -> NP
ApposNP np1 np2 = np2 ** {s = \\c => np1.s ! c ++ np2.s ! c} ;
-- : AP -> IComp ; -- "how old"
ICompAP ap = {s = \\gn => "كَمْ" ++ ap.s ! NoHum ! gn.g ! gn.n ! Indef ! Acc} ;
lincat
VPS = VP ; -- finite VP's with tense and polarity
VPS = {s : PerGenNum => Str} ; -- finite VP's with tense and polarity
[VPS] = {s1,s2 : PerGenNum => Str} ;
lin
-- : Temp -> Pol -> VP -> VPS ; -- hasn't slept
MkVPS t p vp = lin VPS (vp ** {
s = \\pgn,vf => case <t.t,t.a> of { --- IL guessed tenses
<(Pres|Fut),Simul> => vp.s ! pgn ! VPImpf Ind ;
<Cond,_ > => vp.s ! pgn ! VPImpf Cnj ;
<_ ,_ > => vp.s ! pgn ! VPPerf
}
}) ;
MkVPS t p vp = {
s = \\pgn => let vps =
wordOrderNoSubj
Nominal -- Nominal (=SVO) generalises best for ConjVPS.
vp.obj.a.isPron
(vStr vp pgn t.t p.p Nominal)
(case <vp.isPred,vp.obj.a.isPron> of {
<False,True> => BIND ++ vp.obj.s ;
_ => vp.obj.s })
(pred vp pgn t.t p.p)
vp.s2
in vps.before ++ vps.after -- word order is SVO, so this is safe for just this case.
} ;
BaseVPS = twoTable PerGenNum ;
ConsVPS = consrTable PerGenNum comma ;
ConjVPS = conjunctTable PerGenNum ;
PredVPS np vps = {
s = \\_ => np.s ! Nom ++ vps.s ! np.a.pgn -- first quick version with order always Nominal.
} ; -- if necessary, change VPS into {s : PerGenNum => Order => {before,after : Str}}
}

View File

@@ -1,15 +1,63 @@
concrete IdiomAra of Idiom = CatAra ** open Prelude, ResAra in {
flags coding=utf8;
--
-- flags optimize=all_subs ;
--
-- lin
-- ExistNP np =
-- mkClause "تهري" (agrP3 np.a.n) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ;
-- ImpersCl vp = mkClause "ِت" (agrP3 Sg) vp ;
-- GenericCl vp = mkClause "ْني" (agrP3 Sg) vp ;
--
-- ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ;
--
}
concrete IdiomAra of Idiom = CatAra ** open
Prelude,
ResAra,
VerbAra,
ParadigmsAra
in {
lin
-- : VP -> Cl ; -- it is hot
ImpersCl vp =
let it : ResAra.NP = case vp.isPred of {
True => pron2np (pgn2pron vp.obj.a.pgn) ;
False => pgn2pron vp.obj.a.pgn } ; -- if no obj, Per3 Masc Sg chosen by default
in predVP it vp ;
-- : VP -> Cl ; -- one sleeps
GenericCl = predVP (regNP "المَرْء" Sg) ;
-- : NP -> RS -> Cl ; -- it is I who did it
--CleftNP np rs =
-- : Adv -> S -> Cl ; -- it is here she slept
CleftAdv adv s =
let comp : Comp = CompAdv (lin Adv {s = adv.s ++ s.s ! Verbal}) ; -- no idea about word order /IL
pass_V = mkV "مضي" va vi ; -- switch to copula or some other verb if better /IL
in predVP emptyNP (UseV pass_V ** {isPred=True ; pred=comp}) ; -- very hacky /IL
-- : NP -> Cl ; -- there is a house
ExistNP np =
predVP (emptyNP ** {s=\\c=>"هُنَاكَ"}) (UseComp (CompNP np)) ; -- IL
-- ExistIP : IP -> QCl ; -- which houses are there
-- 7/12/2012 generalizations of these
-- : NP -> Adv -> Cl ; -- there is a house in Paris
ExistNPAdv np adv =
predVP (emptyNP ** {s=\\c=>"هُنَاكَ"}) (AdvVP (UseComp (CompNP np)) adv) ; -- IL
-- ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris
-- ProgrVP : VP -> VP ; -- be sleeping
-- ImpPl1 : VP -> Utt ; -- let's go
-- ImpP3 : NP -> VP -> Utt ; -- let John walk
-- 3/12/2013 non-reflexive uses of "self"
-- : VP -> VP ; -- is at home himself; is himself at home
SelfAdvVP,
SelfAdVVP = \vp -> vp ** {
s = \\pgn,vf => vp.s ! pgn ! vf ++ reflPron Nom pgn
} ;
-- : NP -> NP ; -- the president himself (is at home)
SelfNP np = np ** {
s = \\c => np.s ! c ++ reflPron c (np.a.pgn)
} ;
}

View File

@@ -1,8 +1,9 @@
--# -path=.:../abstract:../common:../prelude
--# -path=.:../abstract:../common:../api:../prelude
concrete LangAra of Lang =
GrammarAra,
LexiconAra
LexiconAra,
ConstructionAra
** {
flags startcat = Phr ; unlexer = text ; lexer = text ; coding = utf8 ;

View File

@@ -73,7 +73,7 @@ flags
door_N = brkN "بوب" "فاع" "أَفعَال" Masc NoHum ;
drink_V2 = dirV2 (regV "شَرِب") ;
-- drink_V2 = dirV2 (v1 "شرب" i a) ;
easy_A2V = mkA2 (sndA "سهل" "فَعل") "لِ" ;
easy_A2V = mkA2 (sndA "سهل" "فَعل") liPrep ;
eat_V2 = dirV2 (mkV "ءكل" FormI) ;
empty_A = sndA "فرغ" "فاعِل" ;
enemy_N = brkN "عدو" "فَعُلّ" "أَفعَاء" Masc Hum ;
@@ -203,7 +203,7 @@ flags
switch8off_V2 = dirV2 (v4 "طفء") ;
switch8on_V2 = dirV2 (v4 "شعل") ;
table_N = sdfN "طول" "فاعِلة" Fem NoHum ;
talk_V3 = mkV3 (v5 "حدث") "لِ" "عَن" ;
talk_V3 = mkV3 (v5 "حدث") liPrep (mkPrep "عَن") ;
teacher_N = sdmN "علم" "مُفَعِّل" Masc Hum ; --mucal~imö
teach_V2 = dirV2 (v2 "علم") ;
television_N = mkN (sndf "تِلِفِزيُون") Masc NoHum ;

View File

@@ -3,42 +3,21 @@ resource MissingAra = open GrammarAra, Prelude in {
-- temporary definitions to enable the compilation of RGL API
oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ;
oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ;
oper AdjOrd : Ord -> AP = notYet "AdjOrd" ;
oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ;
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvS : Adv -> S -> S = notYet "AdvS" ;
oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ;
oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ;
oper BaseNP : NP -> NP -> ListNP = notYet "BaseNP" ;
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ;
oper BaseS : S -> S -> ListS = notYet "BaseS" ;
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ;
oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ;
oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ;
oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ;
oper ComplVS : VS -> S -> VP = notYet "ComplVS" ;
oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
oper ConjNP : Conj -> ListNP -> NP = notYet "ConjNP" ;
oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ;
oper ConjS : Conj -> ListS -> S = notYet "ConjS" ;
oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ;
oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ;
oper ConsNP : NP -> ListNP -> ListNP = notYet "ConsNP" ;
oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ;
oper ConsS : S -> ListS -> ListS = notYet "ConsS" ;
oper DetNP : Det -> NP = notYet "DetNP" ;
oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
oper EmbedS : S -> SC = notYet "EmbedS" ;
oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
oper ExistIP : IP -> QCl = notYet "ExistIP" ;
oper ExistNP : NP -> Cl = notYet "ExistNP" ;
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ;
oper GenericCl : VP -> Cl = notYet "GenericCl" ;
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper PConjConj : Conj -> PConj = notYet "PConjConj" ;
@@ -54,8 +33,6 @@ oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;
oper VocNP : NP -> Voc = notYet "VocNP" ;

View File

@@ -34,7 +34,7 @@ flags optimize = all ;--noexpand;
case g of {
Masc => waHid;
Fem => waHida
} in defArt state waHid + word + dec1sg ! state ! c;
} in defArt state c waHid + word + dec1sg ! state ! c;
n = num;
d = state;
isPron = False;

View File

@@ -6,15 +6,20 @@ lin
DetCN det cn = let {
cas : Case -> Case = if_then_else Case det.is1sg Bare ;
number = sizeToNumber det.n ;
number = case cn.isDual of {
True =>
case sizeToNumber det.n of {
Sg => Sg ;
_ => Dl } ;
False => sizeToNumber det.n } ;
determiner : Case -> Str = \c ->
det.s ! cn.h ! (detGender cn.g det.n) ! c ;
noun : Case -> Str = \c ->
cn.s ! number
! nounState det.d number
! nounCase c det.n det.d ;
adj : NTable -> Case -> Str = \ntable,c ->
ntable ! number
adj : Case -> Str = \c ->
cn.s2 ! number
! (definite ! det.d) -- Indef remains Indef, rest become Def
! c
} in {
@@ -22,13 +27,11 @@ lin
case cnB4det det.isPron det.isNum det.n det.d of {
False => determiner c
++ noun c
++ adj cn.s2 c
++ adj cn.adj c
++ adj c
++ cn.np ! c ;
True => noun (cas c) -- deal with possessive suffix
++ determiner c
++ adj cn.s2 c
++ adj cn.adj c
++ determiner c -- (nounCase c det.n det.d) --??
++ adj c
++ cn.np ! c
};
a = { pgn = agrP3 cn.h cn.g number;
@@ -44,6 +47,8 @@ lin
UsePron p = p ;
DetNP det = emptyNP ** {s = det.s ! NoHum ! Masc} ; ----
PredetNP pred np = np ** {
s = \\c => case pred.isDecl of {
True => pred.s!c ++ np.s ! Gen ; -- akvaru l-awlAdi
@@ -66,26 +71,15 @@ lin
AdvNP np adv = np ** {
s = \\c => np.s ! c ++ adv.s
};
{-
DetSg quant ord = {
s = \\h,g,c =>
quant.s ! Sg ! h ! g ! c ++ ord.s ! g ! quant.d ! c ;
n = One;
d = quant.d;
isPron = quant.isPron;
isNum =
case ord.n of {
None => False;
_ => True
}
} ;
-}
DetQuantOrd quant num ord = quant ** {
s = \\h,g,c => quant.s ! Pl ! h ! g ! c
++ num.s ! g ! (toDef quant.d num.n) ! c
s = \\h,g,c => let d = toDef quant.d num.n in
quant.s ! Pl ! h ! g ! c
++ num.s ! g ! d ! c
--FIXME check this:
++ ord.s ! g ! (toDef quant.d num.n) ! c ;
++ ord.s ! g
! case d of {Poss => Def ; _ => d}
! c ;
n = num.n;
isNum = orB num.isNum ord.isNum ;
-- ord may come from OrdDigits or OrdNumeral
@@ -105,7 +99,7 @@ lin
} ;
PossPron p = {
s = \\_,_,_,_ => p.s ! Gen;
s = \\_,_,_,_ => BIND ++ p.s ! Gen;
d = Poss;
is1sg = case p.a.pgn of { Per1 Sing => True ; _ => False } ;
isPron = True;
@@ -169,38 +163,39 @@ lin
isNum,isPron,is1sg = False
} ;
MassNP cn = ---- AR
{s = \\c => cn.s ! Sg ! Indef ! c ++ cn.np ! c ++ cn.adj ! Sg ! Indef ! c ;
MassNP cn =
{s = \\c => cn2str cn Sg Indef c ;
a = {pgn = Per3 cn.g Sg ; isPron = False} ;
empty = []} ;
-- MassDet = {s = \\_,_,_,_ => [] ; d = Indef;
-- isNum = False; isPron = False} ;
UseN,
UseN2 = useN ;
Use2N3 n3 = n3 ;
Use3N3 n3 = n3 ** {c2 = n3.c3} ;
ComplN2 n2 np = UseN n2 ** {np=np.s} ;
ComplN2 n2 np = UseN n2 ** {np = \\c => n2.c2.s ++ np.s ! n2.c2.c} ;
ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ;
AdjCN ap cn = cn ** {
adj = \\n,d,c => cn.adj ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c
s2 = \\n,d,c => cn.s2 ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c
};
RelCN cn rs = cn ** {s = \\n,s,c => cn.s ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c};
RelCN cn rs = cn ** {
s2 = \\n,s,c => cn.s2 ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c};
RelNP np rs = np ** {s = \\c => np.s ! c ++ rs.s ! np.a ! c} ;
-- AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ;
--
-- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ;
AdvCN,
SentCN = \cn,ss -> cn ** {s2 = \\n,d,c => cn.s2 ! n ! d ! c ++ ss.s} ;
ApposCN cn np = cn ** { np = \\c => cn.np ! c ++ np.s ! c } ;
-- : CN -> NP -> CN ; -- house of Paris, house of mine
PossNP cn np = cn ** {
s = \\n,_d,c => cn.s ! n ! Const ! c ;
s2 = \\n,_d,c => cn.s2 ! n ! Const ! Gen ; -- unsure about this /IL
np = \\c => cn.np ! c ++ np.s ! Gen
};

View File

@@ -50,6 +50,10 @@ resource ParadigmsAra = open
masc : Gender ;
fem : Gender ;
Number : Type ;
sg : Number ;
pl : Number ;
Species : Type ;
hum : Species ;
nohum : Species ;
@@ -71,11 +75,14 @@ resource ParadigmsAra = open
mkN : NTable -> Gender -> Species -> N ; -- loan words, irregular
mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N ; -- broken plural
mkN : N -> (attr : Str) -> N ; -- Compound noun with invariant attribute
mkN : N -> N -> N ; -- Compound noun where both parts inflect
mkN : N -> N -> N ; -- Compound noun where attribute inflects in state and case. Attribute in singular.
mkN : Number -> N -> N -> N ; -- Compound noun where attribute inflects in state and case. Attribute's number specified by 1st arg.
--- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural
--- = sdfN ;
} ;
dualN : N -> N ; -- Force the plural of the N into dual (e.g. "twins")
--This is used for loan words or anything that has untreated irregularities
--in the interdigitization process of its words
mkFullN : NTable -> Gender -> Species -> N ;
@@ -99,7 +106,7 @@ resource ParadigmsAra = open
mkPN : Str -> PN -- Fem Hum if ends with ة, otherwise Masc Hum
= smartPN ;
mkPN : N -> PN
= \n -> lin PN (n ** {s = \\c => n.s ! Sg ! Const ! Bare}) ; -- no idea /IL
= \n -> lin PN (n ** {s = \\c => n.s ! Sg ! Const ! c ++ n.s2 ! Sg ! Const ! c }) ; -- no idea /IL
mkPN : Str -> Gender -> Species -> PN
= mkFullPN ;
} ;
@@ -112,7 +119,7 @@ resource ParadigmsAra = open
mkN2 : overload {
mkN2 : N -> Preposition -> N2 ; -- ready-made preposition
mkN2 : (mother : N) -> (of_ : Str) -> N2 ; -- preposition given as a string
mkN2 : N -> Str -> N2 ; -- preposition given as a string
mkN2 : N -> N2 ; -- no preposition
mkN2 : Str -> N2 ; -- no preposition, predictable inflection
} ;
@@ -128,16 +135,15 @@ resource ParadigmsAra = open
-- Overloaded operator for main cases
mkA = overload {
mkA : (root,patt : Str) -> A
mkA : (root,sg : Str) -> A -- adjective with sound plural; takes root string and sg. pattern string
= \r,p -> lin A (sndA r p);
mkA : (root : Str) -> A -- forms adjectives with positive form aFCal
mkA : (root : Str) -> A -- adjective with positive form aFCal
= \r -> lin A (clrA r);
mkA : (root,sg,pl : Str) -> A
mkA : (root,sg,pl : Str) -> A -- adjective with broken plural
= \r,s,p -> lin A (brkA r s p) ;
-- mkA : (posit,compar,plur : Str) -> A
-- = degrA ;
} ;
degrA : (posit,compar,plur : Str) -> A ;
--Takes a root string and a pattern string
sndA : (root,patt : Str) -> Adj ;
@@ -145,6 +151,8 @@ resource ParadigmsAra = open
--Takes a root string only
clrA : (root : Str) -> Adj ; -- forms adjectives of type aFCal
nisbaA : Str -> Adj ; -- forms relative adjectives by adding the suffix ِيّ
--3 Two-place adjectives
--
-- Two-place adjectives need a preposition for their second argument.
@@ -166,6 +174,13 @@ resource ParadigmsAra = open
mkAdA : Str -> AdA ;
mkInterj : Str -> Interj ;
mkSubj : overload {
mkSubj : Str -> Subj ; -- Default order Subord (=noun first and in accusative)
mkSubj : Str -> Order -> Subj -- Specify word order
} ;
--2 Prepositions
--
-- A preposition as used for rection in the lexicon, as well as to
@@ -180,47 +195,33 @@ resource ParadigmsAra = open
-- Overloaded operations
mkV : overload {
mkV : (imperfect : Str) -> V ;
mkV : (imperfect : Str) -> V ; -- The verb in Per3 Sg Masc imperfect tense gives the most information
mkV : (root : Str) -> (perf,impf : Vowel) -> V ; -- verb form I ; vowel = a|i|u
mkV : (root : Str) -> VerbForm -> V ; -- FormI .. FormX (no VII, IX) ; default vowels a u for I
mkV : V -> (particle : Str) -> V -- V with a non-inflecting particle/phrasal verb
} ;
-- The verb in the imperfect tense gives the most information
-- regV : Str -> V ;
regV : Str -> V ;
reflV : V -> V ; -- نَفْس in the proper case and with possessive suffix, e.g. نَفْسَكِ
--Verb Form I : fa`ala, fa`ila, fa`ula
v1 : Str -> Vowel -> Vowel -> V ; -- Verb Form I : fa`ala, fa`ila, fa`ula
v1 : Str -> Vowel -> Vowel -> V ;
v2 : Str -> V ; -- Verb Form II : fa``ala
--Verb Form II : fa``ala
v3 : Str -> V ; -- Verb Form III : faa`ala
v2 : Str -> V ;
v4 : Str -> V ; -- Verb Form IV : 'af`ala
--Verb Form III : faa`ala
v5 : Str -> V ; -- Verb Form V : tafa``ala
v3 : Str -> V ;
v6 : Str -> V ; -- Verb Form VI : tafaa`ala
--Verb Form IV : 'af`ala
v7 : Str -> V ; -- Verb Form VII : infa`ala
v4 : Str -> V ;
v8 : Str -> V ; -- Verb Form VIII ifta`ala
--Verb Form V : tafa``ala
v5 : Str -> V ;
--Verb Form VI : tafaa`ala
v6 : Str -> V ;
--Verb Form VIII 'ifta`ala
v8 : Str -> V ;
-- Verb Form X 'istaf`ala
v10 : Str -> V ;
v10 : Str -> V ; -- Verb Form X 'istaf`ala
--3 Two-place verbs
@@ -261,7 +262,9 @@ resource ParadigmsAra = open
mkV2S : V -> Str -> V2S ;
mkVV = overload {
mkVV : V -> VV = regVV ;
mkVV : V -> Str -> VV = c2VV
mkVV : V -> Str -> VV = c2VV ;
mkVV : V -> Preposition -> VV = prepVV ;
mkVV : V -> Preposition -> Preposition -> VV = prep2VV
} ;
mkV2V : overload {
mkV2V : V -> Str -> Str -> V2V ;
@@ -307,6 +310,10 @@ resource ParadigmsAra = open
masc = ResAra.Masc ;
fem = ResAra.Fem ;
Number = ResAra.Number ;
sg = ResAra.Sg ;
pl = ResAra.Pl ;
Species = ResAra.Species ;
hum = ResAra.Hum ;
nohum = ResAra.NoHum ;
@@ -345,15 +352,27 @@ resource ParadigmsAra = open
= mkFullN ;
mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural
= brkN ;
mkN : N -> (attr : Str) -> N -- Compound nouns
mkN : N -> (attr : Str) -> N -- Compound nouns with noninflecting attribute
= \n,attr -> n ** {s2 = \\n,s,c => attr} ;
mkN : N -> N -> N -- Compound nouns
= \n1,n2 -> n1 ** {s2 =
\\n,s,c => n1.s2 ! n ! s ! c -- card
++ n2.s ! n ! s ! c -- type
++ n2.s2 ! n ! s ! c} ; -- blood
mkN : N -> N -> N -- Compound nouns where attribute inflects in state and case but not number
= attrN Sg ;
mkN : Number -> N -> N -> N -- Compound nouns where attribute inflects in state, case and number
= attrN ;
} ;
attrN : Number -> N -> N -> N = \num,n1,n2 -> n1 ** {
s = \\n,_,c => n1.s ! n ! Const ! c ;
s2 = \\n,s,c => let c' = case c of {Dat => Gen; _ => c} in -- the Dat with liPrep hack only applies to the first word
n1.s2 ! num ! s ! c' -- attribute doesn't change
++ n2.s ! num ! s ! c'
++ n2.s2 ! num ! s ! c'} ;
dualN : N -> N = \n -> n ** {isDual=True} ;
proDrop : NP -> NP ; -- Force a NP to lose its string, only contributing with its agreement.
mkPron : (_,_,_ : Str) -> PerGenNum -> Pron ;
mkV = overload {
mkV : (imperfect : Str) -> V
= regV ;
@@ -419,6 +438,7 @@ resource ParadigmsAra = open
let root : Root3 = mkRoot3 rootStr ;
verb : Verb = case rootStr of {
? + #hamza + #weak => v4doubleweak root ;
? + #weak + ? => v4hollow root ;
_ + #weak => v4defective root ;
_ => v4sound root } ;
in lin V verb ;
@@ -452,30 +472,43 @@ resource ParadigmsAra = open
lock_V = <>
};
v7 =
\rootStr ->
let {
fcl = mkRoot3 rootStr ;
v7fun = v7geminate ; -- TODO add rest
} in lin V (v7fun fcl) ;
v8 =
\rootStr ->
let {
rbT = mkRoot3 rootStr ;
v8fun = case rbT.f of {
("و"|"ي"|"ّ") => v8assimilated ;
_ => v8sound }
_ =>
case rbT.c of {
#weak => v8hollow ;
_ => v8sound }}
} in lin V (v8fun rbT) ;
v10 =
\rootStr ->
let {
rbT = mkRoot3 rootStr ;
v10fun = case rbT.c of {
("و"|"ي") => v10hollow ;
v10fun : Root3 -> Verb = case rootStr of {
? + #weak + ? => v10hollow ;
? + ? + #weak => v10defective ;
_ => v10sound }
} in lin V (v10fun rbT) ;
mkFullN nsc gen spec =
reflV v = lin V (ResAra.reflV v) ;
mkFullN nsc gen spec = lin N
{ s = nsc; --NTable
s2 = emptyNTable;
g = gen;
h = spec;
lock_N = <>
isDual = False
};
brkN' : Str -> Str -> Str -> Gender -> Species -> N =
@@ -533,31 +566,19 @@ resource ParadigmsAra = open
} ;
mkPron : (_,_,_ : Str) -> PerGenNum -> Pron = \ana,nI,I,pgn ->
lin Pron { s =
table {
Acc => BIND ++ nI; -- object suffix
Gen => BIND ++ I; -- possessive suffix
_ => ana
};
a = {pgn = pgn; isPron = True };
empty = []
};
lin Pron (ResAra.mkPron ana nI I pgn) ;
proDrop : NP -> NP = ResAra.proDrop ; -- Force a NP to lose its string, only contributing with its agreement.
proDrop : NP -> NP = \np -> lin NP (ResAra.proDrop np) ;
-- e.g. al-jamii3, 2a7ad
regNP : Str -> Number -> NP = \word,n -> lin NP
{ s = \\c => fixShd word (dec1sg ! Def ! c) ;
a = {pgn = Per3 Masc n; isPron = False };
empty = []
};
regNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** {
s = \\c => fixShd word (dec1sg ! Def ! c)
});
-- e.g. hadha, dhaalika
indeclNP : Str -> Number -> NP = \word,n -> lin NP
{ s = \\c => word ;
a = {pgn = Per3 Masc n; isPron = False };
empty = []
};
indeclNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** {
s = \\c => word
});
mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant =
\hava,havihi,havAn,havayn,hAtAn,hAtayn,hA'ulA,det -> lin Quant (baseQuant **
@@ -595,9 +616,9 @@ resource ParadigmsAra = open
mascTbl = reg jadId judud ;
femTbl = reg jadIda judud ;
in { s = table {
APosit Masc n d c => mascTbl ! n ! d ! c ;
APosit Fem n d c => femTbl ! n ! d ! c ;
AComp d c => indeclN akbar ! d ! c }
APosit Masc n d c => rectifyHmz (mascTbl ! n ! d ! c) ;
APosit Fem n d c => rectifyHmz (femTbl ! n ! d ! c) ;
AComp d c => rectifyHmz (indeclN akbar ! d ! c) }
} ;
degrA : (posit,compar,plur : Str) -> A
@@ -623,6 +644,14 @@ resource ParadigmsAra = open
}
};
nisbaA : Str -> Adj = \Haal ->
let Haaliyy = Haal + "ِيّ" in {
s = table {
APosit g n d c => positAdj Haaliyy ! g ! n ! d ! c ;
AComp d c => "أَكْثَر" ++ indeclN Haaliyy ! d ! c
}
} ;
clrA root =
let { eaHmar = mkWord "أَفعَل" root;
HamrA' = mkWord "فَعلاء" root;
@@ -641,7 +670,12 @@ resource ParadigmsAra = open
mkAdv x = lin Adv (ss x) ;
mkAdV x = lin AdV (ss x) ;
mkAdA x = lin AdA (ss x) ;
mkInterj x = lin Interj (ss x) ;
mkSubj = overload {
mkSubj : Str -> Subj = \s -> lin Subj {s = s ; o = Subord} ;
mkSubj : Str -> Order -> Subj = \s,o -> lin Subj {s = s ; o = o} ;
} ;
dirV2 v = prepV2 v (casePrep acc) ;
@@ -665,9 +699,10 @@ resource ParadigmsAra = open
mkVS v = v ** {lock_VS = <>} ;
mkVQ v = v ** {lock_VQ = <>} ;
regVV : V -> VV = \v -> lin VV v ** {c2 = mkPreposition "أَنْ"} ;
c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = noPrep} ;
regVV : V -> VV = \v -> lin VV v ** {c2 = mkPreposition "أَنْ" ; sc = noPrep} ;
c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = mkPreposition prep ; sc = noPrep} ;
prepVV : V -> Preposition -> VV = \v,prep -> regVV v ** {c2=prep; sc=noPrep} ;
prep2VV : V -> (_,_ : Preposition) -> VV = \v,p1,p2 -> regVV v ** {c2=p1; sc=p2} ;
V0 : Type = V ;
---- V2S, V2V, V2Q, V2A : Type = V2 ;
AS, A2S, AV : Type = A ;
@@ -677,9 +712,9 @@ resource ParadigmsAra = open
mkV2S v p = lin V2S (prepV2 v (mkPreposition p)) ;
mkV2V = overload {
mkV2V : V -> Str -> Str -> V2V = \v,p,q ->
lin V2V (prepV3 v (mkPreposition p) (mkPreposition q)) ;
lin V2V (prepV3 v (mkPreposition p) (mkPreposition q) ** {sc = noPrep}) ;
mkV2V : V -> Preposition -> Preposition -> V2V = \v,p,q ->
lin V2V (prepV3 v p q) ;
lin V2V (prepV3 v p q ** {sc = noPrep}) ;
mkV2V : VV -> Preposition -> V2V = \vv,p ->
lin V2V (vv ** {c2 = p ; c3 = vv.c2}) ;
} ;
@@ -712,12 +747,12 @@ formV : (root : Str) -> VerbForm -> V = \s,f -> case f of {
FormIV => v4 s ;
FormV => v5 s ;
FormVI => v6 s ;
--- FormVII => v7 s ;
FormVII => v7 s ;
FormVIII => v8 s ;
FormX => v10 s
} ;
param VerbForm =
FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVIII | FormX ;
FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVII | FormVIII | FormX ;
} ;

View File

@@ -35,9 +35,13 @@ flags coding=utf8 ;
fuci = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ِ" } ;
fucu = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ُ" } ;
fUc = { h = "" ; m1 = "ُو"; m2 = ""; t = "" } ;
ufAc = { h = "ُ" ; m1 = "َا"; m2 = ""; t = "" } ;
ufca = { h = "ُ" ; m1 = "ْ" ; m2 = ""; t = "َ" } ;
eafAc = fAc ** { h = "أَ" } ;
eafac = fac ** { h = "أَ" } ;
eafIc = fIc ** { h = "أَ" } ;
eafic = fic ** { h = "أَ" } ;
eafAcil = { h = "أَ"; m1 = "َا" ; m2 = "ِ" ; t = "" } ;
eafAcIl = { h = "أَ"; m1 = "َا" ; m2 = "ِي" ; t = "" } ;
eafcilp = { h = "أَ"; m1 = "ْ" ; m2 = "ِ" ; t = "َة" } ;
@@ -47,6 +51,12 @@ flags coding=utf8 ;
eafcul = { h = "أَ"; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
eiftacal = { h = "إِ"; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ;
eufcil = { h = "أُ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ;
eufic = fic ** { h = "أُ" } ;
eufIc = fIc ** { h = "أُ" } ;
ufic = fic ** { h = "ُ" } ;
ufIc = fIc ** { h = "ُ" } ;
ufac = fac ** { h = "ُ" } ;
ufAc = fAc ** { h = "ُ" } ;
euftucil = { h = "أُ"; m1 = "ْتُ" ; m2 = "ِ" ; t = "" } ;
euttucil = euftucil ** { h = "اُتُّ" ; m1 = "ِ" } ; ---- IL assimilated VIII
afcul = { h = "َ" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ;
@@ -77,6 +87,9 @@ flags coding=utf8 ;
ficAl = { h = "" ; m1 = "ِ" ; m2 = "َا" ; t = "" } ;
ficlp = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "َة" } ;
ftacal = { h = "" ; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ;
ftical = ftacal ** { m1 = "ْتِ" } ; -- IL hollow VIII
ftAcal = ftacal ** { m1 = "ْتَا" } ; -- IL hollow VIII
ftIcal = ftacal ** { m1 = "ْتِي" } ; -- IL hollow VIII
ftacil = { h = "" ; m1 = "ْتَ" ; m2 = "ِ" ; t = "" } ;
ttacal = ftacal ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII
ttacil = ftacil ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII

View File

@@ -10,6 +10,7 @@ concrete PhraseAra of Phrase = CatAra ** open
UttQS qs = {s = \\g => qs.s ! QDir} ;
UttImpSg pol imp = {s = \\g => imp.s ! pol.p ! g ! ResAra.Sg ++ pol.s} ;
UttImpPl,UttImpPol = \pol,imp -> {s = \\g => imp.s ! pol.p ! g ! ResAra.Pl ++ pol.s} ;
UttInterj i = {s = \\g => i.s} ;
UttIP ip = {s = \\g => ip.s ! False ! g ! Def ! Nom} ; --IL
UttAP ap = {s = ResAra.uttAP ap} ; --IL
@@ -17,8 +18,8 @@ concrete PhraseAra of Phrase = CatAra ** open
UttCN cn = {s = ResAra.uttCN cn } ; --IL
UttNP np = {s = \\_ => np.s ! Nom} ;
UttVP vp = {s = \\g => (compVP vp).s ! {g=g ; n=Sg} ! Nom} ; --IL
UttS,
UttVP vp = {s = uttVP vp} ; --IL
UttS s = {s = \\_ => s.s ! Verbal} ;
UttAdv,
UttIAdv = \s -> {s = \\_ => s.s} ; ---- OK? AR
--

View File

@@ -7,8 +7,8 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
QuestCl cl = {
s = \\t,p =>
table {
QIndir => "إِذا" ++ cl.s ! t ! p ! Verbal ;
QDir => "هَلْ" ++ cl.s ! t ! p ! Verbal
QIndir => "إِذا" ++ cl.s ! t ! p ! toOrder QIndir ;
QDir => "هَلْ" ++ cl.s ! t ! p ! toOrder QDir
}
};
@@ -18,17 +18,17 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
QuestVP qp vp =
let np = ip2np qp vp.isPred ;
cl = PredVP np vp ;
in { s = \\t,p,_qf => cl.s ! t ! p ! Nominal } ;
in { s = \\t,p,qf => cl.s ! t ! p ! toOrder qf } ;
---- AR guessed
QuestIAdv iadv cl = {s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! Verbal} ;
QuestIAdv iadv cl = {s = \\t,p,qf => iadv.s ++ cl.s ! t ! p ! toOrder qf} ;
---- IL guessed
-- : IComp -> NP -> QCl
QuestIComp ic np =
let vp = kaan (CompNP np) ;
let vp = UseComp (CompNP np) ; -- puts NP in nominative
ip : ResAra.IP = np ** { -- NP's s is already present in VP, we only want its agr
s = \\_,_,_,_ => ic.s ! pgn2gn np.a.pgn } ;
in QuestVP ip vp ;
@@ -46,7 +46,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
QuestSlash ip cls = { ----IL just guessing
s = \\t,p,qf =>
let cl : ResAra.Cl = complClSlash cls ; -- dummy conversion to Cl
o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing
o = toOrder qf
in cls.c2.s ++ ip.s ! False ! Masc ! Def ! Nom ++ cl.s ! t ! p ! o
} ;
@@ -71,7 +71,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
IdetCN idet cn = {
s = \\isPred,g,s,c
=> idet.s ! cn.g ! s ! c ++
cn.s ! idet.n ! Indef ! Gen ; --idaafa
cn2str cn idet.n idet.d Gen ;
a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False }
} ;
@@ -80,6 +80,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
s = \\g,s,c =>
let gend = detGender g num.n -- gender flips with some numbers
in iquant.s ! s ! c ++ num.s ! gend ! s ! c ;
n = sizeToNumber num.n
n = sizeToNumber num.n ;
d = Indef ---- TODO check
} ;
}

View File

@@ -1,5 +1,5 @@
concrete RelativeAra of Relative = CatAra **
open ResAra, (Se=SentenceAra), (St=StructuralAra) in {
open ResAra in {
flags coding=utf8;
lin
@@ -13,8 +13,8 @@ concrete RelativeAra of Relative = CatAra **
s = \\t,p,agr,c =>
let
npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ;
np = emptyNP ** {s = npS ; a = agr} ;
cl = Se.PredVP np vp ;
np : ResAra.NP = agrNP agr ** {s = npS} ;
cl = predVP np vp ;
in
cl.s ! t ! p ! Nominal
} ;
@@ -22,9 +22,8 @@ concrete RelativeAra of Relative = CatAra **
-- : RP -> ClSlash -> RCl ; -- whom John loves
RelSlash rp cls = cls ** {
s = \\t,p,agr,c =>
let obj = case (pgn2gn agr.pgn).g of {
Fem => St.she_Pron ; -- head is repeated as a clitic object pronoun
Masc => St.he_Pron } ;
let --empty : Agr -> NP = emptyNP ;
obj : ResAra.NP = pgn2pron agr.pgn ; -- head is repeated as a clitic object pronoun
cl : ResAra.Cl = complClSlash obj cls ;
in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! VOS
} ;

View File

@@ -18,7 +18,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
Number = Sg | Dl | Pl;
Gender = Masc | Fem ;
Case = Nom | Acc | Gen
| Bare ; -- 1st person poss. suff. overrides case
| Bare -- 1st person poss. suff. overrides case
| Dat ; -- Hack to make the preposition لِ contract
Species = NoHum | Hum ;
State = Def | Indef | Const
| Poss ; -- ة turns into ت
@@ -27,11 +28,13 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
Mood = Ind | Cnj | Jus ;
Voice = Act | Pas ;
Order = Verbal | Nominal
| VOS ; -- Relative clauses with resumptive pronouns
| VOS -- Relative clauses with resumptive pronouns
| Subord ; -- Nominal word order but subject in accusative
oper
--roots, patterns, and making words:
-----------------------------------------------------------------------------
-- General morphology with roots, patterns, and making words:
Pattern : Type = {h, m1, m2, t : Str};
Root : Type = {f : Str};
@@ -109,7 +112,12 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
emptyNTable : NTable = \\n,s,c => [] ;
Preposition : Type = {s : Str ; c : Case} ;
Noun : Type = {s,s2 : NTable ; g : Gender; h : Species} ;
Noun : Type = {
s,s2 : NTable ;
g : Gender ;
h : Species ;
isDual : Bool -- whether it takes dual instead of plural: eyes, twins, ...
} ;
Noun2 : Type = Noun ** {c2 : Preposition} ;
Noun3 : Type = Noun2 ** {c3 : Preposition} ;
@@ -118,6 +126,17 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
mkPreposition : Str -> Preposition = \s -> {s=s;c=Gen} ;
} ;
noPrep : Preposition = mkPreposition [] Nom ;
liPrep : Preposition = mkPreposition (
pre { #pronSuffAndOther => "لِ" ;
#pronSuff => "لَ" ;
_ => "لِ"
} ++ BIND) Dat ;
biPrep : Preposition = mkPreposition ("بِ"++BIND) ;
pronSuff : pattern Str = #("كَ"|"كِ"|"كُمَا"|"كُمْ"|"كُنَّ"|"هُ"|"ها"|"هُمَا"|"هُمْ"|"هُنَّ") ;
pronSuffAndOther : pattern Str = #( "كَم" ) ; -- TODO list words that begin like pron.suff. but aren't
Adj : Type = {s : AForm => Str} ;
Adj2 : Type = Adj ** {c2 : Preposition} ;
@@ -129,14 +148,18 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
uttAP : AP -> (Gender => Str) ;
uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Def ! Nom ; ----IL
CN : Type = Noun ** {adj : NTable ; np : Case => Str};
CN : Type = Noun ** {np : Case => Str};
useN : Noun -> CN = \n -> n ** {adj = \\_,_,_ => []; np = \\_ => []} ;
-- All fields of NP
cn2str : CN -> Number -> State -> Case -> Str = \cn,n,s,c ->
cn.s ! n ! s ! c ++
cn.s2 ! n ! s ! c ++
cn.np ! c ;
useN : Noun -> CN = \n -> n ** {np = \\_ => []} ;
uttCN : CN -> (Gender => Str) ;
uttCN cn = \\_ => cn.s ! Sg ! Indef ! Bare ++
cn.s2 ! Sg ! Indef ! Bare ++
cn.adj ! Sg ! Indef ! Bare ;
uttCN cn = \\_ => cn2str cn Sg Indef Bare ;
NumOrdCard : Type = {
s : Gender => State => Case => Str ;
@@ -561,8 +584,15 @@ v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4)
v1doubleweak : Root3 -> Verb = \r'y ->
let ry = r'y ** {c = ""} ;
vforms : DefForms = \\x => rmSukun (v1DefForms_perfA ry a ! x) ; -- only remove the first sukun
in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef
vforms_doubleweak : DefForms = \\x => rmSukun (v1DefForms_perfA ry a ! x) ; -- only remove the first sukun
vforms_weak : DefForms = v1DefForms_perfA r'y a ;
vforms = table { 0 => vforms_weak ! 0 ; -- all perfect forms
1 => vforms_weak ! 1 ;
2 => vforms_weak ! 2 ;
3 => vforms_weak ! 3 ;
4 => vforms_weak ! 4 ;
x => vforms_doubleweak ! x } ;
in verbDoubleDef vforms a ; -- sukun in suffixes is removed in verbDoubleDef
patDef1 : Vowel => Pattern =
@@ -627,6 +657,28 @@ v4sound : Root3 -> Verb =
} in
verb eaqnac euqnic uqnic uqnac eaqnic muqnac;
v4hollow : Root3 -> Verb =
\rwd ->
let {
earad = mkHollow eafac rwd ; -- VPerf Act (Per3 Fem Pl) etc.
earAd = mkHollow eafAc rwd ; -- VPerf Act
eurid = mkHollow eufic rwd ; -- VPerf Pas (Per3 Fem Pl) etc.
eurId = mkHollow eufIc rwd ; -- VPerf Pas
urid = mkHollow ufic rwd ; -- VImpf Act (Per2/Per3 Fem Pl)
urId = mkHollow ufIc rwd ; -- VImpf Act
urad = mkHollow ufac rwd ; -- VImpf Pas (Per2/Per3 Fem Pl)
urAd = mkHollow ufAc rwd ; -- VImpf Pas
earid = mkHollow eafic rwd ; -- VImp (Sg Masc / Pl Fem)
earId = mkHollow eafIc rwd ; -- VImp (Pl Masc / Sg Fem)
ppart = "م" + urAd ;
} in verbHollow (toDefForms
earAd earad eurId eurid
urId urid urAd urad
earId earid ppart) ;
v4DefForms : Root3 -> DefForms = \cTy ->
let {
@@ -674,6 +726,33 @@ v6sound : Root3 -> Verb =
mutafAqam = "م" + utafAqam
} in verb tafAqam tufUqim atafAqam utafAqam tafAqam mutafAqam;
-- v7sound : Root3 -> Verb = -- TODO 7s
-- \fcl ->
-- let {
-- _facal = mkStrong facal fcl ;
-- _facil = mkStrong facil fcl;
-- infacal = "اِنْ" + _facal ; -- VPerf Act
-- ; -- VPerf Pas
-- anfacil = "َنْ" + _facil ; -- VImpf _ Act
-- ; -- VImpf _ Pas
-- ; -- VImp
-- -- VPPart
-- } in
-- verb ;
v7geminate : Root3 -> Verb = -- IL 7g -- very likely wrong
\fcl ->
let {
_nfacc = "نْ" + mkHollow facc fcl ;
infacal = "اِنْ" + mkStrong facal fcl ; -- VPerf Act -- TODO use another constructor, this is wrong for 3rd person
unfucc = "اُنْ" + mkHollow fucc fcl ; -- VPerf Pas
anfacc = "َ" + _nfacc ; -- VImpf _ Act
unfacc = "ُ" + _nfacc ; -- VImpf _ Pas
infacc = "اِ" + _nfacc ; -- VImp
munfacc = "مُ" +_nfacc -- VPPart
} in
verb infacal unfucc anfacc unfacc infacc munfacc ;
v8sound : Root3 -> Verb =
\rbT ->
let {
@@ -700,11 +779,33 @@ v8assimilated : Root3 -> Verb = --- IL 8a1
muttafaq = "م" + uttafaq
} in verb eittafaq euttufiq attafiq uttafaq eittafiq muttafaq;
v10sound : Root3 -> Verb = ---- IL 10s -- to be checked
v8hollow : Root3 -> Verb = -- IL
\Hwj ->
let {
_Htaj = mkHollow ftacal Hwj ;
_HtAj = mkHollow ftAcal Hwj ;
_Htij = mkHollow ftical Hwj ;
_HtIj = mkHollow ftIcal Hwj ;
iHtaj = "اِ" + _Htaj ; -- VPerf Act (Per3 Fem Pl)
iHtAj = "اِ" + _HtAj ; -- VPerf Act _
uHtij = "اُ" + _Htij ; -- VPerf Pas (Per3 Fem Pl)
uHtIj = "اُ" + _HtIj ; -- VPerf Pas _
aHtaj = "َ" + _Htaj ; -- VImpf Act (Per2/Per3 Fem Pl)
aHtAj = "َ" + _HtAj ; -- VImpf Act _
uHtaj = "ُ" + _Htaj ; -- VImpf Pas (Per2/Per3 Fem Pl)
uHtAj = "ُ" + _Htaj ; -- VImpf Pas _
-- iHtaj again -- VImp Sg Masc / Pl Fem
-- iHtAj again -- VImp Pl Masc / Sg Fem
ppart = "مُ" + _HtAj -- PPart
} in verbHollow (toDefForms
iHtAj iHtaj uHtIj uHtij aHtAj aHtaj
uHtAj uHtaj iHtAj iHtaj ppart) ;
v10sound : Root3 -> Verb = -- IL 10s -- to be checked
\qtl ->
let {
_staqtal = "َستَ" + mkStrong fcal qtl ;
_staqtil = "َستَ" + mkStrong fcil qtl;
_staqtal = "ستَ" + mkStrong fcal qtl ;
_staqtil = "ستَ" + mkStrong fcil qtl;
istaqtal = "اِ" + _staqtal ; -- VPerf Act
ustuqtil = "اُسْتُ" + mkStrong fcil qtl; -- VPerf Pas
astaqtil = "َ" + _staqtil ; -- VImpf _ Act
@@ -714,7 +815,7 @@ v10sound : Root3 -> Verb = ---- IL 10s -- to be checked
} in
verb istaqtal ustuqtil astaqtil astaqtal istaqtil mustaqtal ;
v10hollow : Root3 -> Verb = ---- IL 10h -- to be checked
v10hollow : Root3 -> Verb = -- IL 10h -- to be checked
\xwf ->
let {
_staxaf = "سْتَ" + mkHollow fac xwf ;
@@ -737,6 +838,29 @@ v10hollow : Root3 -> Verb = ---- IL 10h -- to be checked
istaxAf istaxaf ustuxIf ustuxif astaxIf astaxif
ustaxAf ustaxaf istaxif istaxIf ppart) ;
v10defective : Root3 -> Verb = -- IL
\lqy ->
let {
_stalqa = "سْتَ" + mkDefective fca lqy ;
_stalqu = "سْتَ" + mkDefective fcu lqy ;
_stalqi = "سْتَ" + mkDefective fci lqy ;
_stulqi = "سْتُ" + mkDefective fci lqy ;
istalqa = "اِ" + _stalqa ; -- VPerf Act (Per3 Masc Sg)
istalqay = "اِسْتَ" + mkStrong fcal lqy ; -- VPerf Act (Per3 Fem Pl)
ustulqi = "اُ" + _stulqi; -- VPerf Pas (Per3 _ _)
astalqu = "َ" + _stalqu ; -- VImpf Act (Per2/3 Masc Pl)
astalqi = "َ" + _stalqi ; -- VImpf Act _
ustalqa = "ُ" + _stalqa ; -- VImpf Pas _
istalqi = "اِ" + _stalqi; -- VImp (Masc Sg / Fem _)
istalqu = "اِ" + _stalqu; -- VImp Masc Pl
mustalqin = "مُ" + _stalqi + "ت" ;
} in verbDef (toDefForms
istalqa istalqay ustulqi ustulqi ustulqi
astalqi astalqu ustalqa istalqi istalqu mustalqin) i ;
patV1Perf : Vowel => Pattern =
table {
a => facal ; --katab
@@ -832,7 +956,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Bare => [] ;
Nom => "ُ";
Acc => "َ";
Gen => "ِ"
_Gen => "ِ" -- dat is the same as gen, except in definite before لِ
};
--takes the adjective lemma and gives the Posit table
@@ -862,7 +986,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- indeclinable nominal word (mamnuu3 mina S-Sarf)
indeclN : Str -> State => Case => Str =
\aHmar -> \\s,c => defArt s aHmar + indecl!c;
\aHmar -> \\s,c => defArt s c aHmar + indecl!c;
-- takes 2 words, singular and broken plural, and gives the
-- complete noun inflection table
@@ -897,12 +1021,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- takes a singular or broken plural word and tests the ending to
-- determine the declension and gives the corresponding inf table
sing : Str -> State => Case => Str = \word ->
\\s,c => defArt s (case word of {
\\s,c => defArt s c (case word of {
lemma + "ِيّ" => fixShd word (decNisba ! s ! c) ;
lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ;
_ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ;
lemma + ("ء"|"أ"|"ئ"|"ؤ") => word + dec1sgNoDoubleAlif ! s ! c ;
lemma + "ة" => case s of {
Poss => lemma + "ت" + dec1sg ! s ! c ;
_ => word + dec1sg ! s ! c
_ => word + dec1sgNoDoubleAlif ! s ! c
} ;
_ => fixShd word (dec1sg ! s ! c)
}) ;
@@ -911,7 +1037,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- takes a singular word and tests the ending to
-- determine the declension and gives the corresponding dual inf table
dual : Str -> State => Case => Str = \caSaA ->
\\s,c => defArt s (case caSaA of {
\\s,c => defArt s c (case caSaA of {
lemma + ("ا"|"ى") => lemma + "ي" + dl ! s ! c ;
lemma + "ة" => lemma + "ت" + dl ! s ! c ;
_ => fixShd caSaA (dl ! s ! c)
@@ -921,13 +1047,13 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
--plural feminine table
plurF : Str -> State => Case => Str =
\kalima ->
\\s,c => defArt s (mkAt kalima) + f_pl ! s ! c ;
\\s,c => defArt s c (mkAt kalima) + f_pl ! s ! c ;
-- takes a singular word and gives the corresponding sound
--plural masculine table. FIXME: consider declension 3
plurM : Str -> State => Case => Str =
\mucallim ->
\\s,c => defArt s mucallim + m_pl ! s ! c ;
\\s,c => defArt s c mucallim + m_pl ! s ! c ;
-- to add the Al prefix for Definite words
Al : State => Str =
@@ -936,10 +1062,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => ""
};
defArt : State -> Str -> Str = \st,stem -> -- IL -- to be checked
defArt : State -> Case -> Str -> Str = \st,c,stem -> -- IL -- to be checked
let al = "ال" in
case st of {
Def =>
case <st,c> of {
<Def,Dat> => "ل" + stem ; -- only happens before the preposition لِ
<Def> =>
case stem of {
s@#sun + x => fixShd (al + s) ("ّ" + x) ;
x => al + x } ;
@@ -953,17 +1080,24 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
table {
Bare => [];
Nom => "ٌ";
Acc => "ً";
Gen => "ٍ"
Acc => "اً";
_Gen => "ٍ"
};
_ => caseTbl --think of ?axU, ?axA, (the five nouns)
};
-- if a word ends in ء or ة, don't add alif for indef acc.
dec1sgNoDoubleAlif : State => Case => Str = \\s,c =>
case <s,c> of {
<Indef,Acc> => "ً" ;
_ => dec1sg ! s ! c
};
--indeclinables (mamnuu3 mina S-Sarf)
indecl : Case => Str =
table {
Gen => "َ" ;
(Gen|Dat) => "َ" ;
x => caseTbl ! x
};
@@ -978,6 +1112,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => "ِي"
};
--declension 3 (ending in alif)
dec3sg : State => Case => Str = \\s,c =>
case <s,c> of {
@@ -986,6 +1121,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => []
};
--declension 2 (ends in yaa')
decNisba : State => Case => Str = \\s,c =>
case <s,c> of {
<_, Bare> => [] ;
<Indef,Acc> => "اً" ;
<Indef> => "ٍ" ;
<_, Acc> => "َ" ;
_ => []
};
--dual suffixes
dl : State => Case => Str =
@@ -1087,7 +1231,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
<NonTeen,_> => Acc;
<ThreeTen,_> => Gen;
<Hundreds,_> => Gen;
<_,Const> => Gen;
<_,Const> => Gen; -- not sure if this is an actual rule /IL
_ => c
};
@@ -1138,18 +1282,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
}
};
gn2pgn : {g : Gender; n : Number} -> PerGenNum = \gn ->
case gn of { {g = gn; n = nm} => Per3 gn nm } ;
-- these are chosen in many places, trying to be consistent
toOrder : QForm -> Order = \qf ->
case qf of { QIndir => Nominal ;
QDir => Verbal } ;
mkIP = overload {
mkIP : Str -> Number -> IP = \maa,n -> {
s = \\_p,_g,_s,_c => maa ;
a = { pgn = agrP3 NoHum Masc n ; isPron = False }
} ;
mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> {
s = table { True => \\_g,_s,_c => maa ;
False => \\_g,_s,_c => maadhaa } ;
a = { pgn = agrP3 NoHum Masc n ; isPron = False }
}
} ;
mkOrd : (_,_ : Str) -> Size -> NumOrdCard =
\aysar,yusra,sz ->
@@ -1163,7 +1303,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
};
oper
-----------------------------------------------------------------------------
-- Det, Quant
BaseQuant : Type = {
d : State;
@@ -1194,21 +1336,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
AAgr = { g : Gender ; n : Number} ;
Comp : Type = {
s : AAgr => Case => Str
} ;
IComp : Type = {
s : AAgr -- "how old": masc or fem for adjective
-- no need for Case, IComp is only used by QuestIComp, as grammatical subject
=> Str ;
} ;
Obj : Type = {
s : Str ;
a : Agr
};
-----------------------------------------------------------------------------
-- NP, Pron
NP : Type = {
s : Case => Str ;
@@ -1216,9 +1345,21 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
empty : Str -- to prevent ambiguities with prodrop
} ;
mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn ->
{ s =
table {
(Nom|Bare) => ana;
Acc => nI ; -- object suffix
Gen => I ; -- possessive suffix
Dat => I -- will only be used with preposition لِ
};
a = {pgn = pgn; isPron = True };
empty = []
};
proDrop : NP -> NP = \np ->
case np.a.isPron of {
True => np ** {s = \\_ => []};
True => np ** {s = table {Nom => [] ; x => np.s ! x}};
_ => np
} ;
@@ -1227,6 +1368,71 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
a = {pgn = Per3 Masc Sg ; isPron = False} ;
empty = [] } ;
agrNP : Agr -> NP = \agr -> emptyNP ** {a = agr} ;
i_Pron : NP = mkPron "أَنَا" "نِي" "ي" (Per1 Sing) ;
we_Pron : NP = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ;
youSgMasc_Pron : NP = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ;
youSgFem_Pron : NP = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ;
youDlMasc_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Masc Dl) ;
youDlFem_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Fem Dl) ;
youPlMasc_Pron : NP = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Pl) ;
youPlFem_Pron : NP = mkPron "أَنتُنَّ" "كُنَّ" "كُنَّ" (Per2 Fem Pl) ;
he_Pron : NP = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ;
she_Pron : NP = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ;
theyDlMasc_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Masc Dl) ;
theyDlFem_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Fem Dl) ;
theyMasc_Pron : NP = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ;
theyFem_Pron : NP = mkPron "هُنَّ" "هُنَّ" "هُنَّ" (Per3 Fem Pl) ;
-- Used e.g. to encode the subject as an object clitic
-- or to find a possessive suffix corresponding to the NP.
-- If the NP is a pronoun, just use itself.
np2pron : NP -> NP = \np -> case np.a.isPron of {
True => np ;
False => pgn2pron np.a.pgn
} ;
pgn2pron : PerGenNum -> NP = \pgn ->
case pgn of {
Per1 Sing => i_Pron ;
Per1 Plur => we_Pron ;
Per2 Fem Sg => youSgFem_Pron ;
Per2 Masc Sg => youSgMasc_Pron ;
Per2 Fem Dl => youDlFem_Pron ;
Per2 Masc Dl => youDlMasc_Pron ;
Per2 Fem Pl => youPlFem_Pron ;
Per2 Masc Pl => youPlMasc_Pron ;
Per3 Fem Sg => she_Pron ;
Per3 Masc Sg => he_Pron ;
Per3 Fem Dl => theyDlFem_Pron ;
Per3 Masc Dl => theyDlMasc_Pron ;
Per3 Fem Pl => theyFem_Pron ;
Per3 Masc Pl => theyMasc_Pron
} ;
pron2np : NP -> NP = \np -> np ** {
a = np.a ** {isPron=False} -- hack, sometimes we *don't* want prodrop
} ;
reflPron : Case -> PerGenNum -> Str = \c,pgn ->
let pron : NP = pgn2pron pgn
in "نَفْس" + caseTbl ! c ++ pron.s ! Gen ;
reflV : Verb -> Verb = \v -> v ** {
s = \\vf => case vf of {
VPerf _ pgn => v.s ! vf ++ reflPron Acc pgn ;
VImpf _ _ pgn => v.s ! vf ++ reflPron Acc pgn ;
VImp g n => v.s ! vf ++ reflPron Acc (Per2 g n) ;
VPPart => v.s ! vf ++ reflPron Acc (Per3 Masc Sg) ----
}
} ;
-----------------------------------------------------------------------------
-- IP, questions
IP : Type = {
s : Bool -- different forms for "what is this" and "what do you do"
=> Gender -- because an IP can be made into an IComp
@@ -1235,19 +1441,42 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
a : Agr -- can be both subject and object of a QCl, needs full agr. info (stupid given that s depends on gender but meh)
} ;
mkIP = overload {
mkIP : Str -> Number -> IP = \maa,n -> {
s = \\_p,_g,_s,_c => maa ;
a = { pgn = agrP3 NoHum Masc n ; isPron = False }
} ;
mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> {
s = table { True => \\_g,_s,_c => maa ;
False => \\_g,_s,_c => maadhaa } ;
a = { pgn = agrP3 NoHum Masc n ; isPron = False }
}
} ;
ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Masc ! Def ; empty = [] } ;
np2ip : NP -> IP = \np -> np ** {s = \\_,_,_ => np.s} ;
IDet : Type = {
s : Gender -- IdetCN needs to choose the gender of the CN
=> State => Case => Str ;
n : Number
=> State -- Needs to be retained variable for IP; PrepIP chooses the state of IP
=> Case => Str ;
n : Number ;
d : State -- in IdetCN, chooses the state of the CN
} ;
IQuant : Type = {
s : State => Case => Str
} ;
IComp : Type = {
s : AAgr -- "how old": masc or fem for adjective
-- no need for Case, IComp is only used by QuestIComp, as grammatical subject
=> Str ;
} ;
-----------------------------------------------------------------------------
-- VP
param VPForm =
VPPerf
| VPImpf Mood
@@ -1255,25 +1484,23 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
oper
VP : Type = {
s : PerGenNum => VPForm => Str ;
BaseVP : Type = { -- to minimise duplication of code for VPS
sc : Preposition ; -- subject case: e.g. يُمْكِنُ *لِ*Xِ
obj : Obj;
pred : Comp;
isPred : Bool; --indicates if there is a predicate (xabar)
s2 : Str
} ;
-- For complements of VV.
-- TODO: does verbal complement agree with the noun
compVP : VP -> Comp = \vp -> ---- IL
{ s = table {
aagr@{g=g ; n=n} => \\c =>
vp.s ! Per3 g n ! VPImpf Ind ---- IL guesswork + https://arabic.desert-sky.net/g_modals.html
++ vp.s2
++ vp.pred.s ! aagr ! Acc
++ vp.obj.s }
VP : Type = BaseVP ** {
s : PerGenNum => VPForm => Str ;
} ;
uttVP : VP -> (Gender=>Str) = \vp ->
\\g => vp.s ! Per3 g Sg ! VPPerf
++ vp.obj.s ++ vp.pred.s ! {n = Sg ; g = g} ! Nom
++ vp.s2 ;
predV : Verb -> VP = \v ->
{ s = \\pgn,vf =>
let gn = pgn2gn pgn in
@@ -1282,10 +1509,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
VPImpf m => v.s ! (VImpf m Act pgn);
VPImp => v.s ! (VImp gn.g gn.n)
};
obj = {
s = [] ;
a = {pgn = Per3 Masc Sg ; isPron = False}
}; --or anything!
sc = noPrep ;
obj = emptyObj ;
s2 = [];
pred = {s = \\_,_ => []} ;
isPred = False
@@ -1309,44 +1534,80 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
<Verbal, False> => verbalAgr np.a.pgn;
_ => np.a.pgn
};
gn = pgn2gn pgn;
kataba = vp.s ! pgn ! VPPerf ;
yaktubu = vp.s ! pgn ! VPImpf Ind ;
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
yaktub = vp.s ! pgn ! VPImpf Jus ;
vStr : ParamX.Tense -> Polarity -> Str =
\tn,pl -> case <vp.isPred,tn,pl> of {
<False, Pres, Pos> => yaktubu ;
<False, Pres, Neg> => "لَا" ++ yaktubu ;
<True, Pres, Pos> => "" ; --no verb "to be" in present
<True, Pres, Neg> => "لَيسَ" ;--same here, just add negation particle
<_, Past, Pos> => kataba ;
<_, Past, Neg> => "لَمْ" ++ yaktub ;
<_, Cond, _ > => yaktuba ;
<_, Fut, Pos> => "سَ" ++ yaktubu ;
<_, Fut, Neg> => "لَنْ" ++ yaktuba
-- very unsure about this /IL
sc : Preposition = case o of {
Subord => {s=[]; c=Acc} ;
_ => case np.a.isPron of {
True => noPrep ; -- to prevent weird stuff with VVs, might be overly specific
_ => vp.sc }
} ;
pred : ParamX.Tense -> Polarity -> Str =
\tn,pl -> case <vp.isPred,tn,pl> of {
subj = np.empty ++ sc.s
++ case vp.isPred of {
False => (proDrop np).s ! sc.c ; -- prodrop if it's not predicative
True => np.s ! sc.c
} ;
} in wordOrder o
vp.obj.a.isPron np.a.isPron
(vStr vp pgn t p o)
vp.obj.s
(pred vp pgn t p)
vp.s2
subj
} ;
-- seems complicated, but this is to share code with VPS and other similar structures
wordOrder : Order -> (objIsPron,subjIsPron : Bool) -> (verb,obj,pred,adv,subj : Str) -> Str =
\o,objIsPron,subjIsPron,verb,obj,pred,adv,subj ->
let cl = wordOrderNoSubj o objIsPron verb obj pred adv in
case o of {
Subord =>
let bind = if_then_Str subjIsPron BIND [] -- in subord. clause, subj. pronoun binds to the main verb
in cl.before ++ bind ++ subj ++ cl.after ;
_ => cl.before ++ subj ++ cl.after
} ;
wordOrderNoSubj : Order -> (objIsPron : Bool) -> (verb,obj,pred,adv : Str) -> {before,after : Str} =
\o,objIsPron,verb,obj,pred,adv ->
case o of {
VOS => {before = verb ++ obj ++ pred ++ adv; after = []} ;
Verbal => case objIsPron of {
True => {before = verb ++ obj ; after = adv ++ pred} ; -- obj. clitic attaches directly to the verb
False => {before = verb ; after = obj ++ adv ++ pred}
} ;
(Nominal|Subord) => {before = [] ; after = verb ++ obj ++ adv ++ pred}
} ;
pred : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Str = \vp,pgn,tn,pl ->
let gn = pgn2gn pgn
in case <vp.isPred,tn,pl> of {
<True, Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob
} ;
subj = np.empty
++ case <vp.isPred,np.a.isPron> of {
<False,True> => [] ; -- prodrop if it's not predicative
_ => np.s ! Nom
} ;
} in
case o of {
Verbal => vStr t p ++ case vp.obj.a.isPron of {
True => vp.obj.s ++ subj ; -- obj. clitic attaches directly to the verb
False => subj ++ vp.obj.s }
++ vp.s2 ++ pred t p ;
Nominal => subj ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ;
VOS => vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ++ subj
}
vStr : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Order -> Str = \vp,pgn,tn,pl,o ->
let kataba = vp.s ! pgn ! VPPerf ;
yaktubu = vp.s ! pgn ! VPImpf Ind ;
yaktuba = vp.s ! pgn ! VPImpf Cnj ;
yaktub = vp.s ! pgn ! VPImpf Jus ;
-- Various negative particles
la = "لَا" ;
laysa = "لَيسَ" ; -- "neg. copula"
lam = "لَمْ" ; -- neg. past
alla = "أَلَّا" ; -- neg. subjunctive
lan = "لَنْ" ; -- neg. future
in case <vp.isPred,tn,pl,o> of {
<False, Pres, Pos, _> => yaktubu ;
<False, Pres, Neg, _> => la ++ yaktubu ;
<True, Pres, Pos, _> => [] ; --no verb "to be" in present
<True, Pres, Neg, _> => laysa ; --same here, just add negation particle
<_, Past, Pos, _> => kataba ;
<_, Past, Neg, _> => lam ++ yaktub ;
<_, Cond, Pos, _> => yaktuba ;
<_, Cond, Neg, _> => alla ++ yaktuba ;
<_, Fut, Pos, _> => glue "سَ" yaktubu ;
<_, Fut, Neg, Subord> => alla ++ yaktuba ; -- might be too specific for just one case /IL
<_, Fut, Neg, _> => lan ++ yaktuba
} ;
-- in verbal sentences, the verb agrees with the subject
@@ -1357,10 +1618,38 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => pgn
};
insertObj : NP -> VPSlash -> VP = \np,vp -> vp **
{ obj = {s = vp.obj.s ++ vp.c2.s ++ np.s ! vp.c2.c ; a = np.a} };
-----------------------------------------------------------------------------
-- Comp, arguments for VP
insertPred : {s : AAgr => Case => Str} -> VP -> VP = \p,vp -> vp **
Comp : Type = {
s : AAgr => Case => Str ;
} ;
Obj : Type = {
s : Str ;
a : Agr -- default Agr in a VP without real Obj is Per3 Masc Sg.
}; -- need isPron for word order in predVP, and pgn for ImpersCl
Subj : Type = {s : Case => Str ; isPron : Bool} ;
np2subj : NP -> Subj = \np -> np ** {isPron = np.a.isPron} ;
subj2np : Subj -> NP = \su -> su ** {a = {pgn = emptyNP.a.pgn ; isPron = su.isPron} ; empty=[]} ;
emptyObj : Obj = emptyNP ** {s=[]} ;
insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** {
obj = {s = vp.obj.s -- old object, if there was one
++ bindIfPron np vp -- new object, bind if pronoun and not pred
++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V
a = np.a}
} ;
bindIfPron : NP -> {c2:Preposition; isPred:Bool} -> Str = \np,vp ->
let bind = case <vp.isPred,np.a.isPron> of {
<False,True> => BIND ;
_ => [] }
in vp.c2.s ++ bind ++ np.s ! vp.c2.c ;
insertPred : Comp -> VP -> VP = \p,vp -> vp **
{ pred = p;
isPred = True
};
@@ -1372,32 +1661,44 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
insertPred xabar (predV copula);
copula : Verb = v1hollow {f = "ك"; c = "و" ; l = "ن"} u ;
-----------------------------------------------------------------------------
-- Slash categories
VPSlash : Type = VP ** {c2 : Preposition} ;
ClSlash : Type = VPSlash ** {subj : NP} ;
VPSlash : Type = VP ** {c2 : Preposition ; agrObj : PerGenNum => Str} ;
ClSlash : Type = VPSlash ** {subj : Subj} ;
emptyVPslash : VP -> VPSlash = \vp -> vp ** {
c2 = noPrep ; agrObj = \\_ => []
} ;
slashV2 : Verb2 -> VPSlash = \v ->
predV v ** {c2 = v.c2} ;
predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ;
-- Add subject string, fix agreement to the subject,
-- but keep the structure as VP, because later on
-- we might need different word orders for the ClSlash.
predVPSlash : NP -> VPSlash -> ClSlash = \np,v -> v ** {
subj = np
subj = np2subj np ;
s = \\_pgn,vf => v.s ! np.a.pgn ! vf -- so we can throw away subject's pgn
} ;
complClSlash = overload {
complClSlash : NP -> ClSlash -> Cl = \obj,cls ->
predVP cls.subj (insertObj obj cls) ;
predVP (subj2np cls.subj) (insertObj obj cls) ;
complClSlash : ClSlash -> Cl = \cls ->
predVP cls.subj (insertObj emptyNP cls) -- Empty subject and object
predVP (subj2np cls.subj) (insertObj emptyNP cls) -- Empty subject and object
} ;
Cl : Type = {s : Tense => Polarity => Order => Str} ;
QCl : Type = {s : Tense => Polarity => QForm => Str} ;
forceOrder : Order -> Cl -> Cl = \o,cl ->
{s = \\t,p,_ => cl.s ! t ! p ! o} ;
-----------------------------------------------------------------------------
-- Relative
param
RAgr = RSg Gender | RPl Gender | RDl Gender Case ;
@@ -1418,6 +1719,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
RCl : Type = {s : Tense => Polarity => Agr => Case => Str} ;
RP : Type = {s : RAgr => Str } ;
-----------------------------------------------------------------------------
-- Num
param
Size = One | Two | ThreeTen | Teen | NonTeen | Hundreds | None ;
@@ -1447,16 +1751,16 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
NCard => table {
Masc => \\s,c => (sing wAhid) ! s ! c ;
--all fem are first declension:
Fem => \\s,c => defArt s wAhida + dec1sg ! s ! c
Fem => \\s,c => defArt s c wAhida + dec1sgNoDoubleAlif ! s ! c
};
NOrd => table {
Masc => \\s,c => defArt s awwal + dec1sg ! s ! c;
Masc => \\s,c => defArt s c awwal + dec1sg ! s ! c;
Fem => \\s,c => (sing Ula) ! s ! c
}
};
ten => table {
NCard => \\_,s,c => defArt s wAhid + m_pl ! Indef ! c;
NOrd => \\_,s,c => defArt s awwal + m_pl ! Indef ! c
NCard => \\_,s,c => defArt s c wAhid + m_pl ! Indef ! c;
NOrd => \\_,s,c => defArt s c awwal + m_pl ! Indef ! c
}
}
};
@@ -1505,6 +1809,4 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Masc => Fem;
Fem => Masc
};
}

View File

@@ -33,9 +33,9 @@ concrete SentenceAra of Sentence = CatAra ** open
ImpVP vp = {
s = \\p,g,n =>
case p of {
Pos => vp.s ! (Per2 g n) ! VPImp ++ vp.obj.s ++ vp.s2 ;
Neg => "لا" ++ vp.s ! (Per2 g n) ! (VPImpf Jus) ++ vp.obj.s ++ vp.s2
}
Pos => vp.s ! Per2 g n ! VPImp ;
Neg => "لَا" ++ vp.s ! Per2 g n ! VPImpf Jus
} ++ vp.obj.s ++ vp.pred.s ! {g=g;n=n} ! Acc ++ vp.s2
};
--
@@ -52,10 +52,8 @@ concrete SentenceAra of Sentence = CatAra ** open
SlashVP = predVPSlash ;
AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ;
-- SlashPrep : Cl -> Prep -> ClSlash
-- Will be awkward to implement in the way ClSlash is now.
-- ClSlash is implemented the way it is now for a good reason:
-- we need to support different word orders.
-- : Cl -> Prep -> ClSlash
-- SlashPrep cl prep = TODO
-- SlashVS np vs sslash = TODO
@@ -66,11 +64,11 @@ concrete SentenceAra of Sentence = CatAra ** open
--
UseCl t p cl =
{s = t.s ++ p.s ++
{s = \\o => t.s ++ p.s ++
case <t.t,t.a> of { --- IL guessed tenses
<Pres,Simul> => cl.s ! Pres ! p.p ! Nominal ;
<Pres,Anter> => cl.s ! Past ! p.p ! Nominal ;
<x ,_ > => cl.s ! x ! p.p ! Nominal
<Pres,Simul> => cl.s ! Pres ! p.p ! o ;
<Pres,Anter> => cl.s ! Past ! p.p ! o ;
<x ,_ > => cl.s ! x ! p.p ! o
}
};
@@ -86,4 +84,6 @@ concrete SentenceAra of Sentence = CatAra ** open
UseRCl t p cl = {s = \\agr,c => t.s ++ p.s ++ cl.s ! t.t ! p.p ! agr ! c} ;
UseSlash t p cl = UseCl t p (complClSlash cl) ;
AdvS adv s = s ** {s = \\o => adv.s ++ s.s ! o} ;
}

View File

@@ -18,8 +18,8 @@ concrete StructuralAra of Structural = CatAra **
between_Prep = mkPrep "بَيْنَ" ;
-- both7and_DConj = sd2 "بْته" "َند" ** {n = Pl} ;
-- but_PConj = ss "بُت" ;
by8agent_Prep = mkPrep "بِ" ;
by8means_Prep = mkPrep "بِ" ;
by8agent_Prep,
by8means_Prep = biPrep ;
can_VV = mkVV (mkV "طوع" FormX) ;
-- can8know_VV = {
-- s = table VVForm [["بي َبلي تْ"] ; "عَن" ; "عُْلد" ;
@@ -34,18 +34,23 @@ concrete StructuralAra of Structural = CatAra **
-- everywhere_Adv = ss "ثريوهري" ;
few_Det = mkDet "بَعض" Pl Const ;
-- first_Ord = ss "فِرست" ;
for_Prep = liPrep ;
from_Prep = mkPrep "مِنَ" ;
he_Pron = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ;
he_Pron = ResAra.he_Pron ;
here_Adv = ss "هُنا" ;
-- here7to_Adv = ss ["تْ هري"] ;
-- here7from_Adv = ss ["فرْم هري"] ;
how_IAdv = ss "كَيفَ" ;
-- how8many_IDet = mkDet "كَمْ" Pl Const ; -- IL: check (was ["هْو مَني"]) ;
-- if_Subj = ss "ِف" ;
how8many_IDet = {
s = \\g,s,c => "كَمْ عَدَد" + caseTbl ! c ;
n = Pl ; d = Def
} ; -- IL
if_Subj = mkSubj "إِذَا" Verbal ;
in8front_Prep = mkPrep "مُقَابِلَ" ;
i_Pron = mkPron "أَنَا" "نِي" "ي" (Per1 Sing);
i_Pron = ResAra.i_Pron ;
in_Prep = mkPrep "فِي" ;
it_Pron = he_Pron ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg);
it_Pron = emptyNP ** {s = \\_ => "هَذَا"} ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg);
-- less_CAdv = ss "لسّ" ;
many_Det = mkDet "جَمِيع" Pl Const ;
-- more_CAdv = ss "مْري" ;
@@ -57,16 +62,15 @@ concrete StructuralAra of Structural = CatAra **
-- isAux = True
-- } ;
no_Utt = {s = \\_ => "لا"} ;
on_Prep = mkPrep "عَلى" ;
--- DEPREC one_Quant = mkQuantNum "واحِد" Sg Indef ;
on_Prep = mkPrep "عَلَى" ;
only_Predet = mkPredet "فَقَط" False;
-- or_Conj = ss "ْر" ** {n = Sg} ;
-- otherwise_PConj = ss "ْتهروِسي" ;
part_Prep = mkPrep "مِنَ" ;
-- please_Voc = ss "ةلَسي" ;
possess_Prep = mkPrep "ل" ;
possess_Prep = liPrep ;
-- quite_Adv = ss "قُِتي" ;
she_Pron = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ;
she_Pron = ResAra.she_Pron ;
-- so_AdA = ss "سْ" ;
somebody_NP = regNP "أَحَد" Sg ;
someSg_Det = mkDet "أَحَد" Sg Const ;
@@ -74,13 +78,14 @@ concrete StructuralAra of Structural = CatAra **
something_NP = regNP "شَيْء" Sg ;
-- somewhere_Adv = ss "سْموهري" ;
that_Quant = mkQuant3 "ذَلِكَ" "تِلكَ" "أُلٱِكَ" Def;
that_Subj = mkSubj "أنَّ" ;
----b that_NP = indeclNP "ذَلِكَ" Sg ;
there_Adv = ss "هُناك" ;
-- there7to_Adv = ss "تهري" ;
-- there7from_Adv = ss ["فرْم تهري"] ;
-- therefore_PConj = ss "تهرفْري" ;
----b these_NP = indeclNP "هَؤُلَاء" Pl ;
they_Pron = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ;
they_Pron = theyMasc_Pron ;
this_Quant = mkQuant7 "هَذا" "هَذِهِ" "هَذَان" "هَذَيْن" "هَاتَان" "هَاتَيْن" "هَؤُلَاء" Def;
----b this_NP = indeclNP "هَذا" Sg ;
----b those_NP = indeclNP "هَؤُلَاءكَ" Pl ;
@@ -89,12 +94,12 @@ concrete StructuralAra of Structural = CatAra **
to_Prep = mkPrep "إِلى" ;
under_Prep = mkPrep "تَحْتَ" ;
-- very_AdA = ss "ثري" ;
-- want_VV = P.mkVV (P.regV "وَنت") ;
we_Pron = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ;
want_VV = mkVV (mkV "رود" FormIV) ;
we_Pron = ResAra.we_Pron ;
whatPl_IP = mkIP "ما" "ماذا" Pl ;
whatSg_IP = mkIP "ما" "ماذا" Sg ;
when_IAdv = ss "مَتَى" ;
-- when_Subj = ss "وهن" ;
when_Subj = mkSubj "عِنْدَمَا" Verbal ;
where_IAdv = ss "أَينَ" ;
which_IQuant = {
s = \\s,c => case <c,s> of {
@@ -103,8 +108,8 @@ concrete StructuralAra of Structural = CatAra **
<Nom,_> => "أيُّ" ;
<Acc,Indef> => "أيّاً" ;
<Acc,_> => "أيَّ" ;
<Gen,Indef> => "أيٍّ" ;
<Gen,_> => "أيِّ"
<_Gen,Indef> => "أيٍّ" ;
<_Gen,_> => "أيِّ"
}
} ;
whoSg_IP = mkIP "مَنْ" "مَنْ" Sg ;
@@ -113,9 +118,9 @@ concrete StructuralAra of Structural = CatAra **
without_Prep = mkPrep "بِدُونِ" ;
with_Prep = mkPrep "مَع" ;
yes_Utt = {s = \\_ => "نَعَم"} ;
youSg_Pron = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ;
youPl_Pron = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ;
youPol_Pron = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ;
youSg_Pron = youSgMasc_Pron ;
youPl_Pron = youPlMasc_Pron ;
youPol_Pron = youPlFem_Pron ; -- arbitrary?
have_V2 = dirV2 (regV "يَملِك") ;

View File

@@ -9,23 +9,23 @@ lin
FloatPN i = {s = \\c => i.s ; g = Masc ; h = NoHum } ; --IL
NumPN i = {s = \\c => uttNum i ! Masc ; g = Masc ; h = NoHum } ; --IL
-- CNIntNP cn i = {
-- s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ;
-- s = \\c => cn2str cn Sg Def c ++ uttNum i ! cn.g ;
-- a = dummyAgrP3 Sg ;
-- } ;
--IL TODO: check out some opers regarding state in ResAra. These are just dummy values.
CNSymbNP det cn xs =
let g = cn.g ; n = sizeToNumber det.n in {
s = \\c => det.s ! NoHum ! g ! c ++ cn.s ! Sg ! Def ! c ++ cn.adj ! n ! Def ! c ++ xs.s; ----IL word order?? Seems to be nontrivial according to ResAra comments.
s = \\c => det.s ! NoHum ! g ! c ++ cn2str cn n Def c ++ xs.s; ----IL word order?? Seems to be nontrivial according to ResAra comments.
a = dummyAgrP3 n ;
empty = []
} ;
CNNumNP cn i = {
s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ;
s = \\c => cn2str cn Sg Def c ++ uttNum i ! cn.g ;
a = dummyAgrP3 Sg ;
empty = []
} ;
SymbS sy = sy ;
SymbS sy = {s = \\_ => sy.s} ;
SymbOrd n = {s = \\_,_,_ => n.s ; n = One ; isNum = False } ;

View File

@@ -1,4 +1,4 @@
concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
flags optimize=all_subs ;
@@ -7,43 +7,80 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
SlashVV vv vps = vps ** predV vv ; ----IL
-- TODO: --c3 is for verb, c2 is for dir.obj
--SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go
--SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
-- : V2V -> VP -> VPSlash ; -- beg (her) to go
SlashV2V v2v vp = let v2vVP = predV v2v in -- IL
vp ** {
s = v2vVP.s ;
agrObj = \\pgn => v2v.c3.s -- أَنْ
++ vp.s ! pgn ! VPImpf Cnj ; -- this will agree with the object added by ComplSlash
isPred = False ;
c2 = v2v.c2 ; -- preposition for the direct object
sc = v2v.sc
} ;
-- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
SlashV2VNP v2v np vps = let v2vVP = slashV2 v2v in -- IL
vps ** {
s = \\pgn,vpf => v2vVP.s ! pgn ! vpf -- main verb agrees with subject
++ bindIfPron np v2vVP
++ v2v.c3.s -- أَنْ
++ vps.s ! np.a.pgn ! VPImpf Cnj -- verb from old VP agrees with object
++ vps.obj.s ; -- otherwise obj appears in a weird place /IL
obj = emptyObj ;
isPred = False ;
-- preposition for the direct object comes from VP
sc = v2v.sc
} ;
SlashV2a = slashV2 ;
Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3};
Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3 ; agrObj = \\_ => []};
ComplSlash vp np = insertObj np vp ;
-- Complv3 v np np2 = insertObj np2 (insertObj np (predV v)) ;
{-{s = \\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc ;
a = {pgn = Per3 Masc Sg ; isPron = False} } --FIXME
(predV v) ;-}
ComplVV vv vp = let vvVP = predV vv in --- IL
-- : VV -> VP -> VP ; -- want to run
ComplVV vv vp = let vvVP = predV vv in -- IL
vp ** {
s = \\pgn,vpf => vvVP.s ! pgn ! vpf
++ vv.c2.s -- أَنْ
++ vp.s ! pgn ! VPImpf Cnj ;
isPred = False
isPred = False ;
sc = vv.sc
} ;
-- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ;
-- ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
--
-- ComplVA v ap = insertObj (ap.s) (predV v) ;
-- : VS -> S -> VP ; -- say that she runs
ComplVS vs s = predV vs ** { -- IL
obj = emptyObj ** {s = s.s ! Subord}
} ;
-- : VQ -> QS -> VP ; -- wonder who runs
ComplVQ vq qs = predV vq ** { -- IL
obj = emptyObj ** {s = qs.s ! QIndir}
} ;
-- : VA -> AP -> VP ; -- they become red
ComplVA v ap = predV v ** {pred = CompAP ap} ;
-- ComplV2A v np ap =
-- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ;
--
UseComp xabar = kaan xabar ;
UseComp xabar =
case xabar.isNP of {
False => kaan xabar ;
True => predV copula ** {obj = xabar.obj ; isPred=True}
} ;
UseCopula = predV copula ;
-- : VP -> Prep -> VPSlash ; -- live in (it)
VPSlashPrep vp prep = vp ** {
c2 = prep ;
agrObj = \\_ => []
} ;
AdvVP vp adv = insertStr adv.s vp ;
-- AdVVP adv vp = insertAdV adv.s vp ;
AdVVP adv = insertStr adv.s ;
AdVVPSlash adv vps = vps ** insertStr adv.s vps ;
--
-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;
--
@@ -51,10 +88,14 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
--
-- UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no
CompCN cn = {s = \\agr,c => cn.s ! agr.n ! Indef ! c ++ cn.np ! c ++ cn.adj ! agr.n ! Indef ! c} ; ----IL
CompAP ap = {s = \\agr,c => ap.s ! Hum ! agr.g ! agr.n ! Indef ! c} ; --FIXME
CompNP np = {s = \\_,c => np.s ! c};
CompAdv a = {s = \\_,_ => a.s} ;
CompAP ap = {s = \\agr,c => ap.s ! Hum ! agr.g ! agr.n ! Indef ! c ; --FIXME
obj = emptyObj ; isNP = False} ;
CompAdv a = {s = \\_,_ => a.s ;
obj = emptyObj ; isNP = False} ;
CompCN cn = {s = \\agr,c => cn2str cn agr.n Indef Nom ;
obj = emptyObj ; isNP = False} ;
CompNP np = {s = \\_,_ => [] ; obj = np ** {s = np.s ! Nom} ; isNP = True} ;
--
--
}

View File

@@ -2019,7 +2019,7 @@ oper
(v0+"˙ő")
(v0+"ŕë")
(v0+"˙ë")
(v0+"-")
(v0+"ŕí")
(v0+"˙ů")
(v0+"č")
(v0+"ŕíĺ") ;

View File

@@ -1,165 +0,0 @@
--# -path=alltenses:../english:../translator:../abstract
concrete ParseBul of ParseEngAbs =
TenseX - [IAdv, CAdv],
CatBul,
NounBul - [PPartNP],
AdjectiveBul,
NumeralBul,
SymbolBul [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP],
ConjunctionBul,
VerbBul - [SlashV2V, PassV2, UseCopula, ComplVV],
AdverbBul,
PhraseBul,
SentenceBul,
QuestionBul,
RelativeBul,
IdiomBul [NP, VP, Tense, Cl, ProgrVP, ExistNP],
ExtraBul [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash,
Temp, Pol, Conj, VPS, ListVPS, S, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS,
VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
ComplSlashPartLast,
ClSlash, RCl, EmptyRelSlash],
DocumentationBul,
DictionaryBul **
open ResBul, Prelude in {
flags
literal=Symb ;
coding = utf8 ;
lin
CompoundCN num noun cn = {
s = \\nf => num.s ! CFNeut Indef ++ (noun.rel ! nform2aform nf cn.g) ++ (cn.s ! (indefNForm nf)) ;
g = cn.g
} ;
GerundN v = {
s = \\nform => v.s ! Imperf ! VNoun nform ;
rel = \\aform => v.s ! Imperf ! VPresPart aform ++
case v.vtype of {
VMedial c => reflClitics ! c;
_ => []
};
g = ANeut
} ;
GerundAP v = {
s = \\aform => v.s ! Imperf ! VPresPart aform ++
case v.vtype of {
VMedial c => reflClitics ! c;
_ => []
};
adv = v.s ! Imperf ! VPresPart (ASg Neut Indef);
isPre = True
} ;
PastPartAP v = {
s = \\aform => v.s ! Perf ! VPassive aform ;
adv = v.s ! Perf ! VPassive (ASg Neut Indef);
isPre = True
} ;
PositAdVAdj a = {s = a.adv} ;
that_RP = {
s = whichRP
} ;
UseQuantPN q pn = { s = table {
RObj Dat => "на" ++ pn.s;
_ => pn.s
} ;
a = {gn = GSg pn.g; p = P3};
p = q.p
} ;
PastPartRS ant pol vp = {
s = \\agr =>
ant.s ++ pol.s ++
vp.ad.s ++
case pol.p of {Pos => ""; Neg => "не"} ++
case ant.a of {Simul => ""; Anter => auxBe ! VPerfect (aform agr.gn Indef (RObj Acc))} ++
vp.s ! Perf ! VPassive (aform agr.gn Indef (RObj Acc)) ++
case vp.vtype of {
VMedial c => reflClitics ! c;
_ => []
} ++
vp.compl1 ! agr ++ vp.compl2 ! agr ;
} ;
PresPartRS ant pol vp = {
s = \\agr =>
ant.s ++ pol.s ++
vp.ad.s ++
case pol.p of {Pos => ""; Neg => "не"} ++
case ant.a of {Simul => ""; Anter => auxBe ! VPerfect (aform agr.gn Indef (RObj Acc))} ++
vp.s ! Imperf ! VPresPart (aform agr.gn Indef (RObj Acc)) ++
case vp.vtype of {
VMedial c => reflClitics ! c;
_ => []
} ++
vp.compl ! agr ;
} ;
SlashV2V vv ant p vp =
insertSlashObj2 (\\agr => ant.s ++ p.s ++ vv.c3.s ++
daComplex ant.a (orPol p.p vp.p) vp ! Perf ! agr)
Pos
(slashV vv vv.c2) ;
ComplVV vv ant p vp =
insertObj (\\agr => ant.s ++ p.s ++
case vv.typ of {
VVInf => daComplex ant.a p.p vp ! Perf ! agr;
VVGerund => gerund vp ! Imperf ! agr
}) vp.p
(predV vv) ;
PredVPosv np vp = {
s = \\t,a,p,o =>
let
subj = np.s ! (case vp.vtype of {
VNormal => RSubj ;
VMedial _ => RSubj ;
VPhrasal c => RObj c}) ;
verb : Bool => Str
= \\q => vpTenses vp ! t ! a ! p ! np.a ! q ! Perf ;
compl = vp.compl ! np.a
in case o of {
Main => compl ++ subj ++ verb ! False ;
Inv => verb ! False ++ compl ++ subj ;
Quest => compl ++ subj ++ verb ! True
}
} ;
CompS s = {s = \\_ => "че" ++ s.s; p = Pos} ;
CompQS qs = {s = \\_ => qs.s ! QIndir; p = Pos} ;
CompVP ant p vp = {s = let p' = case vp.p of {
Neg => Neg;
Pos => p.p
}
in \\agr => ant.s ++ p.s ++
daComplex ant.a p' vp ! Perf ! agr;
p = Pos
} ;
VPSlashVS vs vp =
let vp = insertObj (daComplex Simul Pos vp ! Perf) vp.p (predV vs)
in { s = vp.s;
ad = vp.ad;
compl1 = \\_ => "";
compl2 = vp.compl;
vtype = vp.vtype;
p = vp.p;
c2 = {s=""; c=Acc}
} ;
ApposNP np1 np2 = {
s = \\role => np1.s ! role ++ comma ++ np2.s ! RSubj ;
a = np1.a ;
p = np1.p
} ;
UttAdV adv = adv;
}

View File

@@ -74,6 +74,8 @@ lincat
n_hours_NP : NP = mkNP n_card time ;
in Sy.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ;
timeunitRange l u time = {s = l.s ! True ! R.Nom ++ to_Prep.s ++ u.s ! True ! R.Nom ++ time.s ! R.Pl ! R.Nom} ;
oneHour = mkHour "1" True ;
twoHour = mkHour "2" True ;
threeHour = mkHour "3" True ;

View File

@@ -1,11 +1,12 @@
* {"not"} PART neg head
* {"has","had","have","will","would","do","does","did"} AUX aux head
CompAP {"is","are","am","was","been","be"} VERB cop head
CompCN {"is","are","am","was","been","be"} VERB cop head
CompAP {"is","are","am","was","been","be"} VERB cop head
CompAdv {"is","are","am","was","been","be"} VERB cop head
UseV {"not","don't","doesn't","didn't","haven't","hasn't","hadn't","wouldn't","won't"} PART neg head
UseV {"has","had","have","will","would","do","does","did"} AUX aux head
UseComp {"not","don't","doesn't","didn't","haven't","hasn't","hadn't","wouldn't","won't"} PART neg head
UseComp {"has","had","have","will","would","do","does","did"} AUX aux head
UseComp {"is","are","am","was","been","be"} VERB cop head
CompCN {"a","an"} DET det head
ComplVV {"to"} PART mark xcomp
ComplVS {"that"} PART mark xcomp
ComplVS {"not","don't","doesn't","didn't","haven't","hasn't","hadn't","wouldn't","won't"} PART neg head
ComplVS {"has","had","have","will","would","do","does","did"} AUX aux head

View File

@@ -1,175 +0,0 @@
--# -path=.:../abstract:../translator
concrete ParseEng of ParseEngAbs =
TenseX - [Pol, PNeg, PPos, SC],
CatEng,
NounEng - [PPartNP],
AdjectiveEng,
NumeralEng,
SymbolEng [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP],
ConjunctionEng,
VerbEng - [SlashV2V, PassV2, UseCopula, ComplVV, ComplVS],
AdverbEng,
PhraseEng,
SentenceEng - [UseCl], -- replaced by UseCl | ContractedUseCl
QuestionEng,
RelativeEng,
IdiomEng [NP, VP, Tense, Cl, ProgrVP, ExistNP, SelfAdvVP, SelfAdVVP, SelfNP],
ConstructionEng,
DocumentationEng,
ExtraEng [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, PassAgentVPSlash,
Temp, Pol, Conj, VPS, ListVPS, S, Num, CN, RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP,
VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
ComplSlashPartLast,
ClSlash, RCl, EmptyRelSlash, VS, V2S, ComplBareVS, SlashBareV2S],
DictionaryEng **
open MorphoEng, ResEng, ParadigmsEng, (G = GrammarEng), (E = ExtraEng), Prelude in {
flags
literal=Symb ;
-- exceptional linearizations
lin
UseCl t p cl = G.UseCl t p cl | E.ContractedUseCl t p cl ;
lin
myself_NP = regNP "myself" singular ;
yourselfSg_NP = regNP "yourself" singular ;
himself_NP = regNP "himself" singular ;
herself_NP = regNP "herself" singular ;
itself_NP = regNP "itself" singular ;
ourselves_NP = regNP "ourselves" plural ;
yourselfPl_NP = regNP "yourself" plural ;
themselves_NP = regNP "themselves" plural ;
CompoundSgCN cn1 cn2 = {
s = \\n,c => cn1.s ! Sg ! Nom ++ cn2.s ! n ! c ;
g = cn2.g
} ;
CompoundPlCN cn1 cn2 = {
s = \\n,c => cn1.s ! Pl ! Nom ++ cn2.s ! n ! c ;
g = cn2.g
} ;
DashSgN n1 n2 = {
s = \\n,c => n1.s ! Sg ! Nom ++ "-" ++ n2.s ! n ! c ;
g = n2.g
} ;
DashPlN n1 n2 = {
s = \\n,c => n1.s ! Pl ! Nom ++ "-" ++ n2.s ! n ! c ;
g = n2.g
} ;
GerundN v = {
s = \\n,c => v.s ! VPresPart ;
g = Neutr
} ;
GerundAP v = {
s = \\agr => v.s ! VPresPart ;
isPre = True
} ;
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
} ;
OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ;
PositAdVAdj a = {s = a.s ! AAdv} ;
UseQuantPN q pn = {s = \\c => q.s ! False ! Sg ++ pn.s ! npcase2case c ; a = agrgP3 Sg pn.g} ;
SlashV2V v ant p vp = insertObjc (\\a => v.c3 ++ ant.s ++ p.s ++
infVP v.typ vp ant.a p.p a)
(predVc v) ;
SlashSlashV2V v ant p vp = insertObjc (\\a => v.c3 ++ ant.s ++ p.s ++
infVP v.typ vp ant.a p.p a)
(predVc v) ;
SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++
v.c3 ++
vpi.s ! VVAux ! a)
(predVc v) ;
ComplVV v a p vp = insertObj (\\agr => a.s ++ p.s ++
infVP v.typ vp a.a p.p agr)
(predVV v) ;
ComplVS vs s = G.ComplVS vs s | ComplBareVS vs s ;
PredVPosv np vp = {
s = \\t,a,b,o =>
let
verb = vp.s ! t ! a ! b ! o ! np.a ;
compl = vp.s2 ! np.a
in
case o of {
ODir _ => compl ++ frontComma ++ np.s ! npNom ++ verb.aux ++ vp.ad ! np.a ++ verb.fin ++ verb.adv ++ verb.inf ;
OQuest => verb.aux ++ compl ++ frontComma ++ np.s ! npNom ++ verb.adv ++ vp.ad ! np.a ++ verb.fin ++ verb.inf
}
} ;
PredVPovs np vp = {
s = \\t,a,b,o =>
let
verb = vp.s ! t ! a ! b ! o ! np.a ;
compl = vp.s2 ! np.a
in
case o of {
ODir _ => compl ++ frontComma ++ verb.aux ++ verb.adv ++ vp.ad ! np.a ++ verb.fin ++ verb.inf ++ np.s ! npNom ;
OQuest => verb.aux ++ compl ++ verb.adv ++ vp.ad ! np.a ++ verb.fin ++ verb.inf ++ np.s ! npNom
}
} ;
that_RP = {
s = \\_ => "that" ;
a = RNoAg
} ;
who_RP = {
s = \\_ => "who" ;
a = RNoAg
} ;
CompS s = {s = \\_ => "that" ++ s.s} ;
CompQS qs = {s = \\_ => qs.s ! QIndir} ;
CompVP ant p vp = {s = \\a => ant.s ++ p.s ++
infVP VVInf vp ant.a p.p a} ;
VPSlashVS vs vp =
insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) **
{c2 = ""; missingAdv = False; gapInMiddle = False} ;
PastPartRS ant pol vps = {
s = \\agr => vps.ad ! agr ++ vps.ptp ++ vps.s2 ! agr ;
c = npNom
} ;
PresPartRS ant pol vp = {
s = \\agr => vp.ad ! agr ++ vp.prp ++ vp.p ++ vp.s2 ! agr;
c = npNom
} ;
ApposNP np1 np2 = {
s = \\c => np1.s ! c ++ frontComma ++ np2.s ! npNom ++ finalComma ;
a = np1.a
} ;
NameCN pn cn = {
s = \\n,c => pn.s ! npcase2case npNom ++ cn.s ! n ! c ;
g = cn.g
} ;
AdAdV = cc2 ;
UttAdV adv = adv;
lin
PPos = {s = [] ; p = CPos} ;
PNeg = {s = [] ; p = CNeg True} | {s = [] ; p = CNeg False} ;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -69,6 +69,8 @@ lin
let n_card : Card = lin Card n;
n_hours_NP : NP = mkNP n_card time ;
in S.mkAdv for_Prep n_hours_NP | S.mkAdv to_Prep n_hours_NP ;--| S.mkAdv (n_hours_NP.s ! R.Nom) ;
timeunitRange l u time = {s = "de" ++ l.s ! time.g
++ "a" ++ u.s ! time.g ++ time.s ! u.n } ;
oneHour = mkHour "1" Manha Sg ;
twoHour = mkHour "2" Manha Pl ;
@@ -95,12 +97,12 @@ lin
twentyThreeHour = mkHour "23" Noite Pl ;
twentyFourHour = {s = "meia-noite" ; pe = None ; n = Sg} ;
timeHour h = mkAdv (a ! h.n ++ h.s ++ period ! h.pe) ;
timeHour h = mkAdv (R.a ! Fem ! h.n ++ h.s ++ period ! h.pe) ;
timeHourMinute h m = let
min = m.s ! Masc
in
mkAdv (a ! h.n ++ h.s ++ "e" ++ min ++ period ! h.pe) ;
mkAdv (R.a ! Fem ! h.n ++ h.s ++ "e" ++ min ++ period ! h.pe) ;
oper
mkHour : Str -> Period -> Number -> {s : Str ; pe : Period ; n : Number} ;
@@ -114,9 +116,6 @@ lin
None => ""
} ;
a : Number => Str ;
a = numForms "à" "às" ;
lin
weekdayPunctualAdv w = lin Adv {s = w.s ! C.Sg} ; -- lundi
weekdayHabitualAdv w = SyntaxPor.mkAdv noPrep (mkNP the_Det w) ; -- il lunedí ----

View File

@@ -106,12 +106,18 @@ instance DiffPor of DiffRomance - [partAgr,vpAgrSubj,vpAgrClits] = open CommonRo
partitive = \_,c -> prepCase c ;
oper
a : Gender => Number => Str ;
a = genNumForms "a" "à" "aos" "às" ;
de : Gender => Number => Str ;
de = genNumForms "do" "da" "dos" "das" ;
artDef : Bool -> Gender -> Number -> Case -> Str ;
-- not sure if isNP is relevant
artDef _isNP g n c = case c of {
Nom | Acc => genNumForms "o" "a" "os" "as" ;
CPrep P_de => genNumForms "do" "da" "dos" "das" ;
CPrep P_a => genNumForms "ao" "à" "aos" "às" ;
CPrep P_de => de ;
CPrep P_a => a ;
CPrep P_em => genNumForms "no" "na" "nos" "nas" ;
CPrep P_por => genNumForms "pelo" "pela" "pelos" "pelas"
} ! g ! n ;

View File

@@ -4,6 +4,8 @@ concrete ExtendPor of Extend =
CatPor ** ExtendFunctor -
[
AdAdV,
AdjAsCN,
AdjAsNP,
ApposNP,
BaseVPS,
ByVP,
@@ -13,6 +15,7 @@ concrete ExtendPor of Extend =
CompoundAP,
CompoundN,
CompVP,
ConjVPS,
ConsVPS,
--EmptyRelSlash,
ExistsNP,
@@ -27,11 +30,13 @@ concrete ExtendPor of Extend =
ICompAP,
InOrderToVP,
ListVPS,
MkVPS,
PassAgentVPSlash,
PassVPSlash,
PastPartAP,
PastPartAgentAP,
PositAdVAdj,
PredVPS,
PresPartAP,
ProDrop,
PurposeVP,
@@ -85,17 +90,28 @@ concrete ExtendPor of Extend =
c = Nom
} ;
---- these come from ExtraRomance: how to avoid the repetition?
---- can't seem to be able to use two functors
lincat
VPS = {s : Agr => Mood => Str} ;
[VPS] = {s1,s2 : Agr => Mood => Str} ;
-- VPI = {s : VType => Agr => Str } ;
VPS = {s : Mood => Agr => Bool => Str} ;
[VPS] = {s1,s2 : Mood => Agr => Bool => Str} ;
lin
BaseVPS = twoTable2 Agr Mood ;
ConsVPS = consrTable2 Agr Mood comma ;
BaseVPS x y = twoTable3 Mood Agr Bool x y ;
ConsVPS = consrTable3 Mood Agr Bool comma ;
-- MkVPS t p vp = mkVPS (lin Temp t) (lin Pol p) (lin VP vp) ;
--TODO: write mkVPS oper
PredVPS np vpi = {
s = \\m => (np.s ! Nom).comp ++ vpi.s ! m ! np.a ! np.isNeg
} ;
MkVPS tm p vp = {
s = \\m,agr,isNeg =>
tm.s ++ p.s ++
(mkClausePol (orB isNeg vp.isNeg) [] False False agr vp).s
! DDir ! tm.t ! tm.a ! p.p ! m
} ;
ConjVPS = conjunctDistrTable3 Mood Agr Bool ;
lin
ProDrop p = {
@@ -148,6 +164,16 @@ concrete ExtendPor of Extend =
ComplBareVS = ComplVS ;
AdjAsCN ap = {
s =\\n => ap.s ! AF Masc n ;
g = Masc
} ;
AdjAsNP ap = heavyNP {
s = \\_c => ap.s ! AF Masc Sg ;
a = Ag Masc Sg P3
} ;
oper
pastPartAP : VPSlash -> Str -> AP ;
pastPartAP vps agent = lin AP {

View File

@@ -10,7 +10,7 @@ flags
lin
easy_A2V = mkA2V (mkA "fácil") dative genitive ;
married_A2 = mkA2 (mkA "casado") dative ;
probable_AS = mkAS (mkA "provável" "provável" "prováveis" "prováveis" "provavelmente") ;
probable_AS = mkAS (prefA (mkA "provável" "provavelmente")) ;
fun_AV = mkAV (mkA "divertido") genitive ;
-- A
bad_A = prefA (mkA (mkA "mau") (mkA "pior")) ;
@@ -58,7 +58,7 @@ lin
white_A = compADeg (mkA "branco") ;
wide_A = mkA "largo" ; -- extenso
yellow_A = mkA "amarelo" ;
young_A = prefA (mkA "jovem" "jovem" "jovens" "jovens" "juvenilmente") ;
young_A = prefA (mkA "jovem" "juvenilmente") ;
already_Adv = mkAdv "já" ;
far_Adv = mkAdv "longe" ; ----?
now_Adv = mkAdv "agora" ;

View File

@@ -124,16 +124,16 @@ oper
}
} ;
mkAdj2N : (_,_: N) -> Str -> Adj = \mascN, femN, burramente ->
{s = table {
AF Masc n => mascN.s ! n ;
AF Fem n => femN.s ! n ;
AA => burramente
mkAdj2 : (_,_: Str) -> Adj ;
mkAdj2 aj av = let
adj = mkAdjReg aj
in {
s = table {
AF g n => adj.s ! AF g n ;
AA => av
}
} ;
mkAdjN : N -> Str -> Adj = \n, burramente -> mkAdj2N n n burramente ;
-- Then the regular and invariant patterns.
adjPreto : Str -> Adj = \preto ->
@@ -174,7 +174,7 @@ oper
"ã" => "a"
} ;
alemvo : Str = alem + v + "o" ;
in mkAdj alemão alemã (alemã + "s") (alemã + "es") (alemã + "amente") ;
in mkAdj alemão alemã (alemã + "s") (alemã + "es") (alemã + "mente") ;
adjEuropeu : Str -> Adj = \europeu -> let europe = init europeu in
mkAdj europeu (europe + "ia") (europeu + "s") (europe + "ias")
@@ -183,11 +183,13 @@ oper
mkAdjReg : Str -> Adj = \a ->
case a of {
pret + "o" => adjPreto a ;
anarquist + v@("e" | "a") => adjUtil (anarquist + v) (anarquist + v + "s") ;
anarquist + v@("e" | "a") => adjUtil a (a + "s") ;
ouvido + "r" => adjOuvidor a (ouvido + "ra") ;
chin + "ês" => adjFrances a ;
europ + "eu" => adjEuropeu a ;
alem + "ão" => adjVo a ;
provav + v@("e" | "i") + "l" => adjUtil a (provav + "eis") ;
jove + "m" => adjUtil a (jove + "ns") ;
_ => adjUtil a (a + "s")
} ;

View File

@@ -203,8 +203,8 @@ oper
regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ;
lock_A = <>} ;
mk2A : (espanhol,espanhola : Str) -> A ;
mk2A a b = compADeg {s = \\_ => (mkAdj2N (mkN a) (mkN b) (b + "mente")).s ; isPre = False ;
mk2A : (único,unicamente : Str) -> A ;
mk2A adj adv = compADeg {s = \\_ => (mkAdj2 adj adv).s ; isPre = False ;
lock_A = <>} ;
mk5A : (preto,preta,pretos,pretas,pretamente : Str) -> A ;

View File

@@ -9,4 +9,5 @@
instance ResPor of ResRomance = DiffPor ** open CommonRomance, Prelude in {
oper
vowel : pattern Str = #("a" | "e" | "i" | "o" | "u") ;
} ;

View File

@@ -8,7 +8,7 @@ concrete ExtendSwe of Extend = CatSwe **
PassVPSlash, PassAgentVPSlash, UttVPShort, ByVP, InOrderToVP,
MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS,
ICompAP,
ICompAP,ProDrop,
AdAdV, PositAdVAdj, GerundCN, GerundNP, GerundAdv, PresPartAP, PastPartAP, PastPartAgentAP,
RNP, RNPList, ReflRNP, ReflPron, ReflPoss, PredetRNP, ConjRNP,
Base_rr_RNP, Base_nr_RNP, Base_rn_RNP, Cons_rr_RNP, Cons_nr_RNP,
@@ -122,7 +122,7 @@ concrete ExtendSwe of Extend = CatSwe **
ICompAP ap = {s = \\a => hur_IAdv.s ++ ap.s ! a} ;
ProDrop pro = pro ** {s = \\_ => []} ;
lincat
RNP = {s : Agr => Str ; isPron : Bool} ; ---- inherent Agr needed: han färgar sitt hår vitt. But also depends on subject

View File

@@ -1,126 +0,0 @@
--# -path=.:../english/:../scandinavian:alltenses:../abstract:../translator
concrete ParseSwe of ParseEngAbs =
TenseSwe,
NounSwe - [PPartNP],
AdjectiveSwe,
NumeralSwe,
SymbolSwe [PN, Symb, String, CN, Card, NP, MkSymb, SymbPN, CNNumNP],
ConjunctionSwe,
VerbSwe - [SlashV2V, PassV2, UseCopula, ComplVV],
AdverbSwe,
PhraseSwe,
SentenceSwe,
QuestionSwe,
RelativeSwe,
IdiomSwe [NP, VP, Tense, Cl, ProgrVP, ExistNP, SelfAdvVP, SelfAdVVP, SelfNP],
ConstructionSwe,
DocumentationSwe,
ExtraSwe [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, PassAgentVPSlash,
Temp, Pol, Conj, VPS, ListVPS, S, Num, CN, RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP,
VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
ClSlash, RCl, EmptyRelSlash],
DictionarySwe **
open MorphoSwe, ResSwe, ParadigmsSwe, SyntaxSwe, CommonScand, (E = ExtraSwe), Prelude in {
flags
literal=Symb ;
lin
{-
myself_NP = regNP "myself" singular ;
yourselfSg_NP = regNP "yourself" singular ;
himself_NP = regNP "himself" singular ;
herself_NP = regNP "herself" singular ;
itself_NP = regNP "itself" singular ;
ourself_NP = regNP "ourself" plural ;
yourselfPl_NP = regNP "yourself" plural ;
themself_NP = regNP "themself" plural ;
themselves_NP = regNP "themselves" plural ;
-}
CompoundCN num noun cn = {
s = \\n,d,c => num.s ! cn.g ++ noun.co ++ BIND ++ cn.s ! n ! d ! c ;
g = cn.g ;
isMod = False
} ;
DashCN noun1 noun2 = {
s = \\n,d,c => noun1.co ++ BIND ++ noun2.s ! n ! d ! c ;
g = noun2.g ;
co = noun1.co ++ BIND ++ noun2.co ---- add s if not already there
} ;
GerundN v = {
s = \\n,d,c => v.s ! VI (VPtPres n d c) ;
g = Neutr ;
co = v.s ! VI (VPtPres Sg Indef Nom) ;
} ;
GerundAP v = {
s = \\_ => v.s ! VI (VPtPres Sg Indef Nom) ;
isPre = True
} ;
PastPartAP v = {
s = \\afpos => v.s ! VI (VPtPret afpos Nom) ;
isPre = True
} ;
OrdCompar a = {
s = case a.isComp of {
True => "mera" ++ a.s ! AF (APosit (Weak Sg)) Nom ;
_ => a.s ! AF ACompar Nom
} ;
isDet = True
} ;
PositAdVAdj a = {s = a.s ! adverbForm} ;
UseQuantPN q pn = {
s = \\c => q.s ! Sg ! True ! False ! pn.g ++ pn.s ! caseNP c ;
a = agrP3 pn.g Sg
} ;
SlashV2V v ant p vp = predV v ** {
n3 = \\a => v.c3.s ++ ant.s ++ p.s ++ infVPPlus vp a ant.a p.p ;
c2 = v.c2
} ;
SlashVPIV2V v p vpi = predV v ** {
n3 = \\a => v.c3.s ++ p.s ++ negation ! p.p ++ vpi.s ! VPIInf ! a ;
c2 = v.c2
} ;
ComplVV v ant pol vp = insertObjPost (\\a => v.c2.s ++ ant.s ++ pol.s ++ infVPPlus vp a ant.a pol.p) (predV v) ;
PredVPosv np vp = mkCl np vp ; ---- TODO restructure all this using Extra.Foc
PredVPovs np vp = mkCl np vp ; ----
that_RP = which_RP ; -- som
who_RP = which_RP ;
CompS s = {s = \\_ => "att" ++ s.s ! Sub} ;
CompQS qs = {s = \\_ => qs.s ! QIndir} ;
CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ infVPPlus vp a ant.a p.p} ;
-- VPSlashVS : VS -> VP -> VPSlash
---VPSlashVS vs vp =
--- insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) **
--- {c2 = ""; gapInMiddle = False} ;
PastPartRS ant pol vps = mkRS ant pol (mkRCl which_RP <lin VP vps : VP> ) ; ---- maybe as participle construction?
PresPartRS ant pol vp = mkRS ant pol (mkRCl which_RP vp) ; --- probably not as participle construction
ApposNP np1 np2 = {
s = \\c => np1.s ! c ++ comma ++ np2.s ! NPNom ;
a = np1.a
} ;
AdAdV = cc2 ;
UttAdV adv = adv;
}