mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
moved lib/next-resource to next-lib/src, to enable linking with next-lib as value of GF_LIB_PATH
This commit is contained in:
199
next-lib/src/Make.hs
Normal file
199
next-lib/src/Make.hs
Normal file
@@ -0,0 +1,199 @@
|
||||
module Main where
|
||||
|
||||
import Control.Monad
|
||||
import Data.Maybe
|
||||
import System.Cmd
|
||||
import System.Directory
|
||||
import System.Environment
|
||||
import System.Exit
|
||||
|
||||
-- Make commands for compiling and testing resource grammars.
|
||||
-- usage: runghc Make ((present? OPT?) | (clone FILE))? LANGS?
|
||||
-- where
|
||||
-- - OPT = (lang | api | math | pgf | test | demo | clean)
|
||||
-- - LANGS has the form e.g. langs=Eng,Fin,Rus
|
||||
-- - clone with a flag file=FILENAME clones the file to the specified languages,
|
||||
-- by replacing the 3-letter language name of the original in both
|
||||
-- the filename and the body
|
||||
-- with each name in the list (default: all languages)
|
||||
-- With no argument, lang and api are done, in this order.
|
||||
-- See 'make' below for what is done by which command.
|
||||
|
||||
default_gfc = "../../bin/gfc"
|
||||
|
||||
presApiPath = "-path=api:present"
|
||||
|
||||
-- the languages have long directory names and short ISO codes (3 letters)
|
||||
-- we also give the decodings for postprocessing linearizations, as long as grammars
|
||||
-- don't support all flags needed; they are used in tests
|
||||
|
||||
langsCoding = [
|
||||
(("arabic", "Ara"),""),
|
||||
(("bulgarian","Bul"),""),
|
||||
(("catalan", "Cat"),""),
|
||||
(("danish", "Dan"),""),
|
||||
(("english", "Eng"),""),
|
||||
(("finnish", "Fin"),""),
|
||||
(("french", "Fre"),""),
|
||||
(("hindi", "Hin"),"to_devanagari"),
|
||||
(("german", "Ger"),""),
|
||||
(("interlingua","Ina"),""),
|
||||
(("italian", "Ita"),""),
|
||||
(("norwegian","Nor"),""),
|
||||
(("russian", "Rus"),""),
|
||||
(("spanish", "Spa"),""),
|
||||
(("swedish", "Swe"),""),
|
||||
(("thai", "Tha"),"to_thai")
|
||||
]
|
||||
|
||||
langs = map fst langsCoding
|
||||
|
||||
-- languagues for which to compile Lang
|
||||
langsLang = langs `except` ["Ara"]
|
||||
|
||||
-- languages for which to compile Try
|
||||
langsAPI = langsLang `except` ["Ara","Bul","Hin","Ina","Rus","Tha"]
|
||||
|
||||
-- languages for which to compile Mathematical
|
||||
langsMath = langsAPI
|
||||
|
||||
-- languages for which to run treebank test
|
||||
langsTest = langsLang `except` ["Ara","Bul","Cat","Hin","Rus","Spa","Tha"]
|
||||
|
||||
-- languages for which to run demo test
|
||||
langsDemo = langsLang `except` ["Ara","Hin","Ina","Tha"]
|
||||
|
||||
-- languages for which langs.pgf is built
|
||||
langsPGF = langsTest `only` ["Eng","Fre","Swe"]
|
||||
|
||||
-- languages for which Compatibility exists (to be extended)
|
||||
langsCompat = langsLang `only` ["Cat","Eng","Fin","Fre","Ita","Spa","Swe"]
|
||||
|
||||
treebankExx = "exx-resource.gft"
|
||||
treebankResults = "exx-resource.gftb"
|
||||
|
||||
main = do
|
||||
xx <- getArgs
|
||||
make xx
|
||||
|
||||
make :: [String] -> IO ()
|
||||
make xx = do
|
||||
let ifx opt act = if null xx || elem opt xx then act >> return () else return ()
|
||||
let ifxx opt act = if elem opt xx then act >> return () else return ()
|
||||
let pres = elem "present" xx
|
||||
let dir = if pres then "../present" else "../alltenses"
|
||||
|
||||
let optl ls = maybe ls id $ getOptLangs xx
|
||||
|
||||
ifx "lang" $ do
|
||||
mapM_ (gfc pres [] . lang) (optl langsLang)
|
||||
copy "*/*.gfo" dir
|
||||
ifx "compat" $ do
|
||||
mapM_ (gfc pres [] . compat) (optl langsCompat)
|
||||
copy "*/Compatibility*.gfo" dir
|
||||
ifx "api" $ do
|
||||
mapM_ (gfc pres presApiPath . try) (optl langsAPI)
|
||||
copy "*/*.gfo" dir
|
||||
ifx "math" $ do
|
||||
mapM_ (gfc False [] . math) (optl langsMath)
|
||||
copy "mathematical/*.gfo" "../mathematical"
|
||||
mapM_ (gfc False [] . symbolic) (optl langsMath)
|
||||
copy "mathematical/Symbolic*.gfo" "../mathematical"
|
||||
ifxx "pgf" $ do
|
||||
run_gfc $ ["-s","--make","--name=langs","--parser=off",
|
||||
"--output-dir=" ++ dir]
|
||||
++ [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- optl langsPGF]
|
||||
ifxx "test" $ do
|
||||
let ls = optl langsTest
|
||||
gf (treeb "Lang" ls) $ unwords [dir ++ "/Lang" ++ la ++ ".gfo" | (_,la) <- ls]
|
||||
ifxx "demo" $ do
|
||||
let ls = optl langsDemo
|
||||
gf (demos "Demo" ls) $ unwords ["demo/Demo" ++ la ++ ".gf" | (_,la) <- ls]
|
||||
ifxx "clean" $ do
|
||||
system "rm -f */*.gfo ../alltenses/*.gfo ../present/*.gfo"
|
||||
ifxx "clone" $ do
|
||||
let (pref,lang) = case getLangName xx of
|
||||
Just pl -> pl
|
||||
_ -> error "expected flag option file=ppppppLLL.gf"
|
||||
s <- readFile (pref ++ lang ++ ".gf")
|
||||
mapM_ (\la -> writeFile (pref ++ la ++ ".gf") (replaceLang lang la s)) (map snd (optl langs))
|
||||
return ()
|
||||
|
||||
gfc pres ppath file = do
|
||||
let preproc = if pres then "-preproc=./mkPresent" else ""
|
||||
let path = if pres then ppath else ""
|
||||
putStrLn $ "Compiling " ++ file
|
||||
run_gfc ["-s","-src", preproc, path, file]
|
||||
|
||||
gf comm file = do
|
||||
putStrLn $ "Reading " ++ file
|
||||
let cmd = "echo \"" ++ comm ++ "\" | gf -s " ++ file
|
||||
putStrLn cmd
|
||||
system cmd
|
||||
|
||||
treeb abstr ls = "rf -lines -tree -file=" ++ treebankExx ++
|
||||
" | l -treebank " ++ unlexer abstr ls ++ " | wf -file=" ++ treebankResults
|
||||
|
||||
demos abstr ls = "gr -number=100 | l -treebank " ++ unlexer abstr ls ++
|
||||
" | ps -to_html | wf -file=resdemo.html"
|
||||
|
||||
lang (lla,la) = lla ++ "/All" ++ la ++ ".gf"
|
||||
compat (lla,la) = lla ++ "/Compatibility" ++ la ++ ".gf"
|
||||
try (lla,la) = "api/Try" ++ la ++ ".gf"
|
||||
math (lla,la) = "mathematical/Mathematical" ++ la ++ ".gf"
|
||||
symbolic (lla,la) = "mathematical/Symbolic" ++ la ++ ".gf"
|
||||
|
||||
except ls es = filter (flip notElem es . snd) ls
|
||||
only ls es = filter (flip elem es . snd) ls
|
||||
|
||||
-- list of languages overriding the definitions above
|
||||
getOptLangs args = case [ls | a <- args, let (f,ls) = splitAt 6 a, f=="langs="] of
|
||||
ls:_ -> return $ findLangs $ seps ls
|
||||
_ -> Nothing
|
||||
where
|
||||
seps = words . map (\c -> if c==',' then ' ' else c)
|
||||
findLangs ls = [lang | lang@(_,la) <- langs, elem la ls]
|
||||
|
||||
-- the file name has the form p....pLLL.gf, i.e. 3-letter lang name, suffix .gf
|
||||
getLangName args = case [ls | a <- args, let (f,ls) = splitAt 5 a, f=="file="] of
|
||||
fi:_ -> let (nal,ferp) = splitAt 3 (drop 3 (reverse fi)) in return (reverse ferp,reverse nal)
|
||||
_ -> Nothing
|
||||
|
||||
replaceLang s1 s2 = repl where
|
||||
repl s = case s of
|
||||
c:cs -> case splitAt lgs s of
|
||||
(pre,rest) | pre == s1 -> s2 ++ repl rest
|
||||
_ -> c : repl cs
|
||||
_ -> s
|
||||
lgs = 3 -- length s1
|
||||
|
||||
unlexer abstr ls =
|
||||
"-unlexer=\\\"" ++ unwords
|
||||
[abstr ++ la ++ "=" ++ unl |
|
||||
lla@(_,la) <- ls, let unl = unlex lla, not (null unl)] ++
|
||||
"\\\""
|
||||
where
|
||||
unlex lla = maybe "" id $ lookup lla langsCoding
|
||||
|
||||
-- | Runs the gfc executable with the given arguments.
|
||||
run_gfc :: [String] -> IO ()
|
||||
run_gfc args =
|
||||
do p <- liftM (fromMaybe default_gfc) $ findExecutable "gfc"
|
||||
env <- getEnvironment
|
||||
case lookup "GF_LIB_PATH" env of
|
||||
Nothing -> putStrLn "$GF_LIB_PATH is not set."
|
||||
Just _ ->
|
||||
do let args' = filter (not . null) args ++ ["+RTS"] ++ rts_flags ++ ["-RTS"]
|
||||
cmd = p ++ " " ++ unwords (map showArg args')
|
||||
putStrLn $ "Running: " ++ cmd
|
||||
e <- system cmd
|
||||
case e of
|
||||
ExitSuccess -> return ()
|
||||
ExitFailure i -> putStrLn $ "gfc exited with exit code: " ++ show i
|
||||
where rts_flags = ["-K100M"]
|
||||
showArg arg = "'" ++ arg ++ "'"
|
||||
|
||||
copy :: String -> String -> IO ()
|
||||
copy from to =
|
||||
do system $ "cp " ++ from ++ " " ++ to
|
||||
return ()
|
||||
30
next-lib/src/abstract/Adjective.gf
Normal file
30
next-lib/src/abstract/Adjective.gf
Normal file
@@ -0,0 +1,30 @@
|
||||
--1 Adjective: Adjectives and Adjectival Phrases
|
||||
|
||||
abstract Adjective = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
-- The principal ways of forming an adjectival phrase are
|
||||
-- positive, comparative, relational, reflexive-relational, and
|
||||
-- elliptic-relational.
|
||||
-- (The superlative use is covered in [Noun Noun.html].$SuperlA$.)
|
||||
|
||||
PositA : A -> AP ; -- warm
|
||||
ComparA : A -> NP -> AP ; -- warmer than I
|
||||
ComplA2 : A2 -> NP -> AP ; -- married to her
|
||||
ReflA2 : A2 -> AP ; -- married to itself
|
||||
UseA2 : A2 -> A ; -- married
|
||||
|
||||
-- Sentence and question complements defined for all adjectival
|
||||
-- phrases, although the semantics is only clear for some adjectives.
|
||||
|
||||
SentAP : AP -> SC -> AP ; -- good that she is here
|
||||
|
||||
-- An adjectival phrase can be modified by an *adadjective*, such as "very".
|
||||
|
||||
AdAP : AdA -> AP -> AP ; -- very warm
|
||||
|
||||
-- The formation of adverbs from adjective (e.g. "quickly") is covered
|
||||
-- in [Adverb Adverb.html].
|
||||
|
||||
}
|
||||
32
next-lib/src/abstract/Adverb.gf
Normal file
32
next-lib/src/abstract/Adverb.gf
Normal file
@@ -0,0 +1,32 @@
|
||||
--1 Adverb: Adverbs and Adverbial Phrases
|
||||
|
||||
abstract Adverb = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
-- The two main ways of forming adverbs are from adjectives and by
|
||||
-- prepositions from noun phrases.
|
||||
|
||||
PositAdvAdj : A -> Adv ; -- warmly
|
||||
PrepNP : Prep -> NP -> Adv ; -- in the house
|
||||
|
||||
-- Comparative adverbs have a noun phrase or a sentence as object of
|
||||
-- comparison.
|
||||
|
||||
ComparAdvAdj : CAdv -> A -> NP -> Adv ; -- more warmly than John
|
||||
ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
|
||||
|
||||
-- Adverbs can be modified by 'adadjectives', just like adjectives.
|
||||
|
||||
AdAdv : AdA -> Adv -> Adv ; -- very quickly
|
||||
|
||||
-- Subordinate clauses can function as adverbs.
|
||||
|
||||
SubjS : Subj -> S -> Adv ; -- when she sleeps
|
||||
|
||||
-- Comparison adverbs also work as numeral adverbs.
|
||||
|
||||
AdnCAdv : CAdv -> AdN ; -- less (than five)
|
||||
|
||||
|
||||
}
|
||||
63
next-lib/src/abstract/Backward.gf
Normal file
63
next-lib/src/abstract/Backward.gf
Normal file
@@ -0,0 +1,63 @@
|
||||
--1 Obsolete constructs included for backward-compatibility
|
||||
|
||||
abstract Backward = Cat ** {
|
||||
|
||||
|
||||
-- from Cat
|
||||
|
||||
cat
|
||||
Slash ;
|
||||
|
||||
fun
|
||||
|
||||
-- from Verb 19/4/2008
|
||||
|
||||
ComplV2 : V2 -> NP -> VP ; -- use it
|
||||
ComplV3 : V3 -> NP -> NP -> VP ; -- send a message to her
|
||||
ComplV2V : V2V -> NP -> VP -> VP ; -- cause it to burn
|
||||
ComplV2S : V2S -> NP -> S -> VP ; -- tell me that it rains
|
||||
ComplV2Q : V2Q -> NP -> QS -> VP ; -- ask me who came
|
||||
ComplV2A : V2A -> NP -> AP -> VP ; -- paint it red
|
||||
|
||||
ReflV2 : V2 -> VP ; -- use itself
|
||||
|
||||
UseVQ : VQ -> V2 ; -- ask (a question)
|
||||
UseVS : VS -> V2 ; -- know (a secret)
|
||||
|
||||
|
||||
-- from Sentence 19/4/2008
|
||||
|
||||
SlashV2 : NP -> V2 -> Slash ; -- (whom) he sees
|
||||
SlashVVV2 : NP -> VV -> V2 -> Slash; -- (whom) he wants to see
|
||||
|
||||
-- from Noun 19/4/2008
|
||||
|
||||
NumInt : Int -> Num ; -- 51
|
||||
OrdInt : Int -> Ord ; -- 51st (DEPRECATED)
|
||||
NoOrd : Ord ;
|
||||
|
||||
-- 20/4
|
||||
DetSg : Quant -> Ord -> Det ; -- the best man
|
||||
DetPl : Quant -> Num -> Ord -> Det ; -- the five best men
|
||||
NoNum : Num ;
|
||||
|
||||
-- 22/4
|
||||
DefArt : Quant ; -- the (house), the (houses)
|
||||
IndefArt : Quant ; -- a (house), (houses)
|
||||
MassDet : Quant ; -- (beer)
|
||||
|
||||
-- from Structural 19/4/2008
|
||||
|
||||
that_NP : NP ;
|
||||
these_NP : NP ;
|
||||
this_NP : NP ;
|
||||
those_NP : NP ;
|
||||
|
||||
whichPl_IDet : IDet ;
|
||||
whichSg_IDet : IDet ;
|
||||
|
||||
-- from Adverb
|
||||
|
||||
AdvSC : SC -> Adv ; -- that he arrives ---- REMOVE?
|
||||
|
||||
}
|
||||
133
next-lib/src/abstract/Cat.gf
Normal file
133
next-lib/src/abstract/Cat.gf
Normal file
@@ -0,0 +1,133 @@
|
||||
--1 Cat: the Category System
|
||||
|
||||
-- The category system is central to the library in the sense
|
||||
-- that the other modules ($Adjective$, $Adverb$, $Noun$, $Verb$ etc)
|
||||
-- communicate through it. This means that a e.g. a function using
|
||||
-- $NP$s in $Verb$ need not know how $NP$s are constructed in $Noun$:
|
||||
-- it is enough that both $Verb$ and $Noun$ use the same type $NP$,
|
||||
-- which is given here in $Cat$.
|
||||
--
|
||||
-- Some categories are inherited from [``Common`` Common.html].
|
||||
-- The reason they are defined there is that they have the same
|
||||
-- implementation in all languages in the resource (typically,
|
||||
-- just a string). These categories are
|
||||
-- $AdA, AdN, AdV, Adv, Ant, CAdv, IAdv, PConj, Phr$,
|
||||
-- $Pol, SC, Tense, Text, Utt, Voc$.
|
||||
--
|
||||
-- Moreover, the list categories $ListAdv, ListAP, ListNP, ListS$
|
||||
-- are defined on $Conjunction$ and only used locally there.
|
||||
|
||||
|
||||
abstract Cat = Common ** {
|
||||
|
||||
cat
|
||||
|
||||
--2 Sentences and clauses
|
||||
|
||||
-- Constructed in [Sentence Sentence.html], and also in
|
||||
-- [Idiom Idiom.html].
|
||||
|
||||
S ; -- declarative sentence e.g. "she lived here"
|
||||
QS ; -- question e.g. "where did she live"
|
||||
RS ; -- relative e.g. "in which she lived"
|
||||
Cl ; -- declarative clause, with all tenses e.g. "she looks at this"
|
||||
ClSlash;-- clause missing NP (S/NP in GPSG) e.g. "she looks at"
|
||||
SSlash ;-- sentence missing NP e.g. "she has looked at"
|
||||
Imp ; -- imperative e.g. "look at this"
|
||||
|
||||
--2 Questions and interrogatives
|
||||
|
||||
-- Constructed in [Question Question.html].
|
||||
|
||||
QCl ; -- question clause, with all tenses e.g. "why does she walk"
|
||||
IP ; -- interrogative pronoun e.g. "who"
|
||||
IComp ; -- interrogative complement of copula e.g. "where"
|
||||
IDet ; -- interrogative determiner e.g. "how many"
|
||||
IQuant; -- interrogative quantifier e.g. "which"
|
||||
|
||||
--2 Relative clauses and pronouns
|
||||
|
||||
-- Constructed in [Relative Relative.html].
|
||||
|
||||
RCl ; -- relative clause, with all tenses e.g. "in which she lives"
|
||||
RP ; -- relative pronoun e.g. "in which"
|
||||
|
||||
--2 Verb phrases
|
||||
|
||||
-- Constructed in [Verb Verb.html].
|
||||
|
||||
VP ; -- verb phrase e.g. "is very warm"
|
||||
Comp ; -- complement of copula, such as AP e.g. "very warm"
|
||||
VPSlash ; -- verb phrase missing complement e.g. "give to John"
|
||||
|
||||
--2 Adjectival phrases
|
||||
|
||||
-- Constructed in [Adjective Adjective.html].
|
||||
|
||||
AP ; -- adjectival phrase e.g. "very warm"
|
||||
|
||||
--2 Nouns and noun phrases
|
||||
|
||||
-- Constructed in [Noun Noun.html].
|
||||
-- Many atomic noun phrases e.g. "everybody"
|
||||
-- are constructed in [Structural Structural.html].
|
||||
-- The determiner structure is
|
||||
-- ``` Predet (QuantSg | QuantPl Num) Ord
|
||||
-- as defined in [Noun Noun.html].
|
||||
|
||||
CN ; -- common noun (without determiner) e.g. "red house"
|
||||
NP ; -- noun phrase (subject or object) e.g. "the red house"
|
||||
Pron ; -- personal pronoun e.g. "she"
|
||||
Det ; -- determiner phrase e.g. "those seven"
|
||||
Predet ; -- predeterminer (prefixed Quant) e.g. "all"
|
||||
Quant ; -- quantifier ('nucleus' of Det) e.g. "this/these"
|
||||
Num ; -- number determining element e.g. "seven"
|
||||
Card ; -- cardinal number e.g. "seven"
|
||||
Ord ; -- ordinal number (used in Det) e.g. "seventh"
|
||||
|
||||
--2 Numerals
|
||||
|
||||
-- Constructed in [Numeral Numeral.html].
|
||||
|
||||
Numeral ; -- cardinal or ordinal in words e.g. "five/fifth"
|
||||
Digits ; -- cardinal or ordinal in digits e.g. "1,000/1,000th"
|
||||
|
||||
--2 Structural words
|
||||
|
||||
-- Constructed in [Structural Structural.html].
|
||||
|
||||
Conj ; -- conjunction e.g. "and"
|
||||
---b DConj ; -- distributed conjunction e.g. "both - and"
|
||||
Subj ; -- subjunction e.g. "if"
|
||||
Prep ; -- preposition, or just case e.g. "in"
|
||||
|
||||
--2 Words of open classes
|
||||
|
||||
-- These are constructed in [Lexicon Lexicon.html] and in
|
||||
-- additional lexicon modules.
|
||||
|
||||
V ; -- one-place verb e.g. "sleep"
|
||||
V2 ; -- two-place verb e.g. "love"
|
||||
V3 ; -- three-place verb e.g. "show"
|
||||
VV ; -- verb-phrase-complement verb e.g. "want"
|
||||
VS ; -- sentence-complement verb e.g. "claim"
|
||||
VQ ; -- question-complement verb e.g. "wonder"
|
||||
VA ; -- adjective-complement verb e.g. "look"
|
||||
V2V ; -- verb with NP and V complement e.g. "cause"
|
||||
V2S ; -- verb with NP and S complement e.g. "tell"
|
||||
V2Q ; -- verb with NP and Q complement e.g. "ask"
|
||||
V2A ; -- verb with NP and AP complement e.g. "paint"
|
||||
|
||||
A ; -- one-place adjective e.g. "warm"
|
||||
A2 ; -- two-place adjective e.g. "divisible"
|
||||
|
||||
N ; -- common noun e.g. "house"
|
||||
N2 ; -- relational noun e.g. "son"
|
||||
N3 ; -- three-place relational noun e.g. "connection"
|
||||
PN ; -- proper name e.g. "Paris"
|
||||
|
||||
-- DEPRECATED: QuantSg, QuantPl
|
||||
--- QuantSg ;-- quantifier ('nucleus' of sing. Det) e.g. "every"
|
||||
--- QuantPl ;-- quantifier ('nucleus' of plur. Det) e.g. "many"
|
||||
|
||||
}
|
||||
64
next-lib/src/abstract/Common.gf
Normal file
64
next-lib/src/abstract/Common.gf
Normal file
@@ -0,0 +1,64 @@
|
||||
--1 Common: Structures with Common Implementations.
|
||||
|
||||
-- This module defines the categories that uniformly have the linearization
|
||||
-- ${s : Str}$ in all languages.
|
||||
|
||||
-- Moreover, this module defines the abstract parameters of tense, polarity, and
|
||||
-- anteriority, which are used in [``Phrase`` Phrase.html] to generate different
|
||||
-- forms of sentences. Together they give 4 x 2 x 2 = 16 sentence forms.
|
||||
|
||||
-- These tenses are defined for all languages in the library. More tenses
|
||||
-- can be defined in the language extensions, e.g. the "passé simple" of
|
||||
-- Romance languages in [``ExtraRomance`` ../romance/ExtraRomance.gf].
|
||||
|
||||
abstract Common = {
|
||||
|
||||
cat
|
||||
|
||||
--2 Top-level units
|
||||
|
||||
-- Constructed in [``Text`` Text.html]: $Text$.
|
||||
|
||||
Text ; -- text consisting of several phrases e.g. "He is here. Why?"
|
||||
|
||||
-- Constructed in [``Phrase`` Phrase.html]:
|
||||
|
||||
Phr ; -- phrase in a text e.g. "but be quiet please"
|
||||
Utt ; -- sentence, question, word... e.g. "be quiet"
|
||||
Voc ; -- vocative or "please" e.g. "my darling"
|
||||
PConj ; -- phrase-beginning conjunction e.g. "therefore"
|
||||
|
||||
-- Constructed in [``Sentence`` Sentence.html]:
|
||||
|
||||
SC ; -- embedded sentence or question e.g. "that it rains"
|
||||
|
||||
--2 Adverbs
|
||||
|
||||
-- Constructed in [``Adverb`` Adverb.html].
|
||||
-- Many adverbs are constructed in [``Structural`` Structural.html].
|
||||
|
||||
Adv ; -- verb-phrase-modifying adverb e.g. "in the house"
|
||||
AdV ; -- adverb directly attached to verb e.g. "always"
|
||||
AdA ; -- adjective-modifying adverb e.g. "very"
|
||||
AdN ; -- numeral-modifying adverb e.g. "more than"
|
||||
IAdv ; -- interrogative adverb e.g. "why"
|
||||
CAdv ; -- comparative adverb e.g. "more"
|
||||
|
||||
--2 Tense, polarity, and anteriority
|
||||
|
||||
Temp ; -- temporal and aspectual features e.g. past anterior
|
||||
Tense ; -- tense e.g. present, past, future
|
||||
Pol ; -- polarity e.g. positive, negative
|
||||
Ant ; -- anteriority e.g. simultaneous, anterior
|
||||
|
||||
fun
|
||||
TTAnt : Tense -> Ant -> Temp ;
|
||||
|
||||
PPos, PNeg : Pol ; -- I sleep/don't sleep
|
||||
|
||||
TPres : Tense ;
|
||||
ASimul : Ant ;
|
||||
TPast, TFut, TCond : Tense ; -- I slept/will sleep/would sleep --# notpresent
|
||||
AAnter : Ant ; -- I have slept --# notpresent
|
||||
|
||||
}
|
||||
52
next-lib/src/abstract/Conjunction.gf
Normal file
52
next-lib/src/abstract/Conjunction.gf
Normal file
@@ -0,0 +1,52 @@
|
||||
--1 Conjunction: Coordination
|
||||
|
||||
-- Coordination is defined for many different categories; here is
|
||||
-- a sample. The rules apply to *lists* of two or more elements,
|
||||
-- and define two general patterns:
|
||||
-- - ordinary conjunction: X,...X and X
|
||||
-- - distributed conjunction: both X,...,X and X
|
||||
--
|
||||
--
|
||||
-- $VP$ conjunctions are not covered here, because their applicability
|
||||
-- depends on language. Some special cases are defined in
|
||||
-- [``Extra`` ../abstract/Extra.gf].
|
||||
|
||||
|
||||
abstract Conjunction = Cat ** {
|
||||
|
||||
--2 Rules
|
||||
|
||||
fun
|
||||
ConjS : Conj -> [S] -> S ; -- "he walks and she runs"
|
||||
ConjAP : Conj -> [AP] -> AP ; -- "cold and warm"
|
||||
ConjNP : Conj -> [NP] -> NP ; -- "she or we"
|
||||
ConjAdv : Conj -> [Adv] -> Adv ; -- "here or there"
|
||||
|
||||
---b DConjS : DConj -> [S] -> S ; -- "either he walks or she runs"
|
||||
---b DConjAP : DConj -> [AP] -> AP ; -- "both warm and cold"
|
||||
---b DConjNP : DConj -> [NP] -> NP ; -- "either he or she"
|
||||
---b DConjAdv : DConj -> [Adv] -> Adv; -- "both here and there"
|
||||
|
||||
--2 Categories
|
||||
|
||||
-- These categories are only used in this module.
|
||||
|
||||
cat
|
||||
[S]{2} ;
|
||||
[Adv]{2} ;
|
||||
[NP]{2} ;
|
||||
[AP]{2} ;
|
||||
|
||||
--2 List constructors
|
||||
|
||||
-- The list constructors are derived from the list notation and therefore
|
||||
-- not given explicitly. But here are their type signatures:
|
||||
|
||||
-- BaseC : C -> C -> [C] ; -- for C = S, AP, NP, Adv
|
||||
-- ConsC : C -> [C] -> [C] ;
|
||||
}
|
||||
|
||||
--.
|
||||
-- *Note*. This module uses right-recursive lists. If backward
|
||||
-- compatibility with API 0.9 is needed, use
|
||||
-- [SeqConjunction SeqConjunction.html].
|
||||
30
next-lib/src/abstract/Extra.gf
Normal file
30
next-lib/src/abstract/Extra.gf
Normal file
@@ -0,0 +1,30 @@
|
||||
--1 More syntax rules
|
||||
|
||||
-- This module defines syntax rules that are not implemented in all
|
||||
-- languages, but in more than one, so that it makes sense to offer a
|
||||
-- common API.
|
||||
|
||||
abstract Extra = Cat ** {
|
||||
|
||||
fun
|
||||
GenNP : NP -> Quant ; -- this man's
|
||||
ComplBareVS : VS -> S -> VP ; -- know you go
|
||||
|
||||
StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives in
|
||||
EmptyRelSlash : RP -> ClSlash -> RCl ; -- he lives in
|
||||
StrandQuestSlash : IP -> ClSlash -> QCl ; -- whom does John live with
|
||||
|
||||
-- $VP$ conjunction, which has different fragments implemented in
|
||||
-- different languages - never a full $VP$, though.
|
||||
|
||||
cat
|
||||
VPI ;
|
||||
[VPI] {2} ;
|
||||
|
||||
fun
|
||||
MkVPI : VP -> VPI ;
|
||||
ConjVPI : Conj -> [VPI] -> VPI ;
|
||||
ComplVPIVV : VV -> VPI -> VP ;
|
||||
|
||||
|
||||
}
|
||||
22
next-lib/src/abstract/Grammar.gf
Normal file
22
next-lib/src/abstract/Grammar.gf
Normal file
@@ -0,0 +1,22 @@
|
||||
--1 Grammar: the Main Module of the Resource Grammar
|
||||
|
||||
-- This grammar is a collection of the different grammar modules,
|
||||
-- To test the resource, import [``Lang`` Lang.html], which also contains
|
||||
-- a lexicon.
|
||||
|
||||
abstract Grammar =
|
||||
Noun,
|
||||
Verb,
|
||||
Adjective,
|
||||
Adverb,
|
||||
Numeral,
|
||||
Sentence,
|
||||
Question,
|
||||
Relative,
|
||||
Conjunction,
|
||||
Phrase,
|
||||
Text,
|
||||
Structural,
|
||||
Idiom ;
|
||||
|
||||
|
||||
22
next-lib/src/abstract/Idiom.gf
Normal file
22
next-lib/src/abstract/Idiom.gf
Normal file
@@ -0,0 +1,22 @@
|
||||
--1 Idiom: Idiomatic Expressions
|
||||
|
||||
abstract Idiom = Cat ** {
|
||||
|
||||
-- This module defines constructions that are formed in fixed ways,
|
||||
-- often different even in closely related languages.
|
||||
|
||||
fun
|
||||
ImpersCl : VP -> Cl ; -- it is hot
|
||||
GenericCl : VP -> Cl ; -- one sleeps
|
||||
|
||||
CleftNP : NP -> RS -> Cl ; -- it is I who did it
|
||||
CleftAdv : Adv -> S -> Cl ; -- it is here she slept
|
||||
|
||||
ExistNP : NP -> Cl ; -- there is a house
|
||||
ExistIP : IP -> QCl ; -- which houses are there
|
||||
|
||||
ProgrVP : VP -> VP ; -- be sleeping
|
||||
|
||||
ImpPl1 : VP -> Utt ; -- let's go
|
||||
|
||||
}
|
||||
13
next-lib/src/abstract/Lang.gf
Normal file
13
next-lib/src/abstract/Lang.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
--1 Lang: a Test Module for the Resource Grammar
|
||||
|
||||
-- This grammar is for testing the resource as included in the
|
||||
-- language-independent API, consisting of a grammar and a lexicon.
|
||||
-- The grammar without a lexicon is [``Grammar`` Grammar.html],
|
||||
-- which may be more suitable to open in applications.
|
||||
|
||||
abstract Lang =
|
||||
Grammar,
|
||||
Lexicon
|
||||
** {
|
||||
flags startcat=Phr ;
|
||||
} ;
|
||||
356
next-lib/src/abstract/Lexicon.gf
Normal file
356
next-lib/src/abstract/Lexicon.gf
Normal file
@@ -0,0 +1,356 @@
|
||||
abstract Lexicon = Cat ** {
|
||||
fun
|
||||
add_V3 : V3 ;
|
||||
airplane_N : N ;
|
||||
already_Adv : Adv ;
|
||||
animal_N : N ;
|
||||
answer_V2S : V2S ;
|
||||
apartment_N : N ;
|
||||
apple_N : N ;
|
||||
art_N : N ;
|
||||
ashes_N : N ;
|
||||
ask_V2Q : V2Q ;
|
||||
baby_N : N ;
|
||||
back_N : N ;
|
||||
bad_A : A ;
|
||||
bank_N : N ;
|
||||
bark_N : N ;
|
||||
beautiful_A : A ;
|
||||
become_VA : VA ;
|
||||
beer_N : N ;
|
||||
beg_V2V : V2V ;
|
||||
belly_N : N ;
|
||||
big_A : A ;
|
||||
bike_N : N ;
|
||||
bird_N : N ;
|
||||
bite_V2 : V2 ;
|
||||
black_A : A ;
|
||||
blood_N : N ;
|
||||
blow_V : V ;
|
||||
blue_A : A ;
|
||||
boat_N : N ;
|
||||
bone_N : N ;
|
||||
book_N : N ;
|
||||
boot_N : N ;
|
||||
boss_N : N ;
|
||||
boy_N : N ;
|
||||
bread_N : N ;
|
||||
break_V2 : V2 ;
|
||||
breast_N : N ;
|
||||
breathe_V : V ;
|
||||
broad_A : A ;
|
||||
brother_N2 : N2 ;
|
||||
brown_A : A ;
|
||||
burn_V : V ;
|
||||
butter_N : N ;
|
||||
buy_V2 : V2 ;
|
||||
camera_N : N ;
|
||||
cap_N : N ;
|
||||
car_N : N ;
|
||||
carpet_N : N ;
|
||||
cat_N : N ;
|
||||
ceiling_N : N ;
|
||||
chair_N : N ;
|
||||
cheese_N : N ;
|
||||
child_N : N ;
|
||||
church_N : N ;
|
||||
city_N : N ;
|
||||
clean_A : A ;
|
||||
clever_A : A ;
|
||||
close_V2 : V2 ;
|
||||
cloud_N : N ;
|
||||
coat_N : N ;
|
||||
cold_A : A ;
|
||||
come_V : V ;
|
||||
computer_N : N ;
|
||||
correct_A : A ;
|
||||
country_N : N ;
|
||||
count_V2 : V2 ;
|
||||
cousin_N : N ;
|
||||
cow_N : N ;
|
||||
cut_V2 : V2 ;
|
||||
day_N : N ;
|
||||
die_V : V ;
|
||||
dig_V : V ;
|
||||
dirty_A : A ;
|
||||
distance_N3 : N3 ;
|
||||
doctor_N : N ;
|
||||
dog_N : N ;
|
||||
door_N : N ;
|
||||
do_V2 : V2 ;
|
||||
drink_V2 : V2 ;
|
||||
drink_V2 : V2 ;
|
||||
dry_A : A ;
|
||||
dull_A : A ;
|
||||
dust_N : N ;
|
||||
ear_N : N ;
|
||||
earth_N : N ;
|
||||
easy_A2V : A2 ;
|
||||
eat_V2 : V2 ;
|
||||
eat_V2 : V2 ;
|
||||
egg_N : N ;
|
||||
empty_A : A ;
|
||||
enemy_N : N ;
|
||||
eye_N : N ;
|
||||
factory_N : N ;
|
||||
fall_V : V ;
|
||||
far_Adv : Adv ;
|
||||
father_N2 : N2 ;
|
||||
fat_N : N ;
|
||||
fear_VS : VS ;
|
||||
fear_V2 : V2 ;
|
||||
feather_N : N ;
|
||||
fight_V2 : V2 ;
|
||||
find_V2 : V2 ;
|
||||
fingernail_N : N ;
|
||||
fire_N : N ;
|
||||
fish_N : N ;
|
||||
float_V : V ;
|
||||
floor_N : N ;
|
||||
flower_N : N ;
|
||||
flow_V : V ;
|
||||
fly_V : V ;
|
||||
fog_N : N ;
|
||||
foot_N : N ;
|
||||
forest_N : N ;
|
||||
forget_V2 : V2 ;
|
||||
freeze_V : V ;
|
||||
fridge_N : N ;
|
||||
friend_N : N ;
|
||||
fruit_N : N ;
|
||||
full_A : A ;
|
||||
fun
|
||||
fun_AV : A ;
|
||||
garden_N : N ;
|
||||
girl_N : N ;
|
||||
give_V3 : V3 ;
|
||||
glove_N : N ;
|
||||
gold_N : N ;
|
||||
good_A : A ;
|
||||
go_V : V ;
|
||||
grammar_N : N ;
|
||||
grass_N : N ;
|
||||
green_A : A ;
|
||||
guts_N : N ;
|
||||
hair_N : N ;
|
||||
hand_N : N ;
|
||||
harbour_N : N ;
|
||||
hate_V2 : V2 ;
|
||||
hat_N : N ;
|
||||
have_V2 : V2 ;
|
||||
head_N : N ;
|
||||
heart_N : N ;
|
||||
hear_V2 : V2 ;
|
||||
hear_V2 : V2 ;
|
||||
heavy_A : A ;
|
||||
hill_N : N ;
|
||||
hit_V2 : V2 ;
|
||||
hold_V2 : V2 ;
|
||||
hope_VS : VS ;
|
||||
horn_N : N ;
|
||||
horse_N : N ;
|
||||
hot_A : A ;
|
||||
house_N : N ;
|
||||
hunt_V2 : V2 ;
|
||||
husband_N : N ;
|
||||
ice_N : N ;
|
||||
important_A : A ;
|
||||
industry_N : N ;
|
||||
iron_N : N ;
|
||||
john_PN : PN ;
|
||||
jump_V : V ;
|
||||
kill_V2 : V2 ;
|
||||
king_N : N ;
|
||||
knee_N : N ;
|
||||
know_V2 : V2 ;
|
||||
know_V2 : V2 ;
|
||||
lake_N : N ;
|
||||
lamp_N : N ;
|
||||
language_N : N ;
|
||||
laugh_V : V ;
|
||||
leaf_N : N ;
|
||||
learn_V2 : V2 ;
|
||||
leather_N : N ;
|
||||
leave_V2 : V2 ;
|
||||
left_Ord : Ord ;
|
||||
leg_N : N ;
|
||||
lie_V : V ;
|
||||
like_V2 : V2 ;
|
||||
listen_V2 : V2 ;
|
||||
liver_N : N ;
|
||||
live_V : V ;
|
||||
long_A : A ;
|
||||
lose_V2 : V2 ;
|
||||
louse_N : N ;
|
||||
love_N : N ;
|
||||
love_V2 : V2 ;
|
||||
man_N : N ;
|
||||
married_A2 : A2 ;
|
||||
meat_N : N ;
|
||||
milk_N : N ;
|
||||
moon_N : N ;
|
||||
mother_N2 : N2 ;
|
||||
mountain_N : N ;
|
||||
mouth_N : N ;
|
||||
music_N : N ;
|
||||
name_N : N ;
|
||||
narrow_A : A ;
|
||||
near_A : A ;
|
||||
neck_N : N ;
|
||||
new_A : A ;
|
||||
newspaper_N : N ;
|
||||
night_N : N ;
|
||||
nose_N : N ;
|
||||
now_Adv : Adv ;
|
||||
number_N : N ;
|
||||
oil_N : N ;
|
||||
old_A : A ;
|
||||
open_V2 : V2 ;
|
||||
paint_V2A : V2A ;
|
||||
paper_N : N ;
|
||||
paris_PN : PN ;
|
||||
peace_N : N ;
|
||||
pen_N : N ;
|
||||
person_N : N ;
|
||||
planet_N : N ;
|
||||
plastic_N : N ;
|
||||
play_V2 : V2 ;
|
||||
play_V : V ;
|
||||
policeman_N : N ;
|
||||
priest_N : N ;
|
||||
probable_AS : A ;
|
||||
pull_V2 : V2 ;
|
||||
push_V2 : V2 ;
|
||||
put_V2 : V2 ;
|
||||
queen_N : N ;
|
||||
question_N : N ;
|
||||
radio_N : N ;
|
||||
rain_N : N ;
|
||||
rain_V0 : V ;
|
||||
read_V2 : V2 ;
|
||||
ready_A : A ;
|
||||
reason_N : N ;
|
||||
red_A : A ;
|
||||
religion_N : N ;
|
||||
restaurant_N : N ;
|
||||
right_Ord : Ord ;
|
||||
river_N : N ;
|
||||
road_N : N ;
|
||||
rock_N : N ;
|
||||
roof_N : N ;
|
||||
root_N : N ;
|
||||
rope_N : N ;
|
||||
rotten_A : A ;
|
||||
round_A : A ;
|
||||
rubber_N : N ;
|
||||
rub_V2 : V2 ;
|
||||
rule_N : N ;
|
||||
run_V : V ;
|
||||
salt_N : N ;
|
||||
sand_N : N ;
|
||||
say_VS : VS ;
|
||||
school_N : N ;
|
||||
science_N : N ;
|
||||
scratch_V2 : V2 ;
|
||||
sea_N : N ;
|
||||
seed_N : N ;
|
||||
seek_V2 : V2 ;
|
||||
see_V2 : V2 ;
|
||||
see_V2 : V2 ;
|
||||
sell_V3 : V3 ;
|
||||
send_V3 : V3 ;
|
||||
sew_V : V ;
|
||||
sharp_A : A ;
|
||||
sheep_N : N ;
|
||||
ship_N : N ;
|
||||
shirt_N : N ;
|
||||
shoe_N : N ;
|
||||
shop_N : N ;
|
||||
short_A : A ;
|
||||
silver_N : N ;
|
||||
sing_V : V ;
|
||||
sister_N : N ;
|
||||
sit_V : V ;
|
||||
skin_N : N ;
|
||||
sky_N : N ;
|
||||
sleep_V : V ;
|
||||
small_A : A ;
|
||||
smell_V : V ;
|
||||
smoke_N : N ;
|
||||
smooth_A : A ;
|
||||
snake_N : N ;
|
||||
snow_N : N ;
|
||||
sock_N : N ;
|
||||
song_N : N ;
|
||||
speak_V2 : V2 ;
|
||||
spit_V : V ;
|
||||
split_V2 : V2 ;
|
||||
squeeze_V2 : V2 ;
|
||||
stab_V2 : V2 ;
|
||||
stand_V : V ;
|
||||
star_N : N ;
|
||||
steel_N : N ;
|
||||
stick_N : N ;
|
||||
stone_N : N ;
|
||||
stop_V : V ;
|
||||
stove_N : N ;
|
||||
straight_A : A ;
|
||||
student_N : N ;
|
||||
stupid_A : A ;
|
||||
suck_V2 : V2 ;
|
||||
sun_N : N ;
|
||||
swell_V : V ;
|
||||
swim_V : V ;
|
||||
switch8off_V2 : V2 ;
|
||||
switch8on_V2 : V2 ;
|
||||
table_N : N ;
|
||||
tail_N : N ;
|
||||
talk_V3 : V3 ;
|
||||
teacher_N : N ;
|
||||
teach_V2 : V2 ;
|
||||
television_N : N ;
|
||||
thick_A : A ;
|
||||
thin_A : A ;
|
||||
think_V : V ;
|
||||
throw_V2 : V2 ;
|
||||
tie_V2 : V2 ;
|
||||
today_Adv : Adv ;
|
||||
tongue_N : N ;
|
||||
tooth_N : N ;
|
||||
train_N : N ;
|
||||
travel_V : V ;
|
||||
tree_N : N ;
|
||||
turn_V : V ;
|
||||
ugly_A : A ;
|
||||
uncertain_A : A ;
|
||||
understand_V2 : V2 ;
|
||||
university_N : N ;
|
||||
village_N : N ;
|
||||
vomit_V : V ;
|
||||
wait_V2 : V2 ;
|
||||
walk_V : V ;
|
||||
warm_A : A ;
|
||||
war_N : N ;
|
||||
wash_V2 : V2 ;
|
||||
watch_V2 : V2 ;
|
||||
water_N : N ;
|
||||
wet_A : A ;
|
||||
white_A : A ;
|
||||
wide_A : A ;
|
||||
wife_N : N ;
|
||||
wind_N : N ;
|
||||
window_N : N ;
|
||||
wine_N : N ;
|
||||
wing_N : N ;
|
||||
win_V2 : V2 ;
|
||||
wipe_V2 : V2 ;
|
||||
woman_N : N ;
|
||||
wonder_VQ : VQ ;
|
||||
wood_N : N ;
|
||||
worm_N : N ;
|
||||
write_V2 : V2 ;
|
||||
year_N : N ;
|
||||
yellow_A : A ;
|
||||
young_A : A ;
|
||||
|
||||
}
|
||||
136
next-lib/src/abstract/Noun.gf
Normal file
136
next-lib/src/abstract/Noun.gf
Normal file
@@ -0,0 +1,136 @@
|
||||
--1 Noun: Nouns, noun phrases, and determiners
|
||||
|
||||
abstract Noun = Cat ** {
|
||||
|
||||
|
||||
--2 Noun phrases
|
||||
|
||||
-- The three main types of noun phrases are
|
||||
-- - common nouns with determiners
|
||||
-- - proper names
|
||||
-- - pronouns
|
||||
--
|
||||
--
|
||||
fun
|
||||
DetCN : Det -> CN -> NP ; -- the man
|
||||
UsePN : PN -> NP ; -- John
|
||||
UsePron : Pron -> NP ; -- he
|
||||
|
||||
-- Pronouns are defined in the module [``Structural`` Structural.html].
|
||||
|
||||
-- A noun phrase already formed can be modified by a $Predet$erminer.
|
||||
|
||||
PredetNP : Predet -> NP -> NP; -- only the man
|
||||
|
||||
-- A noun phrase can also be postmodified by the past participle of a
|
||||
-- verb, by an adverb, or by a relative clause
|
||||
|
||||
PPartNP : NP -> V2 -> NP ; -- the man seen
|
||||
AdvNP : NP -> Adv -> NP ; -- Paris today
|
||||
RelNP : NP -> RS -> NP ; -- Paris, which is here
|
||||
|
||||
-- Determiners can form noun phrases directly.
|
||||
|
||||
DetNP : Det -> NP ; -- these five
|
||||
|
||||
|
||||
--2 Determiners
|
||||
|
||||
-- The determiner has a fine-grained structure, in which a 'nucleus'
|
||||
-- quantifier and two optional parts can be discerned: a cardinal and
|
||||
-- an ordinal numeral.
|
||||
|
||||
DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best
|
||||
DetQuant : Quant -> Num -> Det ; -- these five
|
||||
|
||||
-- Whether the resulting determiner is singular or plural depends on the
|
||||
-- cardinal.
|
||||
|
||||
-- All parts of the determiner can be empty, except $Quant$, which is
|
||||
-- the "kernel" of a determiner. It is, however, the $Num$ that determines
|
||||
-- the inherent number.
|
||||
|
||||
NumSg : Num ;
|
||||
NumPl : Num ;
|
||||
NumCard : Card -> Num ;
|
||||
|
||||
-- $Card$ consists of either digits or numeral words.
|
||||
|
||||
NumDigits : Digits -> Card ; -- 51
|
||||
NumNumeral : Numeral -> Card ; -- fifty-one
|
||||
|
||||
-- The construction of numerals is defined in [Numeral Numeral.html].
|
||||
|
||||
-- A $Card$ can be modified by certain adverbs.
|
||||
|
||||
AdNum : AdN -> Card -> Card ; -- almost 51
|
||||
|
||||
-- An $Ord$ consists of either digits or numeral words.
|
||||
-- Also superlative forms of adjectives behave syntactically like ordinals.
|
||||
|
||||
OrdDigits : Digits -> Ord ; -- 51st
|
||||
OrdNumeral : Numeral -> Ord ; -- fifty-first
|
||||
OrdSuperl : A -> Ord ; -- warmest
|
||||
|
||||
-- Definite and indefinite noun phrases are sometimes realized as
|
||||
-- neatly distinct words (Spanish "un, unos ; el, los") but also without
|
||||
-- any particular word (Finnish; Swedish definites).
|
||||
|
||||
IndefArt : Quant ;
|
||||
DefArt : Quant ;
|
||||
|
||||
-- Nouns can be used without an article as mass nouns. The resource does
|
||||
-- not distinguish mass nouns from other common nouns, which can result
|
||||
-- in semantically odd expressions.
|
||||
|
||||
MassNP : CN -> NP ; -- (beer)
|
||||
|
||||
-- Pronouns have possessive forms. Genitives of other kinds
|
||||
-- of noun phrases are not given here, since they are not possible
|
||||
-- in e.g. Romance languages. They can be found in $Extra$ modules.
|
||||
|
||||
PossPron : Pron -> Quant ; -- my (house)
|
||||
|
||||
-- Other determiners are defined in [Structural Structural.html].
|
||||
|
||||
|
||||
|
||||
--2 Common nouns
|
||||
|
||||
-- Simple nouns can be used as nouns outright.
|
||||
|
||||
UseN : N -> CN ; -- house
|
||||
|
||||
-- Relational nouns take one or two arguments.
|
||||
|
||||
ComplN2 : N2 -> NP -> CN ; -- mother of the king
|
||||
ComplN3 : N3 -> NP -> N2 ; -- distance from this city (to Paris)
|
||||
|
||||
-- Relational nouns can also be used without their arguments.
|
||||
-- The semantics is typically derivative of the relational meaning.
|
||||
|
||||
UseN2 : N2 -> CN ; -- mother
|
||||
Use2N3 : N3 -> N2 ; -- distance (from this city)
|
||||
Use3N3 : N3 -> N2 ; -- distance (to Paris)
|
||||
|
||||
-- Nouns can be modified by adjectives, relative clauses, and adverbs
|
||||
-- (the last rule will give rise to many 'PP attachment' ambiguities
|
||||
-- when used in connection with verb phrases).
|
||||
|
||||
AdjCN : AP -> CN -> CN ; -- big house
|
||||
RelCN : CN -> RS -> CN ; -- house that John bought
|
||||
AdvCN : CN -> Adv -> CN ; -- house on the hill
|
||||
|
||||
-- Nouns can also be modified by embedded sentences and questions.
|
||||
-- For some nouns this makes little sense, but we leave this for applications
|
||||
-- to decide. Sentential complements are defined in [Verb Verb.html].
|
||||
|
||||
SentCN : CN -> SC -> CN ; -- question where she sleeps
|
||||
|
||||
--2 Apposition
|
||||
|
||||
-- This is certainly overgenerating.
|
||||
|
||||
ApposCN : CN -> NP -> CN ; -- city Paris (, numbers x and y)
|
||||
|
||||
} ;
|
||||
60
next-lib/src/abstract/Numeral.gf
Normal file
60
next-lib/src/abstract/Numeral.gf
Normal file
@@ -0,0 +1,60 @@
|
||||
--1 Numerals
|
||||
|
||||
-- This grammar defines numerals from 1 to 999999.
|
||||
-- The implementations are adapted from the
|
||||
-- [numerals library http://www.cs.chalmers.se/~aarne/GF/examples/numerals/]
|
||||
-- which defines numerals for 88 languages.
|
||||
-- The resource grammar implementations add to this inflection (if needed)
|
||||
-- and ordinal numbers.
|
||||
--
|
||||
-- *Note* 1. Number 1 as defined
|
||||
-- in the category $Numeral$ here should not be used in the formation of
|
||||
-- noun phrases, and should therefore be removed. Instead, one should use
|
||||
-- [Structural Structural.html]$.one_Quant$. This makes the grammar simpler
|
||||
-- because we can assume that numbers form plural noun phrases.
|
||||
--
|
||||
-- *Note* 2. The implementations introduce spaces between
|
||||
-- parts of a numeral, which is often incorrect - more work on
|
||||
-- (un)lexing is needed to solve this problem.
|
||||
|
||||
abstract Numeral = Cat ** {
|
||||
|
||||
cat
|
||||
Digit ; -- 2..9
|
||||
Sub10 ; -- 1..9
|
||||
Sub100 ; -- 1..99
|
||||
Sub1000 ; -- 1..999
|
||||
Sub1000000 ; -- 1..999999
|
||||
|
||||
fun
|
||||
num : Sub1000000 -> Numeral ;
|
||||
|
||||
n2, n3, n4, n5, n6, n7, n8, n9 : Digit ;
|
||||
|
||||
pot01 : Sub10 ; -- 1
|
||||
pot0 : Digit -> Sub10 ; -- d * 1
|
||||
pot110 : Sub100 ; -- 10
|
||||
pot111 : Sub100 ; -- 11
|
||||
pot1to19 : Digit -> Sub100 ; -- 10 + d
|
||||
pot0as1 : Sub10 -> Sub100 ; -- coercion of 1..9
|
||||
pot1 : Digit -> Sub100 ; -- d * 10
|
||||
pot1plus : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
|
||||
pot1as2 : Sub100 -> Sub1000 ; -- coercion of 1..99
|
||||
pot2 : Sub10 -> Sub1000 ; -- m * 100
|
||||
pot2plus : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
|
||||
pot2as3 : Sub1000 -> Sub1000000 ; -- coercion of 1..999
|
||||
pot3 : Sub1000 -> Sub1000000 ; -- m * 1000
|
||||
pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
|
||||
|
||||
-- Numerals as sequences of digits have a separate, simpler grammar
|
||||
|
||||
cat
|
||||
Dig ; -- single digit 0..9
|
||||
|
||||
fun
|
||||
IDig : Dig -> Digits ; -- 8
|
||||
IIDig : Dig -> Digits -> Digits ; -- 876
|
||||
|
||||
D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig ;
|
||||
|
||||
}
|
||||
44
next-lib/src/abstract/Phrase.gf
Normal file
44
next-lib/src/abstract/Phrase.gf
Normal file
@@ -0,0 +1,44 @@
|
||||
--1 Phrase: Phrases and Utterances
|
||||
|
||||
abstract Phrase = Cat ** {
|
||||
|
||||
-- When a phrase is built from an utterance it can be prefixed
|
||||
-- with a phrasal conjunction (such as "but", "therefore")
|
||||
-- and suffixing with a vocative (typically a noun phrase).
|
||||
|
||||
fun
|
||||
PhrUtt : PConj -> Utt -> Voc -> Phr ; -- but come here, my friend
|
||||
|
||||
-- Utterances are formed from sentences, questions, and imperatives.
|
||||
|
||||
UttS : S -> Utt ; -- John walks
|
||||
UttQS : QS -> Utt ; -- is it good
|
||||
UttImpSg : Pol -> Imp -> Utt; -- (don't) love yourself
|
||||
UttImpPl : Pol -> Imp -> Utt; -- (don't) love yourselves
|
||||
UttImpPol : Pol -> Imp -> Utt ; -- (don't) sleep (polite)
|
||||
|
||||
-- There are also 'one-word utterances'. A typical use of them is
|
||||
-- as answers to questions.
|
||||
-- *Note*. This list is incomplete. More categories could be covered.
|
||||
-- Moreover, in many languages e.g. noun phrases in different cases
|
||||
-- can be used.
|
||||
|
||||
UttIP : IP -> Utt ; -- who
|
||||
UttIAdv : IAdv -> Utt ; -- why
|
||||
UttNP : NP -> Utt ; -- this man
|
||||
UttAdv : Adv -> Utt ; -- here
|
||||
UttVP : VP -> Utt ; -- to sleep
|
||||
|
||||
-- The phrasal conjunction is optional. A sentence conjunction
|
||||
-- can also used to prefix an utterance.
|
||||
|
||||
NoPConj : PConj ;
|
||||
PConjConj : Conj -> PConj ; -- and
|
||||
|
||||
-- The vocative is optional. Any noun phrase can be made into vocative,
|
||||
-- which may be overgenerating (e.g. "I").
|
||||
|
||||
NoVoc : Voc ;
|
||||
VocNP : NP -> Voc ; -- my friend
|
||||
|
||||
}
|
||||
41
next-lib/src/abstract/Question.gf
Normal file
41
next-lib/src/abstract/Question.gf
Normal file
@@ -0,0 +1,41 @@
|
||||
--1 Question: Questions and Interrogative Pronouns
|
||||
|
||||
abstract Question = Cat ** {
|
||||
|
||||
-- A question can be formed from a clause ('yes-no question') or
|
||||
-- with an interrogative.
|
||||
|
||||
fun
|
||||
QuestCl : Cl -> QCl ; -- does John walk
|
||||
QuestVP : IP -> VP -> QCl ; -- who walks
|
||||
QuestSlash : IP -> ClSlash -> QCl ; -- whom does John love
|
||||
QuestIAdv : IAdv -> Cl -> QCl ; -- why does John walk
|
||||
QuestIComp : IComp -> NP -> QCl ; -- where is John
|
||||
|
||||
-- Interrogative pronouns can be formed with interrogative
|
||||
-- determiners, with or without a noun.
|
||||
|
||||
IdetCN : IDet -> CN -> IP ; -- which five songs
|
||||
IdetIP : IDet -> IP ; -- which five
|
||||
|
||||
-- They can be modified with adverbs.
|
||||
|
||||
AdvIP : IP -> Adv -> IP ; -- who in Paris
|
||||
|
||||
-- Interrogative quantifiers have number forms and can take number modifiers.
|
||||
|
||||
IdetQuant : IQuant -> Num -> IDet ; -- which (five)
|
||||
|
||||
-- Interrogative adverbs can be formed prepositionally.
|
||||
|
||||
PrepIP : Prep -> IP -> IAdv ; -- with whom
|
||||
|
||||
-- Interrogative complements to copulas can be both adverbs and
|
||||
-- pronouns.
|
||||
|
||||
CompIAdv : IAdv -> IComp ; -- where (is it)
|
||||
CompIP : IP -> IComp ; -- who (is it)
|
||||
|
||||
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
|
||||
|
||||
}
|
||||
26
next-lib/src/abstract/Relative.gf
Normal file
26
next-lib/src/abstract/Relative.gf
Normal file
@@ -0,0 +1,26 @@
|
||||
--1 Relative clauses and pronouns
|
||||
|
||||
abstract Relative = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
-- The simplest way to form a relative clause is from a clause by
|
||||
-- a pronoun similar to "such that".
|
||||
|
||||
RelCl : Cl -> RCl ; -- such that John loves her
|
||||
|
||||
-- The more proper ways are from a verb phrase
|
||||
-- (formed in [``Verb`` Verb.html]) or a sentence
|
||||
-- with a missing noun phrase (formed in [``Sentence`` Sentence.html]).
|
||||
|
||||
RelVP : RP -> VP -> RCl ; -- who loves John
|
||||
RelSlash : RP -> ClSlash -> RCl ; -- whom John loves
|
||||
|
||||
-- Relative pronouns are formed from an 'identity element' by prefixing
|
||||
-- or suffixing (depending on language) prepositional phrases.
|
||||
|
||||
IdRP : RP ; -- which
|
||||
FunRP : Prep -> NP -> RP -> RP ; -- the mother of whom
|
||||
|
||||
}
|
||||
|
||||
95
next-lib/src/abstract/Sentence.gf
Normal file
95
next-lib/src/abstract/Sentence.gf
Normal file
@@ -0,0 +1,95 @@
|
||||
--1 Sentence: Sentences, Clauses, and Imperatives
|
||||
|
||||
abstract Sentence = Cat ** {
|
||||
|
||||
--2 Clauses
|
||||
|
||||
-- The $NP VP$ predication rule form a clause whose linearization
|
||||
-- gives a table of all tense variants, positive and negative.
|
||||
-- Clauses are converted to $S$ (with fixed tense) with the
|
||||
-- $UseCl$ function below.
|
||||
|
||||
fun
|
||||
PredVP : NP -> VP -> Cl ; -- John walks
|
||||
|
||||
-- Using an embedded sentence as a subject is treated separately.
|
||||
-- This can be overgenerating. E.g. "whether you go" as subject
|
||||
-- is only meaningful for some verb phrases.
|
||||
|
||||
PredSCVP : SC -> VP -> Cl ; -- that she goes is good
|
||||
|
||||
--2 Clauses missing object noun phrases
|
||||
|
||||
-- This category is a variant of the 'slash category' $S/NP$ of
|
||||
-- GPSG and categorial grammars, which in turn replaces
|
||||
-- movement transformations in the formation of questions
|
||||
-- and relative clauses. Except $SlashV2$, the construction
|
||||
-- rules can be seen as special cases of function composition, in
|
||||
-- the style of CCG.
|
||||
-- *Note* the set is not complete and lacks e.g. verbs with more than 2 places.
|
||||
|
||||
SlashVP : NP -> VPSlash -> ClSlash ; -- (whom) he sees
|
||||
AdvSlash : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today
|
||||
SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks
|
||||
SlashVS : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves
|
||||
|
||||
--2 Imperatives
|
||||
|
||||
-- An imperative is straightforwardly formed from a verb phrase.
|
||||
-- It has variation over positive and negative, singular and plural.
|
||||
-- To fix these parameters, see [Phrase Phrase.html].
|
||||
|
||||
ImpVP : VP -> Imp ; -- love yourselves
|
||||
|
||||
--2 Embedded sentences
|
||||
|
||||
-- Sentences, questions, and infinitival phrases can be used as
|
||||
-- subjects and (adverbial) complements.
|
||||
|
||||
EmbedS : S -> SC ; -- that she goes
|
||||
EmbedQS : QS -> SC ; -- who goes
|
||||
EmbedVP : VP -> SC ; -- to go
|
||||
|
||||
--2 Sentences
|
||||
|
||||
-- These are the 2 x 4 x 4 = 16 forms generated by different
|
||||
-- combinations of tense, polarity, and
|
||||
-- anteriority, which are defined in [``Common`` Common.html].
|
||||
|
||||
fun
|
||||
UseCl : Temp -> Pol -> Cl -> S ;
|
||||
UseQCl : Temp -> Pol -> QCl -> QS ;
|
||||
UseRCl : Temp -> Pol -> RCl -> RS ;
|
||||
UseSlash : Temp -> Pol -> ClSlash -> SSlash ;
|
||||
|
||||
-- An adverb can be added to the beginning of a sentence.
|
||||
|
||||
AdvS : Adv -> S -> S ; -- today, I will go home
|
||||
|
||||
-- A sentence can be modified by a relative clause referring to its contents.
|
||||
|
||||
RelS : S -> RS -> S ; -- she sleeps, which is good
|
||||
|
||||
}
|
||||
|
||||
--.
|
||||
|
||||
-- Examples for English $S$/$Cl$:
|
||||
{-
|
||||
Pres Simul Pos ODir : he sleeps
|
||||
Pres Simul Neg ODir : he doesn't sleep
|
||||
Pres Anter Pos ODir : he has slept
|
||||
Pres Anter Neg ODir : he hasn't slept
|
||||
Past Simul Pos ODir : he slept
|
||||
Past Simul Neg ODir : he didn't sleep
|
||||
Past Anter Pos ODir : he had slept
|
||||
Past Anter Neg ODir : he hadn't slept
|
||||
Fut Simul Pos ODir : he will sleep
|
||||
Fut Simul Neg ODir : he won't sleep
|
||||
Fut Anter Pos ODir : he will have slept
|
||||
Fut Anter Neg ODir : he won't have slept
|
||||
Cond Simul Pos ODir : he would sleep
|
||||
Cond Simul Neg ODir : he wouldn't sleep
|
||||
Cond Anter Pos ODir : he would have slept
|
||||
Cond Anter Neg ODir : he wouldn't have slept
|
||||
-}
|
||||
111
next-lib/src/abstract/Structural.gf
Normal file
111
next-lib/src/abstract/Structural.gf
Normal file
@@ -0,0 +1,111 @@
|
||||
--1 Structural: Structural Words
|
||||
--
|
||||
-- Here we have some words belonging to closed classes and appearing
|
||||
-- in all languages we have considered.
|
||||
-- Sometimes more distinctions are needed, e.g. $we_Pron$ in Spanish
|
||||
-- should be replaced by masculine and feminine variants, found in
|
||||
-- [``ExtraSpa`` ../spanish/ExtraSpa.gf].
|
||||
|
||||
abstract Structural = Cat ** {
|
||||
|
||||
fun
|
||||
|
||||
-- This is an alphabetical list of structural words
|
||||
|
||||
above_Prep : Prep ;
|
||||
after_Prep : Prep ;
|
||||
all_Predet : Predet ;
|
||||
almost_AdA : AdA ;
|
||||
almost_AdN : AdN ;
|
||||
although_Subj : Subj ;
|
||||
always_AdV : AdV ;
|
||||
and_Conj : Conj ;
|
||||
because_Subj : Subj ;
|
||||
before_Prep : Prep ;
|
||||
behind_Prep : Prep ;
|
||||
between_Prep : Prep ;
|
||||
both7and_DConj : Conj ; -- both...and
|
||||
---b both7and_DConj : DConj ;
|
||||
but_PConj : PConj ;
|
||||
by8agent_Prep : Prep ; -- by (agent)
|
||||
by8means_Prep : Prep ; -- by (means of)
|
||||
can8know_VV : VV ; -- can (capacity)
|
||||
can_VV : VV ; -- can (possibility)
|
||||
during_Prep : Prep ;
|
||||
either7or_DConj : Conj ; -- either...or
|
||||
---b either7or_DConj : DConj ;
|
||||
every_Det : Det ;
|
||||
everybody_NP : NP ; -- everybody
|
||||
everything_NP : NP ;
|
||||
everywhere_Adv : Adv ;
|
||||
--- first_Ord : Ord ; DEPRECATED
|
||||
few_Det : Det ;
|
||||
for_Prep : Prep ;
|
||||
from_Prep : Prep ;
|
||||
he_Pron : Pron ;
|
||||
here_Adv : Adv ;
|
||||
here7to_Adv : Adv ; -- to here
|
||||
here7from_Adv : Adv ; -- from here
|
||||
how_IAdv : IAdv ;
|
||||
how8many_IDet : IDet ;
|
||||
i_Pron : Pron ;
|
||||
if_Subj : Subj ;
|
||||
in8front_Prep : Prep ; -- in front of
|
||||
in_Prep : Prep ;
|
||||
it_Pron : Pron ;
|
||||
less_CAdv : CAdv ;
|
||||
many_Det : Det ;
|
||||
more_CAdv : CAdv ;
|
||||
most_Predet : Predet ;
|
||||
much_Det : Det ;
|
||||
must_VV : VV ;
|
||||
---b no_Phr : Phr ;
|
||||
no_Utt : Utt ;
|
||||
on_Prep : Prep ;
|
||||
--- one_Quant : QuantSg ; DEPRECATED
|
||||
only_Predet : Predet ;
|
||||
or_Conj : Conj ;
|
||||
otherwise_PConj : PConj ;
|
||||
part_Prep : Prep ;
|
||||
please_Voc : Voc ;
|
||||
possess_Prep : Prep ; -- of (possessive)
|
||||
quite_Adv : AdA ;
|
||||
she_Pron : Pron ;
|
||||
so_AdA : AdA ;
|
||||
someSg_Det : Det ;
|
||||
somePl_Det : Det ;
|
||||
somebody_NP : NP ;
|
||||
something_NP : NP ;
|
||||
somewhere_Adv : Adv ;
|
||||
that_Quant : Quant ;
|
||||
there_Adv : Adv ;
|
||||
there7to_Adv : Adv ; -- to there
|
||||
there7from_Adv : Adv ; -- from there
|
||||
therefore_PConj : PConj ;
|
||||
they_Pron : Pron ;
|
||||
this_Quant : Quant ;
|
||||
through_Prep : Prep ;
|
||||
to_Prep : Prep ;
|
||||
too_AdA : AdA ;
|
||||
under_Prep : Prep ;
|
||||
very_AdA : AdA ;
|
||||
want_VV : VV ;
|
||||
we_Pron : Pron ;
|
||||
whatPl_IP : IP ; -- what (plural)
|
||||
whatSg_IP : IP ; -- what (singular)
|
||||
when_IAdv : IAdv ;
|
||||
when_Subj : Subj ;
|
||||
where_IAdv : IAdv ;
|
||||
which_IQuant : IQuant ;
|
||||
whoPl_IP : IP ; -- who (plural)
|
||||
whoSg_IP : IP ; -- who (singular)
|
||||
why_IAdv : IAdv ;
|
||||
with_Prep : Prep ;
|
||||
without_Prep : Prep ;
|
||||
---b yes_Phr : Phr ;
|
||||
yes_Utt : Utt ;
|
||||
youSg_Pron : Pron ; -- you (singular)
|
||||
youPl_Pron : Pron ; -- you (plural)
|
||||
youPol_Pron : Pron ; -- you (polite)
|
||||
|
||||
}
|
||||
46
next-lib/src/abstract/Symbol.gf
Normal file
46
next-lib/src/abstract/Symbol.gf
Normal file
@@ -0,0 +1,46 @@
|
||||
--1 Symbolic expressions
|
||||
|
||||
-- *Note*. This module is not automatically included in the main
|
||||
-- grammar [Lang Lang.html].
|
||||
|
||||
abstract Symbol = Cat, PredefAbs ** {
|
||||
|
||||
--2 Noun phrases with symbols and numbers
|
||||
|
||||
fun
|
||||
|
||||
SymbPN : Symb -> PN ; -- x
|
||||
IntPN : Int -> PN ; -- 27
|
||||
FloatPN : Float -> PN ; -- 3.14159
|
||||
NumPN : Card -> PN ;
|
||||
CNNumNP : CN -> Card -> NP ; -- level five ; level 5
|
||||
CNSymbNP : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y
|
||||
|
||||
|
||||
--2 Sentence consisting of a formula
|
||||
|
||||
SymbS : Symb -> S ; -- A
|
||||
|
||||
--2 Symbols as numerals
|
||||
|
||||
SymbNum : Symb -> Card ; -- n
|
||||
SymbOrd : Symb -> Ord ; -- n'th
|
||||
|
||||
--2 Symbol lists
|
||||
|
||||
-- A symbol list has at least two elements. The last two are separated
|
||||
-- by a conjunction ("and" in English), the others by commas.
|
||||
-- This produces "x, y and z", in English.
|
||||
|
||||
cat
|
||||
Symb ;
|
||||
[Symb]{2} ;
|
||||
|
||||
fun
|
||||
MkSymb : String -> Symb ;
|
||||
|
||||
--2 Obsolescent
|
||||
|
||||
CNIntNP : CN -> Int -> NP ; -- level 53 (covered by CNNumNP)
|
||||
|
||||
}
|
||||
15
next-lib/src/abstract/Text.gf
Normal file
15
next-lib/src/abstract/Text.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--1 Text: Texts
|
||||
|
||||
-- Texts are built from an empty text by adding $Phr$ases,
|
||||
-- using as constructors the punctuation marks ".", "?", and "!".
|
||||
-- Any punctuation mark can be attached to any kind of phrase.
|
||||
|
||||
abstract Text = Common ** {
|
||||
|
||||
fun
|
||||
TEmpty : Text ; --
|
||||
TFullStop : Phr -> Text -> Text ; -- John walks. ...
|
||||
TQuestMark : Phr -> Text -> Text ; -- Are they here? ...
|
||||
TExclMark : Phr -> Text -> Text ; -- Let's go! ...
|
||||
|
||||
}
|
||||
71
next-lib/src/abstract/Verb.gf
Normal file
71
next-lib/src/abstract/Verb.gf
Normal file
@@ -0,0 +1,71 @@
|
||||
--1 The construction of verb phrases
|
||||
|
||||
abstract Verb = Cat ** {
|
||||
|
||||
--2 Complementization rules
|
||||
|
||||
-- Verb phrases are constructed from verbs by providing their
|
||||
-- complements. There is one rule for each verb category.
|
||||
|
||||
fun
|
||||
UseV : V -> VP ; -- sleep
|
||||
|
||||
ComplVV : VV -> VP -> VP ; -- want to run
|
||||
ComplVS : VS -> S -> VP ; -- say that she runs
|
||||
ComplVQ : VQ -> QS -> VP ; -- wonder who runs
|
||||
ComplVA : VA -> AP -> VP ; -- they become red
|
||||
|
||||
SlashV2a : V2 -> VPSlash ; -- love (it)
|
||||
Slash2V3 : V3 -> NP -> VPSlash ; -- give it (to her)
|
||||
Slash3V3 : V3 -> NP -> VPSlash ; -- give (it) to her
|
||||
|
||||
SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go
|
||||
SlashV2S : V2S -> S -> VPSlash ; -- answer (to him) that it is good
|
||||
SlashV2Q : V2Q -> QS -> VPSlash ; -- ask (him) who came
|
||||
SlashV2A : V2A -> AP -> VPSlash ; -- paint (it) red
|
||||
|
||||
ComplSlash : VPSlash -> NP -> VP ; -- love it
|
||||
|
||||
SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy
|
||||
SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
|
||||
|
||||
--2 Other ways of forming verb phrases
|
||||
|
||||
-- Verb phrases can also be constructed reflexively and from
|
||||
-- copula-preceded complements.
|
||||
|
||||
ReflVP : VPSlash -> VP ; -- love himself
|
||||
UseComp : Comp -> VP ; -- be warm
|
||||
|
||||
-- Passivization of two-place verbs is another way to use
|
||||
-- them. In many languages, the result is a participle that
|
||||
-- is used as complement to a copula ("is used"), but other
|
||||
-- auxiliary verbs are possible (Ger. "wird angewendet", It.
|
||||
-- "viene usato"), as well as special verb forms (Fin. "käytetään",
|
||||
-- Swe. "används").
|
||||
--
|
||||
-- *Note*. the rule can be overgenerating, since the $V2$ need not
|
||||
-- take a direct object.
|
||||
|
||||
PassV2 : V2 -> VP ; -- be loved
|
||||
|
||||
-- Adverbs can be added to verb phrases. Many languages make
|
||||
-- a distinction between adverbs that are attached in the end
|
||||
-- vs. next to (or before) the verb.
|
||||
|
||||
AdvVP : VP -> Adv -> VP ; -- sleep here
|
||||
AdVVP : AdV -> VP -> VP ; -- always sleep
|
||||
|
||||
-- *Agents of passives* are constructed as adverbs with the
|
||||
-- preposition [Structural Structural.html]$.8agent_Prep$.
|
||||
|
||||
|
||||
--2 Complements to copula
|
||||
|
||||
-- Adjectival phrases, noun phrases, and adverbs can be used.
|
||||
|
||||
CompAP : AP -> Comp ; -- (be) small
|
||||
CompNP : NP -> Comp ; -- (be) a man
|
||||
CompAdv : Adv -> Comp ; -- (be) here
|
||||
|
||||
}
|
||||
193
next-lib/src/api/Combinators.gf
Normal file
193
next-lib/src/api/Combinators.gf
Normal file
@@ -0,0 +1,193 @@
|
||||
--1 Combinators: a High-Level Syntax API
|
||||
|
||||
-- This module defines some "grammatical functions" that give shortcuts to
|
||||
-- typical constructions. [``Constructors`` Constructors.html] and the
|
||||
-- language-specific ``Paradigms`` modules are usually needed
|
||||
-- to construct arguments of these functions.
|
||||
|
||||
incomplete resource Combinators = open Cat, Structural, Constructors in {
|
||||
|
||||
oper
|
||||
|
||||
--2 Predication
|
||||
|
||||
pred : overload {
|
||||
pred : V -> NP -> Cl ; -- x converges
|
||||
pred : V2 -> NP -> NP -> Cl ; -- x intersects y
|
||||
pred : V3 -> NP -> NP -> NP -> Cl ; -- x intersects y at z
|
||||
pred : V -> NP -> NP -> Cl ; -- x and y intersect
|
||||
pred : A -> NP -> Cl ; -- x is even
|
||||
pred : A2 -> NP -> NP -> Cl ; -- x is divisible by y
|
||||
pred : A -> NP -> NP -> Cl ; -- x and y are equal
|
||||
pred : N -> NP -> Cl ; -- x is a maximum
|
||||
pred : CN -> NP -> Cl ; -- x is a local maximum
|
||||
pred : NP -> NP -> Cl ; -- x is the neutral element
|
||||
pred : N -> NP -> NP -> Cl ; -- x and y are inverses
|
||||
pred : Adv -> NP -> Cl ; -- x is in scope
|
||||
pred : Prep -> NP -> NP -> Cl -- x is outside y
|
||||
} ;
|
||||
|
||||
--2 Function application
|
||||
|
||||
app : overload {
|
||||
app : N -> NP ;
|
||||
app : N2 -> NP -> NP ;
|
||||
app : N3 -> NP -> NP -> NP ;
|
||||
app : N2 -> NP -> NP -> NP ;
|
||||
app : N2 -> N -> CN ;
|
||||
|
||||
app : N2 -> NP -> CN ; -- divisor of x
|
||||
app : N3 -> NP -> NP -> CN ; -- path from x to y
|
||||
app : N2 -> NP -> NP -> CN ; -- path between x and y
|
||||
} ;
|
||||
|
||||
--2 Coordination
|
||||
|
||||
coord : overload {
|
||||
coord : Conj -> Adv -> Adv -> Adv ;
|
||||
coord : Conj -> AP -> AP -> AP ;
|
||||
coord : Conj -> NP -> NP -> NP ;
|
||||
coord : Conj -> S -> S -> S ;
|
||||
coord : Conj -> ListAdv -> Adv ;
|
||||
coord : Conj -> ListAP -> AP ;
|
||||
coord : Conj -> ListNP -> NP ;
|
||||
coord : Conj -> ListS -> S ;
|
||||
|
||||
} ;
|
||||
|
||||
--2 Modification
|
||||
|
||||
mod : overload {
|
||||
mod : A -> N -> CN ;
|
||||
mod : AP -> CN -> CN ;
|
||||
mod : AdA -> A -> AP ;
|
||||
mod : Det -> N -> NP ;
|
||||
mod : Det -> CN -> NP ;
|
||||
mod : Quant -> N -> NP ;
|
||||
mod : Quant -> CN -> NP ;
|
||||
mod : Predet -> N -> NP ;
|
||||
mod : Numeral -> N -> NP
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
--2 Negation
|
||||
|
||||
neg : overload {
|
||||
neg : Imp -> Utt ;
|
||||
neg : Cl -> S ;
|
||||
neg : QCl -> QS ;
|
||||
neg : RCl -> RS
|
||||
};
|
||||
|
||||
--2 Text append
|
||||
|
||||
-- This is not in ground API, because it would destroy parsing.
|
||||
|
||||
appendText : Text -> Text -> Text ;
|
||||
|
||||
--.
|
||||
|
||||
pred = overload {
|
||||
pred : V -> NP -> Cl
|
||||
= \v,np -> mkCl np v ;
|
||||
pred : V2 -> NP -> NP -> Cl
|
||||
= \v,np,ob -> mkCl np v ob ;
|
||||
pred : V3 -> NP -> NP -> NP -> Cl
|
||||
= \v,np,ob,ob2 -> mkCl np v ob ob2 ;
|
||||
pred : V -> NP -> NP -> Cl
|
||||
= \v,x,y -> mkCl (mkNP and_Conj x y) v ;
|
||||
pred : A -> NP -> Cl
|
||||
= \a,np -> mkCl np a ;
|
||||
pred : A2 -> NP -> NP -> Cl
|
||||
= \a,x,y -> mkCl x a y ;
|
||||
pred : A -> NP -> NP -> Cl
|
||||
= \a,x,y -> mkCl (mkNP and_Conj x y) a ;
|
||||
pred : N -> NP -> Cl
|
||||
= \n,x -> mkCl x (mkNP a_Art n) ;
|
||||
pred : CN -> NP -> Cl
|
||||
= \n,x -> mkCl x (mkNP a_Art n) ;
|
||||
pred : NP -> NP -> Cl
|
||||
= \n,x -> mkCl x n ;
|
||||
pred : N2 -> NP -> NP -> Cl
|
||||
= \n,x,y -> mkCl x (mkNP a_Art (mkCN n y)) ;
|
||||
pred : N -> NP -> NP -> Cl
|
||||
= \n,x,y -> mkCl (mkNP and_Conj x y) (mkNP a_Art plNum n) ;
|
||||
pred : Adv -> NP -> Cl
|
||||
= \a,x -> mkCl x a ;
|
||||
pred : Prep -> NP -> NP -> Cl
|
||||
= \p,x,y -> mkCl x (mkAdv p y) ;
|
||||
} ;
|
||||
|
||||
app = overload {
|
||||
app : N -> NP
|
||||
= \n -> mkNP the_Art n ;
|
||||
app : N2 -> NP -> NP
|
||||
= \n,x -> mkNP the_Art (mkCN n x) ;
|
||||
app : N3 -> NP -> NP -> NP
|
||||
= \n,x,y -> mkNP the_Art (mkCN n x y) ;
|
||||
app : N2 -> NP -> NP -> NP
|
||||
= \n,x,y -> mkNP the_Art (mkCN n (mkNP and_Conj x y)) ;
|
||||
app : N2 -> N -> CN
|
||||
= \f,n -> mkCN f (mkNP a_Art plNum n) ;
|
||||
app : N2 -> NP -> CN
|
||||
= mkCN ;
|
||||
app : N3 -> NP -> NP -> CN
|
||||
= mkCN ;
|
||||
app : N2 -> NP -> NP -> CN
|
||||
= \n,x,y -> mkCN n (mkNP and_Conj x y) ;
|
||||
} ;
|
||||
|
||||
coord = overload {
|
||||
coord : Conj -> Adv -> Adv -> Adv
|
||||
= mkAdv ;
|
||||
coord : Conj -> AP -> AP -> AP
|
||||
= mkAP ;
|
||||
coord : Conj -> NP -> NP -> NP
|
||||
= mkNP ;
|
||||
coord : Conj -> S -> S -> S
|
||||
= mkS ;
|
||||
coord : Conj -> ListAdv -> Adv
|
||||
= mkAdv ;
|
||||
coord : Conj -> ListAP -> AP
|
||||
= mkAP ;
|
||||
coord : Conj -> ListNP -> NP
|
||||
= mkNP ;
|
||||
coord : Conj -> ListS -> S
|
||||
= mkS ;
|
||||
} ;
|
||||
|
||||
mod = overload {
|
||||
mod : A -> N -> CN
|
||||
= mkCN ;
|
||||
mod : AP -> CN -> CN
|
||||
= mkCN ;
|
||||
mod : AdA -> A -> AP
|
||||
= mkAP ;
|
||||
mod : Det -> N -> NP
|
||||
= mkNP ;
|
||||
mod : Det -> CN -> NP
|
||||
= mkNP ;
|
||||
mod : Quant -> N -> NP
|
||||
= mkNP ;
|
||||
mod : Quant -> CN -> NP
|
||||
= mkNP ;
|
||||
mod : Predet -> N -> NP
|
||||
= \p,n -> mkNP p (mkNP a_Art n) ;
|
||||
mod : Numeral -> N -> NP
|
||||
= mkNP ;
|
||||
} ;
|
||||
|
||||
neg = overload {
|
||||
neg : Imp -> Utt
|
||||
= mkUtt negativePol ;
|
||||
neg : Cl -> S
|
||||
= mkS negativePol ;
|
||||
neg : QCl -> QS
|
||||
= mkQS negativePol ;
|
||||
neg : RCl -> RS
|
||||
= mkRS negativePol ;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
6
next-lib/src/api/CombinatorsAra.gf
Normal file
6
next-lib/src/api/CombinatorsAra.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsAra = Combinators with
|
||||
(Cat = CatAra),
|
||||
(Structural = StructuralAra),
|
||||
(Constructors = ConstructorsAra) ;
|
||||
6
next-lib/src/api/CombinatorsBul.gf
Normal file
6
next-lib/src/api/CombinatorsBul.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsBul = Combinators with
|
||||
(Cat = CatBul),
|
||||
(Structural = StructuralBul),
|
||||
(Constructors = ConstructorsBul) ;
|
||||
6
next-lib/src/api/CombinatorsCat.gf
Normal file
6
next-lib/src/api/CombinatorsCat.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsCat = Combinators with
|
||||
(Cat = CatCat),
|
||||
(Structural = StructuralCat),
|
||||
(Constructors = ConstructorsCat) ;
|
||||
6
next-lib/src/api/CombinatorsDan.gf
Normal file
6
next-lib/src/api/CombinatorsDan.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsDan = Combinators with
|
||||
(Cat = CatDan),
|
||||
(Structural = StructuralDan),
|
||||
(Constructors = ConstructorsDan) ;
|
||||
6
next-lib/src/api/CombinatorsEng.gf
Normal file
6
next-lib/src/api/CombinatorsEng.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsEng = Combinators with
|
||||
(Cat = CatEng),
|
||||
(Structural = StructuralEng),
|
||||
(Constructors = ConstructorsEng) ;
|
||||
6
next-lib/src/api/CombinatorsFin.gf
Normal file
6
next-lib/src/api/CombinatorsFin.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsFin = Combinators with
|
||||
(Cat = CatFin),
|
||||
(Structural = StructuralFin),
|
||||
(Constructors = ConstructorsFin) ;
|
||||
6
next-lib/src/api/CombinatorsFre.gf
Normal file
6
next-lib/src/api/CombinatorsFre.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsFre = Combinators with
|
||||
(Cat = CatFre),
|
||||
(Structural = StructuralFre),
|
||||
(Constructors = ConstructorsFre) ;
|
||||
6
next-lib/src/api/CombinatorsGer.gf
Normal file
6
next-lib/src/api/CombinatorsGer.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsGer = Combinators with
|
||||
(Cat = CatGer),
|
||||
(Structural = StructuralGer),
|
||||
(Constructors = ConstructorsGer) ;
|
||||
6
next-lib/src/api/CombinatorsHin.gf
Normal file
6
next-lib/src/api/CombinatorsHin.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsHin = Combinators with
|
||||
(Cat = CatHin),
|
||||
(Structural = StructuralHin),
|
||||
(Constructors = ConstructorsHin) ;
|
||||
6
next-lib/src/api/CombinatorsIna.gf
Normal file
6
next-lib/src/api/CombinatorsIna.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsIna = Combinators with
|
||||
(Cat = CatIna),
|
||||
(Structural = StructuralIna),
|
||||
(Constructors = ConstructorsIna) ;
|
||||
6
next-lib/src/api/CombinatorsIta.gf
Normal file
6
next-lib/src/api/CombinatorsIta.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsIta = Combinators with
|
||||
(Cat = CatIta),
|
||||
(Structural = StructuralIta),
|
||||
(Constructors = ConstructorsIta) ;
|
||||
6
next-lib/src/api/CombinatorsNor.gf
Normal file
6
next-lib/src/api/CombinatorsNor.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsNor = Combinators with
|
||||
(Cat = CatNor),
|
||||
(Structural = StructuralNor),
|
||||
(Constructors = ConstructorsNor) ;
|
||||
6
next-lib/src/api/CombinatorsRus.gf
Normal file
6
next-lib/src/api/CombinatorsRus.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsRus = Combinators with
|
||||
(Cat = CatRus),
|
||||
(Structural = StructuralRus),
|
||||
(Constructors = ConstructorsRus) ;
|
||||
6
next-lib/src/api/CombinatorsSpa.gf
Normal file
6
next-lib/src/api/CombinatorsSpa.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsSpa = Combinators with
|
||||
(Cat = CatSpa),
|
||||
(Structural = StructuralSpa),
|
||||
(Constructors = ConstructorsSpa) ;
|
||||
6
next-lib/src/api/CombinatorsSwe.gf
Normal file
6
next-lib/src/api/CombinatorsSwe.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsSwe = Combinators with
|
||||
(Cat = CatSwe),
|
||||
(Structural = StructuralSwe),
|
||||
(Constructors = ConstructorsSwe) ;
|
||||
6
next-lib/src/api/CombinatorsTha.gf
Normal file
6
next-lib/src/api/CombinatorsTha.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsTha = Combinators with
|
||||
(Cat = CatTha),
|
||||
(Structural = StructuralTha),
|
||||
(Constructors = ConstructorsTha) ;
|
||||
1699
next-lib/src/api/Constructors.gf
Normal file
1699
next-lib/src/api/Constructors.gf
Normal file
File diff suppressed because it is too large
Load Diff
3
next-lib/src/api/ConstructorsBul.gf
Normal file
3
next-lib/src/api/ConstructorsBul.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsBul = Constructors with (Grammar = GrammarBul) ;
|
||||
3
next-lib/src/api/ConstructorsCat.gf
Normal file
3
next-lib/src/api/ConstructorsCat.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsCat = Constructors with (Grammar = GrammarCat) ;
|
||||
3
next-lib/src/api/ConstructorsDan.gf
Normal file
3
next-lib/src/api/ConstructorsDan.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsDan = Constructors with (Grammar = GrammarDan) ;
|
||||
3
next-lib/src/api/ConstructorsEng.gf
Normal file
3
next-lib/src/api/ConstructorsEng.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsEng = Constructors with (Grammar = GrammarEng) ;
|
||||
3
next-lib/src/api/ConstructorsFin.gf
Normal file
3
next-lib/src/api/ConstructorsFin.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsFin = Constructors with (Grammar = GrammarFin) ;
|
||||
3
next-lib/src/api/ConstructorsFre.gf
Normal file
3
next-lib/src/api/ConstructorsFre.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsFre = Constructors with (Grammar = GrammarFre) ;
|
||||
3
next-lib/src/api/ConstructorsGer.gf
Normal file
3
next-lib/src/api/ConstructorsGer.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsGer = Constructors with (Grammar = GrammarGer) ;
|
||||
3
next-lib/src/api/ConstructorsIta.gf
Normal file
3
next-lib/src/api/ConstructorsIta.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsIta = Constructors with (Grammar = GrammarIta) ;
|
||||
3
next-lib/src/api/ConstructorsNor.gf
Normal file
3
next-lib/src/api/ConstructorsNor.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsNor = Constructors with (Grammar = GrammarNor) ;
|
||||
3
next-lib/src/api/ConstructorsRus.gf
Normal file
3
next-lib/src/api/ConstructorsRus.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsRus = Constructors with (Grammar = GrammarRus) ;
|
||||
3
next-lib/src/api/ConstructorsSpa.gf
Normal file
3
next-lib/src/api/ConstructorsSpa.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsSpa = Constructors with (Grammar = GrammarSpa) ;
|
||||
3
next-lib/src/api/ConstructorsSwe.gf
Normal file
3
next-lib/src/api/ConstructorsSwe.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsSwe = Constructors with (Grammar = GrammarSwe) ;
|
||||
62
next-lib/src/api/Symbolic.gf
Normal file
62
next-lib/src/api/Symbolic.gf
Normal file
@@ -0,0 +1,62 @@
|
||||
--1 Symbolic: Noun Phrases with mathematical symbols
|
||||
|
||||
incomplete resource Symbolic = open
|
||||
Symbol, Syntax, PredefCnc in {
|
||||
|
||||
oper
|
||||
symb : overload {
|
||||
symb : Str -> NP ; -- x
|
||||
symb : Int -> NP ; -- 23
|
||||
symb : Float -> NP ; -- 0.99
|
||||
symb : N -> Digits -> NP ; -- level 4
|
||||
symb : N -> Card -> NP ; -- level four
|
||||
symb : CN -> Card -> NP ; -- advanced level four
|
||||
symb : Det -> N -> Card -> NP ; -- the number four
|
||||
symb : Det -> CN -> Card -> NP ; -- the even number four
|
||||
symb : Det -> N -> Str -> Str -> NP ; -- the levels i and j
|
||||
symb : Det -> CN -> [Symb] -> NP ; -- the basic levels i, j, and k
|
||||
symb : Symb -> S ; -- A
|
||||
symb : Symb -> Card ; -- n
|
||||
symb : Symb -> Ord -- n'th
|
||||
} ;
|
||||
|
||||
mkSymb : Str -> Symb ;
|
||||
mkInt : Str -> PredefCnc.Int ;
|
||||
mkFloat : Str -> PredefCnc.Float ;
|
||||
|
||||
--.
|
||||
|
||||
symb = overload {
|
||||
symb : Str -> NP
|
||||
= \s -> mkNP (SymbPN (mkSymb s)) ;
|
||||
symb : Int -> NP
|
||||
= \i -> mkNP (IntPN i) ;
|
||||
symb : Float -> NP
|
||||
= \i -> mkNP (FloatPN i) ;
|
||||
symb : N -> Digits -> NP
|
||||
= \c,i -> CNNumNP (mkCN c) (mkCard i) ;
|
||||
symb : N -> Card -> NP
|
||||
= \c,n -> CNNumNP (mkCN c) n ;
|
||||
symb : CN -> Card -> NP
|
||||
= \c,n -> CNNumNP c n ;
|
||||
symb : Det -> N -> Card -> NP
|
||||
= \d,n,x -> mkNP d (mkCN (mkCN n) (mkNP (NumPN x))) ;
|
||||
symb : Det -> CN -> Card -> NP
|
||||
= \d,n,x -> mkNP d (mkCN n (mkNP (NumPN x))) ;
|
||||
symb : Det -> N -> Str -> Str -> NP
|
||||
= \c,n,x,y -> CNSymbNP c (mkCN n) (BaseSymb (mkSymb x) (mkSymb y)) ;
|
||||
symb : Det -> CN -> [Symb] -> NP
|
||||
= CNSymbNP ;
|
||||
symb : Symb -> S = SymbS ;
|
||||
symb : Symb -> Card = SymbNum ;
|
||||
symb : Symb -> Ord = SymbOrd
|
||||
|
||||
} ;
|
||||
|
||||
mkSymb : Str -> Symb = \s -> {s = s ; lock_Symb = <>} ;
|
||||
|
||||
mkInt i = {s = i ; lock_Int = <>} ;
|
||||
mkFloat f = {s = f ; lock_Float = <>} ;
|
||||
|
||||
|
||||
}
|
||||
5
next-lib/src/api/SymbolicEng.gf
Normal file
5
next-lib/src/api/SymbolicEng.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:present:prelude
|
||||
|
||||
resource SymbolicEng = Symbolic with
|
||||
(Symbol = SymbolEng),
|
||||
(Syntax = SyntaxEng) ;
|
||||
4
next-lib/src/api/Syntax.gf
Normal file
4
next-lib/src/api/Syntax.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
interface Syntax = Constructors, Cat, Structural, Combinators ;
|
||||
|
||||
4
next-lib/src/api/SyntaxBul.gf
Normal file
4
next-lib/src/api/SyntaxBul.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxBul of Syntax = ConstructorsBul, CatBul, StructuralBul, CombinatorsBul ;
|
||||
|
||||
4
next-lib/src/api/SyntaxCat.gf
Normal file
4
next-lib/src/api/SyntaxCat.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxCat of Syntax = ConstructorsCat, CatCat, StructuralCat, CombinatorsCat ;
|
||||
|
||||
4
next-lib/src/api/SyntaxDan.gf
Normal file
4
next-lib/src/api/SyntaxDan.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxDan of Syntax = ConstructorsDan, CatDan, StructuralDan, CombinatorsDan ;
|
||||
|
||||
5
next-lib/src/api/SyntaxEng.gf
Normal file
5
next-lib/src/api/SyntaxEng.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxEng of Syntax =
|
||||
ConstructorsEng, CatEng, StructuralEng, CombinatorsEng ;
|
||||
|
||||
4
next-lib/src/api/SyntaxFin.gf
Normal file
4
next-lib/src/api/SyntaxFin.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxFin of Syntax = ConstructorsFin, CatFin, StructuralFin, CombinatorsFin ;
|
||||
|
||||
4
next-lib/src/api/SyntaxFre.gf
Normal file
4
next-lib/src/api/SyntaxFre.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxFre of Syntax = ConstructorsFre, CatFre, StructuralFre, CombinatorsFre ;
|
||||
|
||||
4
next-lib/src/api/SyntaxGer.gf
Normal file
4
next-lib/src/api/SyntaxGer.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxGer of Syntax = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ;
|
||||
|
||||
4
next-lib/src/api/SyntaxIta.gf
Normal file
4
next-lib/src/api/SyntaxIta.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxIta of Syntax = ConstructorsIta, CatIta, StructuralIta, CombinatorsIta ;
|
||||
|
||||
5
next-lib/src/api/SyntaxNor.gf
Normal file
5
next-lib/src/api/SyntaxNor.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxNor of Syntax = ConstructorsNor, CatNor, StructuralNor, CombinatorsNor
|
||||
;
|
||||
|
||||
4
next-lib/src/api/SyntaxRus.gf
Normal file
4
next-lib/src/api/SyntaxRus.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxRus of Syntax = ConstructorsRus, CatRus, StructuralRus, CombinatorsRus ;
|
||||
|
||||
5
next-lib/src/api/SyntaxSpa.gf
Normal file
5
next-lib/src/api/SyntaxSpa.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxSpa of Syntax =
|
||||
ConstructorsSpa, CatSpa, StructuralSpa, CombinatorsSpa ;
|
||||
|
||||
5
next-lib/src/api/SyntaxSwe.gf
Normal file
5
next-lib/src/api/SyntaxSwe.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
instance SyntaxSwe of Syntax =
|
||||
ConstructorsSwe, CatSwe, StructuralSwe, CombinatorsSwe ;
|
||||
|
||||
13
next-lib/src/api/TryBul.gf
Normal file
13
next-lib/src/api/TryBul.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryBul = SyntaxBul, LexiconBul, ParadigmsBul - [mkAdv] **
|
||||
open (P = ParadigmsBul), in {
|
||||
|
||||
oper
|
||||
|
||||
mkAdv = overload SyntaxBul {
|
||||
mkAdv : Str -> Adv = P.mkAdv ;
|
||||
} ;
|
||||
|
||||
|
||||
}
|
||||
13
next-lib/src/api/TryCat.gf
Normal file
13
next-lib/src/api/TryCat.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryCat = SyntaxCat, LexiconCat, ParadigmsCat - [mkAdv] **
|
||||
open (P = ParadigmsCat), in {
|
||||
|
||||
oper
|
||||
|
||||
mkAdv = overload SyntaxCat {
|
||||
mkAdv : Str -> Adv = P.mkAdv ;
|
||||
} ;
|
||||
|
||||
|
||||
}
|
||||
3
next-lib/src/api/TryDan.gf
Normal file
3
next-lib/src/api/TryDan.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryDan = SyntaxDan, LexiconDan, ParadigmsDan - [mkAdv] ;
|
||||
13
next-lib/src/api/TryEng.gf
Normal file
13
next-lib/src/api/TryEng.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryEng = SyntaxEng, LexiconEng, ParadigmsEng - [mkAdv] **
|
||||
open (P = ParadigmsEng), in {
|
||||
|
||||
oper
|
||||
|
||||
mkAdv = overload SyntaxEng {
|
||||
mkAdv : Str -> Adv = P.mkAdv ;
|
||||
} ;
|
||||
|
||||
|
||||
}
|
||||
3
next-lib/src/api/TryFin.gf
Normal file
3
next-lib/src/api/TryFin.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryFin = SyntaxFin, LexiconFin-[mkOrd], ParadigmsFin - [mkAdv] ;
|
||||
3
next-lib/src/api/TryFre.gf
Normal file
3
next-lib/src/api/TryFre.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryFre = SyntaxFre, LexiconFre, ParadigmsFre - [mkAdv] ;
|
||||
3
next-lib/src/api/TryGer.gf
Normal file
3
next-lib/src/api/TryGer.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryGer = SyntaxGer, LexiconGer, ParadigmsGer - [mkAdv] ;
|
||||
3
next-lib/src/api/TryIta.gf
Normal file
3
next-lib/src/api/TryIta.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryIta = SyntaxIta, LexiconIta, ParadigmsIta - [mkAdv,in_Prep] ;
|
||||
3
next-lib/src/api/TryNor.gf
Normal file
3
next-lib/src/api/TryNor.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryNor = SyntaxNor, LexiconNor, ParadigmsNor - [mkAdv] ;
|
||||
3
next-lib/src/api/TryRus.gf
Normal file
3
next-lib/src/api/TryRus.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TryRus = SyntaxRus, LexiconRus, ParadigmsRus - [mkAdv] ;
|
||||
3
next-lib/src/api/TrySpa.gf
Normal file
3
next-lib/src/api/TrySpa.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TrySpa = SyntaxSpa, LexiconSpa, ParadigmsSpa - [mkAdv] ;
|
||||
12
next-lib/src/api/TrySwe.gf
Normal file
12
next-lib/src/api/TrySwe.gf
Normal file
@@ -0,0 +1,12 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource TrySwe = SyntaxSwe, LexiconSwe, ParadigmsSwe - [mkAdv] **
|
||||
open (P = ParadigmsSwe), in {
|
||||
|
||||
oper
|
||||
|
||||
mkAdv = overload SyntaxSwe {
|
||||
mkAdv : Str -> Adv = P.mkAdv ;
|
||||
} ;
|
||||
|
||||
}
|
||||
2
next-lib/src/catalan/AdjectiveCat.gf
Normal file
2
next-lib/src/catalan/AdjectiveCat.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete AdjectiveCat of Adjective = CatCat ** AdjectiveRomance with
|
||||
(ResRomance = ResCat) ;
|
||||
2
next-lib/src/catalan/AdverbCat.gf
Normal file
2
next-lib/src/catalan/AdverbCat.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete AdverbCat of Adverb = CatCat ** AdverbRomance with
|
||||
(ResRomance = ResCat) ;
|
||||
7
next-lib/src/catalan/AllCat.gf
Normal file
7
next-lib/src/catalan/AllCat.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
--# -path=.:../romance:../abstract:../common:prelude
|
||||
|
||||
concrete AllCat of AllCatAbs =
|
||||
LangCat,
|
||||
IrregCat,
|
||||
ExtraCat
|
||||
** {} ;
|
||||
5
next-lib/src/catalan/AllCatAbs.gf
Normal file
5
next-lib/src/catalan/AllCatAbs.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
abstract AllCatAbs =
|
||||
Lang,
|
||||
IrregCatAbs,
|
||||
ExtraCatAbs
|
||||
** {} ;
|
||||
6066
next-lib/src/catalan/BeschCat.gf
Normal file
6066
next-lib/src/catalan/BeschCat.gf
Normal file
File diff suppressed because it is too large
Load Diff
6
next-lib/src/catalan/CatCat.gf
Normal file
6
next-lib/src/catalan/CatCat.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:../romance:../abstract:../common:prelude
|
||||
|
||||
concrete CatCat of Cat =
|
||||
CommonX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond] **
|
||||
CatRomance with -- JS restore TPast for notpresent
|
||||
(ResRomance = ResCat) ;
|
||||
2
next-lib/src/catalan/ConjunctionCat.gf
Normal file
2
next-lib/src/catalan/ConjunctionCat.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete ConjunctionCat of Conjunction = CatCat ** ConjunctionRomance with
|
||||
(ResRomance = ResCat) ;
|
||||
179
next-lib/src/catalan/DiffCat.gf
Normal file
179
next-lib/src/catalan/DiffCat.gf
Normal file
@@ -0,0 +1,179 @@
|
||||
--# -path=.:../romance:../abstract:../common:prelude
|
||||
|
||||
instance DiffCat of DiffRomance = open CommonRomance, PhonoCat, BeschCat, Prelude in {
|
||||
|
||||
flags optimize=noexpand ;
|
||||
|
||||
param
|
||||
Prepos = P_de | P_a ;
|
||||
VType = VHabere | VRefl ;
|
||||
|
||||
oper
|
||||
dative : Case = CPrep P_a ;
|
||||
genitive : Case = CPrep P_de ;
|
||||
|
||||
prepCase = \c -> case c of {
|
||||
Nom => [] ;
|
||||
Acc => [] ;
|
||||
CPrep P_de => "de" ;
|
||||
CPrep P_a => "a"
|
||||
} ;
|
||||
|
||||
|
||||
artDef : Gender -> Number -> Case -> Str = \g,n,c ->
|
||||
case <g,n,c> of {
|
||||
<Masc,Sg, CPrep P_de> => pre {"del" ; ["de l'"] / vocalForta} ;
|
||||
<Masc,Sg, CPrep P_a> => pre {"al" ; ["a l'"] / vocalForta} ;
|
||||
<Masc,Sg, _> => elisEl ;
|
||||
<Fem, Sg, _> => prepCase c ++ elisLa ;
|
||||
<_, Pl, CPrep P_de> => "dels" ;
|
||||
<_, Pl, CPrep P_a> => "als" ;
|
||||
<Masc, Pl, _ > => "els" ;
|
||||
<Fem, Pl, _ > => "les"
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
artIndef = \g,n,c -> case <n,c> of {
|
||||
<Sg,CPrep P_de> => genForms ["d' un"] ["d' una"] ! g ;
|
||||
<Pl,CPrep P_de> => genForms ["d' uns"] ["d' unes"] ! g ;
|
||||
<Sg,_> => prepCase c ++ genForms "un" "una" ! g ;
|
||||
<Pl,_> => prepCase c ++ genForms "uns" "unes" ! g
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
possCase = \_,_,c -> prepCase c ;
|
||||
|
||||
partitive = \g,c -> case c of {
|
||||
CPrep P_de => "de" ;
|
||||
_ => prepCase c ++ artDef g Sg (CPrep P_de)
|
||||
} ;
|
||||
|
||||
conjunctCase : NPForm -> NPForm = \c -> case c of {
|
||||
Ton Nom | Aton Nom => Ton Nom ;
|
||||
_ => Ton Acc
|
||||
} ;
|
||||
|
||||
auxVerb : VType -> (VF => Str) = \_ -> haver_V.s ;
|
||||
|
||||
partAgr : VType -> VPAgr = \vtyp -> vpAgrNone ;
|
||||
|
||||
vpAgrClit : Agr -> VPAgr = \a ->
|
||||
vpAgrNone ;
|
||||
|
||||
pronArg = \n,p,acc,dat ->
|
||||
let
|
||||
paccp = case acc of {
|
||||
CRefl => <reflPron n p Acc, p,True> ;
|
||||
CPron ag an ap => <argPron ag an ap Acc, ap,True> ;
|
||||
_ => <[],P2,False>
|
||||
} ;
|
||||
pdatp = case dat of {
|
||||
CPron ag an ap => <argPron ag an ap dative, ap,True> ;
|
||||
_ => <[],P2,False>
|
||||
}
|
||||
in case <paccp.p2, pdatp.p2> of {
|
||||
---- AR 8/6/2008 efficiency problem in pgf generation:
|
||||
---- replace the case expr with
|
||||
---- a constant produces an error in V3 predication with two pronouns
|
||||
---- <P3,P3> => <"se" ++ paccp.p1, [],True> ;
|
||||
_ => <pdatp.p1 ++ paccp.p1, [],orB paccp.p3 pdatp.p3>
|
||||
} ;
|
||||
|
||||
--case <p,acc,dat> of {
|
||||
-- <Sg,P2,CRefl,CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;
|
||||
-- <_,_,CPron {n = Sg ; p = P2},CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;
|
||||
|
||||
infForm _ _ _ _ = True ;
|
||||
|
||||
mkImperative _ p vp = { --- politeness
|
||||
s = \\pol,aag =>
|
||||
let
|
||||
agr = aag ** {p = p} ;
|
||||
verb = case <aag.n, pol> of {
|
||||
<Sg,Neg> => (vp.s ! VPFinite (VPres Conjunct) Simul).fin ! agr ;
|
||||
_ => (vp.s ! VPImperat).fin ! agr
|
||||
} ;
|
||||
neg = vp.neg ! pol ;
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
compl = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
in
|
||||
neg.p1 ++ verb ++ bindIf clpr.p3 ++ clpr.p1 ++ compl ;
|
||||
} ;
|
||||
|
||||
negation : Polarity => (Str * Str) = table {
|
||||
Pos => <[],[]> ;
|
||||
Neg => <"no",[]>
|
||||
} ;
|
||||
|
||||
conjThan = "que" ;
|
||||
conjThat = "que" ;
|
||||
subjIf = "si" ;
|
||||
|
||||
|
||||
|
||||
clitInf b cli inf = inf ++ bindIf b ++ cli ; --- JS copied from DiffSpa
|
||||
|
||||
relPron : Bool => AAgr => Case => Str = \\b,a,c =>
|
||||
case c of {
|
||||
Nom | Acc => "que" ;
|
||||
CPrep P_a => "cuyo" ;
|
||||
_ => prepCase c ++ "cuyo"
|
||||
} ;
|
||||
|
||||
pronSuch : AAgr => Str = aagrForms "tal" "tal" "tals" "tals" ;
|
||||
|
||||
quelPron : AAgr => Str = aagrForms "qual" "qual" "quals" "quals" ;
|
||||
|
||||
partQIndir = [] ; ---- ?
|
||||
|
||||
reflPron : Number -> Person -> Case -> Str = \n,p,c ->
|
||||
let pro = argPron Fem n p c
|
||||
in
|
||||
case p of {
|
||||
P3 => case c of {
|
||||
Acc | CPrep P_a => "se" ;
|
||||
_ => "sÌ"
|
||||
} ;
|
||||
_ => pro
|
||||
} ;
|
||||
|
||||
argPron : Gender -> Number -> Person -> Case -> Str =
|
||||
let
|
||||
cases : (x,y : Str) -> Case -> Str = \me,moi,c -> case c of {
|
||||
Acc | CPrep P_a => me ;
|
||||
_ => moi
|
||||
} ;
|
||||
cases3 : (x,y,z : Str) -> Case -> Str = \les,leur,eux,c -> case c of {
|
||||
Acc => les ;
|
||||
CPrep P_a => leur ;
|
||||
_ => eux
|
||||
} ;
|
||||
in
|
||||
\g,n,p -> case <g,n,p> of {
|
||||
<_,Sg,P1> => cases "em" "mí" ;
|
||||
<_,Sg,P2> => cases "et" "tú" ;
|
||||
<_,Pl,P1> => cases "ens" "nosaltres" ; --- nosotros
|
||||
<_,Pl,P2> => cases "us" "vosaltres" ; --- vosotros
|
||||
<Fem,Sg,P3> => cases3 "la" "li" "ella" ;
|
||||
<Masc, Sg,P3> => cases3 "el" "li" "ell" ;
|
||||
<Fem,Pl,P3> => cases3 "les" "les" "elles" ;
|
||||
<Masc, Pl,P3> => cases3 "els" "els" "ells"
|
||||
} ;
|
||||
|
||||
vRefl : VType = VRefl ;
|
||||
isVRefl : VType -> Bool = \ty -> case ty of {
|
||||
VRefl => True ;
|
||||
_ => False
|
||||
} ;
|
||||
|
||||
auxPassive : Verb = copula ;
|
||||
|
||||
copula = verbBeschH (ser_52 "ser") ;
|
||||
|
||||
haver_V : Verb = verbBeschH (haver_59 "haver") ;
|
||||
|
||||
verbBeschH : Verbum -> Verb = \v -> verbBesch v ** {vtyp = VHabere} ;
|
||||
|
||||
}
|
||||
47
next-lib/src/catalan/ExtraCat.gf
Normal file
47
next-lib/src/catalan/ExtraCat.gf
Normal file
@@ -0,0 +1,47 @@
|
||||
concrete ExtraCat of ExtraCatAbs = ExtraRomanceCat **
|
||||
open CommonRomance, PhonoCat, MorphoCat, ParadigmsCat, ParamX, ResCat in {
|
||||
|
||||
-- lin
|
||||
-- i8fem_Pron = mkPronoun
|
||||
-- "yo" "me" "me" "mí"
|
||||
-- "mi" "mi" "mis" "mis"
|
||||
-- Fem Sg P1 ;
|
||||
-- these8fem_NP = mkNP ["estas"] Fem Pl ;
|
||||
-- they8fem_Pron = mkPronoun
|
||||
-- "ellas" "las" "les" "ellas"
|
||||
-- "su" "su" "sus" "sus"
|
||||
-- Fem Pl P3 ;
|
||||
-- this8fem_NP = pn2np (mkPN ["esta"] Fem) ;
|
||||
-- those8fem_NP = mkNP ["esas"] Fem Pl ;
|
||||
|
||||
-- we8fem_Pron = mkPronoun
|
||||
-- "nosotras" "nos" "nos" "nosotras"
|
||||
-- "nuestro" "nuestra" "nuestros" "nuestras"
|
||||
-- Fem Pl P1 ;
|
||||
-- whoPl8fem_IP = {s = \\c => prepCase c ++ "quién" ; a = aagr Fem Pl} ;
|
||||
-- whoSg8fem_IP = {s = \\c => prepCase c ++ "quién" ; a = aagr Fem Sg} ;
|
||||
|
||||
-- youSg8fem_Pron = mkPronoun
|
||||
-- "tu" "te" "te" "tí"
|
||||
-- "tu" "tu" "tus" "tus"
|
||||
-- Fem Sg P2 ;
|
||||
-- youPl8fem_Pron = mkPronoun
|
||||
-- "vosotras" "vos" "vos" "vosotras"
|
||||
-- "vuestro" "vuestra" "vuestros" "vuestras"
|
||||
-- Fem Pl P2 ;
|
||||
-- youPol8fem_Pron = mkPronoun
|
||||
-- "usted" "la" "le" "usted"
|
||||
-- "su" "su" "sus" "sus"
|
||||
-- Fem Sg P3 ;
|
||||
|
||||
-- youPolPl_Pron = mkPronoun
|
||||
-- "ustedes" "las" "les" "usted"
|
||||
-- "su" "su" "sus" "sus"
|
||||
-- Masc Pl P3 ;
|
||||
-- youPolPl8fem_Pron = mkPronoun
|
||||
-- "ustedes" "las" "les" "usted"
|
||||
-- "su" "su" "sus" "sus"
|
||||
-- Fem Pl P3 ;
|
||||
|
||||
|
||||
}
|
||||
28
next-lib/src/catalan/ExtraCatAbs.gf
Normal file
28
next-lib/src/catalan/ExtraCatAbs.gf
Normal file
@@ -0,0 +1,28 @@
|
||||
-- Structures special for Catalan. These are not implemented in other
|
||||
-- Romance languages.
|
||||
|
||||
abstract ExtraCatAbs = ExtraRomanceAbs ** {
|
||||
|
||||
-- fun
|
||||
|
||||
-- Feminine variants of pronouns (those in $Structural$ are
|
||||
-- masculine, which is the default when gender is unknown).
|
||||
|
||||
-- i8fem_Pron : Pron ;
|
||||
-- these8fem_NP : NP ;
|
||||
-- they8fem_Pron : Pron ;
|
||||
-- this8fem_NP : NP ;
|
||||
-- those8fem_NP : NP ;
|
||||
|
||||
-- we8fem_Pron : Pron ; -- nosotras
|
||||
-- whoPl8fem_IP : IP ;
|
||||
-- whoSg8fem_IP : IP ;
|
||||
|
||||
-- youSg8fem_Pron : Pron ;
|
||||
-- youPl8fem_Pron : Pron ; -- vosotras
|
||||
-- youPol8fem_Pron : Pron ; -- usted
|
||||
|
||||
-- youPolPl_Pron : Pron ; -- ustedes
|
||||
-- youPolPl8fem_Pron : Pron ;
|
||||
|
||||
}
|
||||
2
next-lib/src/catalan/ExtraRomanceCat.gf
Normal file
2
next-lib/src/catalan/ExtraRomanceCat.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete ExtraRomanceCat of ExtraRomanceAbs = CatCat ** ExtraRomance with
|
||||
(ResRomance = ResCat) ;
|
||||
22
next-lib/src/catalan/GrammarCat.gf
Normal file
22
next-lib/src/catalan/GrammarCat.gf
Normal file
@@ -0,0 +1,22 @@
|
||||
--# -path=.:../romance:../abstract:../common:prelude
|
||||
|
||||
concrete GrammarCat of Grammar =
|
||||
NounCat,
|
||||
VerbCat,
|
||||
AdjectiveCat,
|
||||
AdverbCat,
|
||||
NumeralCat,
|
||||
SentenceCat,
|
||||
QuestionCat,
|
||||
RelativeCat,
|
||||
ConjunctionCat,
|
||||
PhraseCat,
|
||||
TextX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond],
|
||||
IdiomCat,
|
||||
StructuralCat
|
||||
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
24
next-lib/src/catalan/IdiomCat.gf
Normal file
24
next-lib/src/catalan/IdiomCat.gf
Normal file
@@ -0,0 +1,24 @@
|
||||
concrete IdiomCat of Idiom = CatCat **
|
||||
open MorphoCat, ParadigmsCat, BeschCat, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
ExistNP np = mkClause [] True (agrP3 Masc Sg)
|
||||
(insertClit2 "hi" (insertComplement (\\_ => np.s ! Ton Acc) (predV haver_V))) ;
|
||||
GenericCl vp = mkClause "hom" True (agrP3 Masc Sg) vp ;
|
||||
ImpersCl vp = mkClause [] True (agrP3 Masc Sg) vp ;
|
||||
|
||||
|
||||
ProgrVP vpr = let vp = useVP vpr in
|
||||
insertComplement
|
||||
(\\agr =>
|
||||
let
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
obj = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! Pos ---- pol
|
||||
in
|
||||
(vp.s ! VPGerund).inf ! (aagr agr.g agr.n) ++ clpr.p1 ++ obj
|
||||
)
|
||||
(predV (verbV (estar_54 "estar"))) ;
|
||||
|
||||
}
|
||||
1121
next-lib/src/catalan/IrregCat.gf
Normal file
1121
next-lib/src/catalan/IrregCat.gf
Normal file
File diff suppressed because it is too large
Load Diff
1106
next-lib/src/catalan/IrregCatAbs.gf
Normal file
1106
next-lib/src/catalan/IrregCatAbs.gf
Normal file
File diff suppressed because it is too large
Load Diff
10
next-lib/src/catalan/LangCat.gf
Normal file
10
next-lib/src/catalan/LangCat.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
--# -path=.:../romance:../abstract:../common:prelude
|
||||
|
||||
concrete LangCat of Lang =
|
||||
GrammarCat,
|
||||
LexiconCat
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
365
next-lib/src/catalan/LexiconCat.gf
Normal file
365
next-lib/src/catalan/LexiconCat.gf
Normal file
@@ -0,0 +1,365 @@
|
||||
--# -path=.:../romance:../common:../abstract:../../prelude
|
||||
|
||||
concrete LexiconCat of Lexicon = CatCat ** open
|
||||
(M=MorphoCat), ParadigmsCat, BeschCat in {
|
||||
|
||||
flags
|
||||
optimize=values ;
|
||||
|
||||
oper
|
||||
regFN : Str -> N = \s -> femN (regN s) ;
|
||||
regMN : Str -> N = \s -> regN s ;
|
||||
irregMN : Str -> Str -> N = \pa,pans -> M.mkNounIrreg pa pans masculine ;
|
||||
|
||||
lin
|
||||
airplane_N = regMN "avió" ;
|
||||
|
||||
answer_V2S = mkV2S (regV "respondre") dative ;
|
||||
apartment_N = regMN "pis" ;
|
||||
apple_N = regFN "poma" ;
|
||||
art_N = regMN "art" ;
|
||||
ask_V2Q = mkV2Q (regV "preguntar") dative ;
|
||||
baby_N = regMN "nadó" ;
|
||||
bad_A = mkADeg (regA "dolent") (regA "pitjor") ;
|
||||
bank_N = regMN "banc" ;
|
||||
beautiful_A = prefA (regADeg "bell") ;
|
||||
become_VA = reflV (regV "tornar") ; -- esdevenir
|
||||
beer_N = regFN "cervesa" ;
|
||||
beg_V2V = mkV2V (regV "demanar") accusative dative ;
|
||||
big_A = regADeg "gros" ;
|
||||
bike_N = regFN "bicicleta" ;
|
||||
bird_N = regMN "ocell" ;
|
||||
black_A = compADeg (mkA "negre" "negra" "negres" "negres" "negrament") ;
|
||||
blue_A = compADeg (mkA "blau" "blava" "blaus" "blaves" "blavament") ;
|
||||
boat_N = regFN "barca" ;
|
||||
book_N = regMN "llibre" ;
|
||||
boot_N = regFN "bota" ;
|
||||
boss_N = regMN "cap" ;
|
||||
boy_N = regMN "noi" ;
|
||||
bread_N = irregMN "pa" "pans" ;
|
||||
break_V2 = dirV2 (regV "trencar") ;
|
||||
broad_A = regADeg "ample" ; -- put it in MorphoCat?: like black_A
|
||||
brother_N2 = deN2 (regMN "germà") ;
|
||||
brown_A = compADeg (mkA "marró" "marrona" "marrons" "marrones" "marronament") ;
|
||||
butter_N = regFN "mantega" ;
|
||||
buy_V2 = dirV2 (regV "comprar") ;
|
||||
camera_N = regFN "càmara" ;
|
||||
cap_N = regFN "gorra" ;
|
||||
car_N = regMN "cotxe" ;
|
||||
carpet_N = regFN "catifa" ;
|
||||
cat_N = regMN "gat" ; -- gata
|
||||
ceiling_N = regMN "sostre" ;
|
||||
chair_N = regFN "cadira" ;
|
||||
cheese_N = regMN "formatge" ;
|
||||
child_N = regMN "nen" ; -- nena
|
||||
church_N = regFN "església" ;
|
||||
city_N = regFN "ciutat" ;
|
||||
clean_A = regADeg "net" ;
|
||||
clever_A = regADeg "inteligent" ;
|
||||
close_V2 = dirV2 (regV "tancar") ;
|
||||
coat_N = regMN "abric" ;
|
||||
cold_A = regADeg "fred" ;
|
||||
come_V = verbV (venir_117 "venir") ;
|
||||
computer_N = regMN "ordinador" ;
|
||||
country_N = regMN "país" ; -- masc
|
||||
cousin_N = regMN "cosí" ;
|
||||
cow_N = regFN "vaca" ;
|
||||
die_V = verbV (morir_71 "morir") ;
|
||||
dirty_A = regADeg "brut" ;
|
||||
distance_N3 = mkN3 (regFN "distància") genitive dative ;
|
||||
doctor_N = regMN "metge" ; -- metgessa
|
||||
dog_N = regMN "gos" ; -- gossa
|
||||
door_N = regFN "porta" ;
|
||||
drink_V2 = dirV2 (regV "beure") ;
|
||||
easy_A2V = mkA2V (regA "fácil") dative genitive ;
|
||||
eat_V2 = dirV2 (regV "menjar") ;
|
||||
empty_A = compADeg (mkA "buit" "buida" "buits" "buides" "buidament") ;
|
||||
enemy_N = regMN "enemic" ; -- enemiga
|
||||
factory_N = regFN "fàbrica" ;
|
||||
father_N2 = deN2 (regMN "pare") ;
|
||||
fear_VS = mkVS (regV "tèmer") ;
|
||||
find_V2 = dirV2 (regV "trobar") ;
|
||||
fish_N = regMN "peix" ;
|
||||
floor_N = regMN "terra" ; -- sòl
|
||||
forget_V2 = dirV2 (regV "oblidar") ;
|
||||
fridge_N = regFN "nevera" ;
|
||||
friend_N = regMN "amic" ; -- amiga
|
||||
fruit_N = regFN "fruita" ;
|
||||
fun_AV = mkAV (regA "divertit") genitive ;
|
||||
garden_N = regMN "jardí" ;
|
||||
girl_N = regFN "noia" ;
|
||||
glove_N = regMN "guant" ;
|
||||
gold_N = regMN "or" ;
|
||||
good_A = mkADeg (mkA "bó" "bona" "bons" "bones" "bonament") (regA "millor") ; ---- adv?
|
||||
go_V = (verbV (anar_4 "anar")) ;
|
||||
green_A = regADeg "verd" ;
|
||||
harbour_N = regMN "port" ;
|
||||
hate_V2 = dirV2 (regV "odiar") ;
|
||||
hat_N = regMN "barret" ;
|
||||
have_V2 = dirV2 (verbV (tenir_108 "tenir")) ;
|
||||
hear_V2 = mkV2 (regV "escoltar") dative ;
|
||||
hill_N = regMN "turó" ;
|
||||
hope_VS = mkVS (regV "esperar") ;
|
||||
horse_N = regMN "cavall" ;
|
||||
hot_A = regADeg "calent" ;
|
||||
house_N = regFN "casa" ;
|
||||
important_A = regADeg "important" ;
|
||||
industry_N = regFN "indústria" ;
|
||||
iron_N = regMN "ferro" ;
|
||||
king_N = regMN "rei" ;
|
||||
know_V2 = dirV2 (regV "saber") ;
|
||||
lake_N = regMN "llac" ;
|
||||
lamp_N = regFN "làmpada" ;
|
||||
learn_V2 = dirV2 (regV "aprendre") ;
|
||||
leather_N = regMN "cuiro" ;
|
||||
leave_V2 = dirV2 (regV "partir") ;
|
||||
like_V2 = dirV2 (regV "agradar") ;
|
||||
listen_V2 = dirV2 (regV "escoltar") ;
|
||||
live_V = verbV (viure_119 "viure") ;
|
||||
long_A = regADeg "llarg" ;
|
||||
lose_V2 = dirV2 (regV "perdre") ;
|
||||
love_N = regMN "amor" ;
|
||||
love_V2 = dirV2 (regV "estimar") ;
|
||||
man_N = regMN "home" ; -- masc
|
||||
married_A2 = mkA2 (regA "casat") dative ;
|
||||
meat_N = regFN "carn" ;
|
||||
milk_N = regFN "llet" ;
|
||||
moon_N = regFN "lluna" ;
|
||||
mother_N2 = deN2 (regFN "mare") ; -- fem
|
||||
mountain_N = regFN "muntanya" ;
|
||||
music_N = regFN "música" ;
|
||||
narrow_A = regADeg "estret" ;
|
||||
new_A = compADeg (mkA "nou" "nova" "nous" "noves" "novament") ;
|
||||
newspaper_N = regMN "diari" ; -- periòdic
|
||||
oil_N = regMN "oli" ;
|
||||
old_A = regADeg "vell" ;
|
||||
open_V2 = dirV2 (regV "obrir") ;
|
||||
paint_V2A = mkV2A (regV "pintar") accusative (mkPrep "en") ;
|
||||
paper_N = regMN "paper" ;
|
||||
paris_PN = mkPN "Paris" masculine ;
|
||||
peace_N = regFN "pau" ;
|
||||
pen_N = regMN "llapis" ;
|
||||
planet_N = regMN "planeta" ;
|
||||
plastic_N = regMN "plàstic" ;
|
||||
play_V2 = dirV2 (regV "jugar") ;
|
||||
policeman_N = regMN "policia" ; -- fem refers to the institution
|
||||
priest_N = regMN "capellà" ; -- masc
|
||||
probable_AS = mkAS (regA "probable") ;
|
||||
queen_N = regN "reina" ;
|
||||
radio_N = regFN "ràdio" ;
|
||||
rain_V0 = mkV0 (verbV (moure_72 "ploure")) ;
|
||||
read_V2 = dirV2 (verbV (servir_101 "llegir")) ;
|
||||
red_A = regADeg "vermell" ;
|
||||
religion_N = mkN "religió" "religions" feminine ;
|
||||
restaurant_N = regMN "restaurant" ;
|
||||
river_N = regMN "riu" ;
|
||||
rock_N = regFN "roca" ;
|
||||
roof_N = regFN "teulada" ;
|
||||
rubber_N = regFN "goma" ;
|
||||
run_V = verbV (córrer_30 "córrer") ;
|
||||
say_VS = mkVS (verbV (dir_41 "dir")) ;
|
||||
school_N = regFN "escola" ;
|
||||
science_N = regFN "ciència" ;
|
||||
sea_N = regMN "mar" ; -- masc & fem
|
||||
seek_V2 = dirV2 (verbV (trencar_112 "buscar")) ;
|
||||
see_V2 = dirV2 (verbV (veure_118 "veure")) ;
|
||||
sell_V3 = dirV3 (verbV (vendre_116 "vendre")) dative ;
|
||||
send_V3 = dirV3 (regV "enviar") dative ;
|
||||
sheep_N = regFN "ovella" ; -- xai
|
||||
ship_N = regMN "vaixell" ;
|
||||
shirt_N = regFN "camisa" ;
|
||||
shoe_N = regFN "sabata" ;
|
||||
shop_N = regFN "botiga" ;
|
||||
short_A = regADeg "curt" ; --- breu
|
||||
silver_N = regFN "plata" ;
|
||||
sister_N = regFN "germana" ;
|
||||
sleep_V = verbV (dormir_44 "dormir") ;
|
||||
small_A = prefA (regADeg "petit") ;
|
||||
snake_N = regFN "serp" ; -- fem
|
||||
sock_N = regMN "mitjó" ;
|
||||
speak_V2 = dirV2 (regV "parlar") ;
|
||||
star_N = regFN "estrella" ;
|
||||
steel_N = regMN "acer" ;
|
||||
stone_N = regFN "pedra" ;
|
||||
stove_N = regMN "forn" ;
|
||||
student_N = regN "estudiant" ; -- used both for fem & masc
|
||||
stupid_A = regADeg "estúpid" ;
|
||||
sun_N = regMN "sol" ;
|
||||
switch8off_V2 = dirV2 (verbV (pregar_86 "apagar")) ;
|
||||
switch8on_V2 = dirV2 (verbV (atendre_8 "encendre")) ;
|
||||
table_N = regFN "taula" ;
|
||||
talk_V3 = mkV3 (regV "parlar") dative genitive ;
|
||||
teacher_N = regMN "mestre" ; -- mestra
|
||||
teach_V2 = dirV2 (regV "ensenyar") ;
|
||||
television_N = mkN "televisió" "televisions" feminine ; -- televisor masc
|
||||
thick_A = compADeg (mkA "gruixut" "gruixuda" "gruixuts" "gruixudes" "gruixudament") ;
|
||||
thin_A = compADeg (mkA "fi" "fina" "fins" "fines" "finament") ;
|
||||
train_N = regMN "tren" ;
|
||||
travel_V = verbV (envejar_48 "viatjar") ;
|
||||
tree_N = regMN "arbre" ;
|
||||
--- trousers_N = regN "pantalón" ; -- masc
|
||||
ugly_A = compADeg (mkA "lleig" "lletja" "lletjos" "lletges" "lletjament") ;
|
||||
understand_V2 = dirV2 (verbV (atendre_8 "entendre")) ;
|
||||
university_N = regFN "universitat" ;
|
||||
village_N = regMN "poble" ;
|
||||
wait_V2 = mkV2 (regV "esperar") dative ;
|
||||
walk_V = regV "caminar" ;
|
||||
warm_A = regADeg "tebi" ;
|
||||
war_N = regFN "guerra" ;
|
||||
watch_V2 = dirV2 (regV "mirar") ;
|
||||
water_N = regFN "aigua" ;
|
||||
white_A = compADeg (mkA "blanc" "blanca" "blancs" "blanques" "blancament") ;
|
||||
window_N = regFN "finestra" ;
|
||||
wine_N = regMN "vi" ;
|
||||
win_V2 = dirV2 (regV "guanyar") ;
|
||||
woman_N = regFN "dona" ;
|
||||
wonder_VQ = mkVQ (reflV (regV "preguntar")) ;
|
||||
wood_N = regFN "fusta" ;
|
||||
write_V2 = dirV2 (verbV (escriure_50 "escriure")) ;
|
||||
yellow_A = compADeg (mkA "groc" "groga" "grocs" "grogues" "grogament") ;
|
||||
young_A = compADeg (mkA "jove" "jove" "joves" "joves" "jovement") ;
|
||||
do_V2 = dirV2 (verbV (fer_56 "fer")) ;
|
||||
now_Adv = mkAdv "ara" ;
|
||||
already_Adv = mkAdv "ja" ;
|
||||
song_N = mkN "cançó" "cançons" feminine ;
|
||||
add_V3 = dirV3 (regV "sumar") dative ;
|
||||
number_N = regMN "número" ;
|
||||
put_V2 = dirV2 (regV "posar") ;
|
||||
stop_V = regV "aturar" ;
|
||||
jump_V = regV "saltar" ;
|
||||
left_Ord = M.mkOrd (regA "esquerra") ;
|
||||
right_Ord = M.mkOrd (regA "dreta") ;
|
||||
far_Adv = mkAdv "lluny" ;
|
||||
correct_A = regA "correcte" ;
|
||||
dry_A = regA "sec" ;
|
||||
dull_A = regA "balb" ;
|
||||
full_A = regA "ple" ;
|
||||
heavy_A = regA "pesat" ;
|
||||
near_A = regA "proper" ;
|
||||
rotten_A = regA "podrit" ;
|
||||
round_A = regA "rodó" ;
|
||||
sharp_A = regA "esmolat" ; -- punxegut
|
||||
smooth_A = regA "llis" ;
|
||||
straight_A = regA "directe" ;
|
||||
wet_A = regA "moll" ;
|
||||
wide_A = regA "extens" ;
|
||||
animal_N = regMN "animal" ; -- masc (sometimes fem when adj)
|
||||
ashes_N = regMN "cendra" ;
|
||||
back_N = regFN "esquena" ;
|
||||
bark_N = regFN "escorça" ;
|
||||
belly_N = regFN "panxa" ;
|
||||
blood_N = regFN "sang" ;
|
||||
bone_N = regMN "os" ;
|
||||
breast_N = regFN "sina" ; -- pit
|
||||
cloud_N = regMN "núvol" ;
|
||||
day_N = regMN "dia" ;
|
||||
dust_N = regFN "pols" ;
|
||||
ear_N = regFN "orella" ;
|
||||
earth_N = regFN "terra" ;
|
||||
egg_N = regMN "ou" ;
|
||||
eye_N = regMN "ull" ;
|
||||
fat_N = regMN "greix" ;
|
||||
feather_N = regFN "pluma" ;
|
||||
fingernail_N = regFN "ungla" ;
|
||||
fire_N = regMN "foc" ;
|
||||
flower_N = regFN "flor" ;
|
||||
fog_N = regFN "boira" ;
|
||||
foot_N = regMN "peu" ;
|
||||
forest_N = regMN "bosc" ;
|
||||
grass_N = regFN "herba" ;
|
||||
guts_N = regMN "budell" ;
|
||||
hair_N = regMN "cabell" ;
|
||||
hand_N = regFN "mà" ;
|
||||
head_N = regMN "cap" ;
|
||||
heart_N = regMN "cor" ;
|
||||
horn_N = regFN "banya" ;
|
||||
husband_N = regMN "marit" ; -- espòs
|
||||
ice_N = regMN "gel" ;
|
||||
knee_N = regMN "genoll" ;
|
||||
leaf_N = regFN "fulla" ;
|
||||
leg_N = regFN "cama" ;
|
||||
liver_N = regMN "fetge" ;
|
||||
louse_N = regMN "poll" ;
|
||||
mouth_N = regFN "boca" ;
|
||||
name_N = regMN "nom" ;
|
||||
neck_N = regMN "coll" ;
|
||||
night_N = regFN "nit" ;
|
||||
nose_N = regMN "nas" ;
|
||||
person_N = regFN "persona" ;
|
||||
rain_N = regFN "pluja" ;
|
||||
road_N = regMN "carrer" ;
|
||||
root_N = regFN "arrel" ;
|
||||
rope_N = regN "corda" ;
|
||||
salt_N = regFN "sal" ;
|
||||
sand_N = regFN "sorra" ;
|
||||
seed_N = regFN "llavor" ;
|
||||
skin_N = regFN "pell" ; -- fem
|
||||
sky_N = regMN "cel" ;
|
||||
smoke_N = regMN "fum" ;
|
||||
snow_N = regFN "neu" ; -- fem
|
||||
stick_N = regMN "bastó" ;
|
||||
tail_N = regFN "cua" ;
|
||||
tongue_N = regFN "llengua" ;
|
||||
tooth_N = regFN "dent" ;
|
||||
wife_N = regFN "esposa" ;
|
||||
wind_N = regMN "vent" ;
|
||||
wing_N = regFN "ala" ;
|
||||
worm_N = regMN "cuc" ;
|
||||
year_N = regMN "any" ;
|
||||
bite_V2 = dirV2 (regV "mossegar") ;
|
||||
blow_V = regV "bufar" ;
|
||||
burn_V = regV "cremar" ;
|
||||
count_V2 = dirV2 (regV "comptar") ;
|
||||
cut_V2 = dirV2 (regV "tallar") ;
|
||||
dig_V = regV "cavar" ;
|
||||
fall_V = verbV (caure_18 "caure") ;
|
||||
fear_V2 = dirV2 (verbV (témer_107 "témer")) ;
|
||||
fight_V2 = dirV2 (regV "lluitar") ;
|
||||
float_V = regV "surar" ;
|
||||
flow_V = regV "circular" ;
|
||||
fly_V = regV "volar" ;
|
||||
freeze_V = regV "congelar" ;
|
||||
give_V3 = dirdirV3 (verbV (donar_43 "donar")) ;
|
||||
hit_V2 = dirV2 (regV "picar") ;
|
||||
hold_V2 = dirV2 (verbV (obtenir_78 "sostenir")) ;
|
||||
hunt_V2 = dirV2 (regV "caçar") ;
|
||||
kill_V2 = dirV2 (regV "matar") ;
|
||||
laugh_V = verbV (riure_96 "riure") ;
|
||||
lie_V = reflV (regV "jeure") ;
|
||||
play_V = verbV (pregar_86 "jugar") ;
|
||||
pull_V2 = dirV2 (regV "tibar") ;
|
||||
push_V2 = dirV2 (verbV (atènyer_59 "empènyer")) ;
|
||||
rub_V2 = dirV2 (verbV (pregar_86 "refregar")) ;
|
||||
scratch_V2 = dirV2 (regV "gratar") ;
|
||||
sew_V = regV "cosir" ;
|
||||
sing_V = regV "cantar" ;
|
||||
sit_V = reflV (regV "seure") ;
|
||||
smell_V = verbV (cantar_15 "ensumar") ;
|
||||
spit_V = verbV (escopir_49 "escopir") ;
|
||||
split_V2 = dirV2 (regV "separar") ; -- dividir,) ;
|
||||
squeeze_V2 = dirV2 (regV "exprèmer") ;
|
||||
stab_V2 = dirV2 (regV "apunyalar") ;
|
||||
stand_V = verbV (estar_54 "estar") ; ---- "estar dret"
|
||||
suck_V2 = dirV2 (regV "xuclar") ;
|
||||
swell_V = regV "inflar" ;
|
||||
swim_V = regV "nedar" ;
|
||||
think_V = regV "pensar" ;
|
||||
throw_V2 = dirV2 (verbV (començar_22 "llençar")) ;
|
||||
tie_V2 = dirV2 (verbV (pregar_86 "lligar")) ;
|
||||
turn_V = verbV (pregar_86 "doblegar") ;
|
||||
vomit_V = verbV (envejar_48 "vomitar") ;
|
||||
wash_V2 = dirV2 (regV "rentar") ;
|
||||
wipe_V2 = dirV2 (verbV (pregar_86 "eixugar")) ;
|
||||
breathe_V = regV "respirar" ;
|
||||
john_PN = mkPN "Joan" masculine ;
|
||||
today_Adv = mkAdv "avui" ;
|
||||
|
||||
grammar_N = regFN "gramàtica" ;
|
||||
language_N = regFN "llengua" ;
|
||||
rule_N = regFN "regla" ;
|
||||
question_N = regFN "pregunta" ;
|
||||
ready_A = regA "preparat" ;
|
||||
reason_N = regFN "raó" ;
|
||||
uncertain_A = regA "incert" ;
|
||||
|
||||
} ;
|
||||
130
next-lib/src/catalan/MorphoCat.gf
Normal file
130
next-lib/src/catalan/MorphoCat.gf
Normal file
@@ -0,0 +1,130 @@
|
||||
--# -path=.:../romance:../common:../../prelude
|
||||
|
||||
----1 A Simple Catalan Resource Morphology
|
||||
----
|
||||
---- Aarne Ranta 2002 -- 2005
|
||||
----
|
||||
---- This resource morphology contains definitions needed in the resource
|
||||
---- syntax. To build a lexicon, it is better to use $ParadigmsCat$, which
|
||||
---- gives a higher-level access to this module.
|
||||
--
|
||||
resource MorphoCat = CommonRomance, ResCat **
|
||||
open PhonoCat, Prelude, Predef in {
|
||||
--
|
||||
-- flags optimize=all ;
|
||||
--
|
||||
--
|
||||
----2 Nouns
|
||||
----
|
||||
---- The following macro is useful for creating the forms of number-dependent
|
||||
---- tables, such as common nouns.
|
||||
--
|
||||
oper
|
||||
numForms : (_,_ : Str) -> Number => Str = \vi, vins ->
|
||||
table {Sg => vi ; Pl => vins} ;
|
||||
|
||||
-- For example:
|
||||
|
||||
nomHome : Str -> Number => Str = \home ->
|
||||
numForms home (home + "s") ;
|
||||
|
||||
nomDona : Str -> Number => Str = \dona ->
|
||||
numForms dona (init dona + "es") ;
|
||||
|
||||
nomDisc : Str -> Number => Str = \disc ->
|
||||
numForms disc (variants {disc + "s"; disc + "os"}) ;
|
||||
|
||||
-- nomPilar : Str -> Number => Str = \pilar ->
|
||||
-- numForms pilar (pilar + "es") ;
|
||||
--
|
||||
-- nomTram : Str -> Number => Str = \tram ->
|
||||
-- numForms tram tram ;
|
||||
--
|
||||
-- Common nouns are inflected in number and have an inherent gender.
|
||||
|
||||
mkNoun : (Number => Str) -> Gender -> Noun = \noinois,gen ->
|
||||
{s = noinois ; g = gen} ;
|
||||
|
||||
mkNounIrreg : Str -> Str -> Gender -> Noun = \vi,vins ->
|
||||
mkNoun (numForms vi vins) ;
|
||||
|
||||
mkNomReg : Str -> Noun = \noi ->
|
||||
case last noi of {
|
||||
"o" | "e" => mkNoun (nomHome noi) Masc ;
|
||||
"a" => mkNoun (nomDona noi) Fem ;
|
||||
"c" => mkNoun (nomDisc noi) Masc ;
|
||||
--- "u" => mkNounIrreg mec (init mec + "ces") Fem ;
|
||||
_ => mkNoun (nomHome noi) Masc
|
||||
} ;
|
||||
|
||||
----2 Adjectives
|
||||
----
|
||||
-- Adjectives are conveniently seen as gender-dependent nouns.
|
||||
-- Here are some patterns. First one that describes the worst case.
|
||||
|
||||
mkAdj : (_,_,_,_,_ : Str) -> Adj = \petit,petita,petits,petites,petitament ->
|
||||
{s = table {
|
||||
AF Masc n => numForms petit petits ! n ;
|
||||
AF Fem n => numForms petita petites ! n ;
|
||||
AA => petitament
|
||||
}
|
||||
} ;
|
||||
|
||||
---- Then the regular and invariant patterns.
|
||||
--
|
||||
-- adjfort : Str -> Adj = \solo ->
|
||||
-- let
|
||||
-- sol = Predef.tk 1 solo
|
||||
-- in
|
||||
-- mkAdj solo (sol + "a") (sol + "os") (sol + "as") (sol + "amente") ;
|
||||
--
|
||||
adjFort : Str -> Adj = \fort ->
|
||||
mkAdj fort (fort + "a") (fort + "s") (fort + "es") (fort + "ament") ;
|
||||
--
|
||||
-- adjBlu : Str -> Adj = \blu ->
|
||||
-- mkAdj blu blu blu blu blu ; ---
|
||||
--
|
||||
mkAdjReg : Str -> Adj = \fort -> adjFort fort ;
|
||||
{-
|
||||
case last solo of {
|
||||
"o" => adjSolo solo ;
|
||||
--- "e" => adjUtil solo (solo + "s") ;
|
||||
"a" =>
|
||||
_ => adjUtil solo (solo + "es")
|
||||
} ;
|
||||
-}
|
||||
--
|
||||
----2 Personal pronouns
|
||||
----
|
||||
---- All the eight personal pronouns can be built by the following macro.
|
||||
---- The use of "ne" as atonic genitive is debatable.
|
||||
---- We follow the rule that the atonic nominative is empty.
|
||||
--
|
||||
mkPronoun : (_,_,_,_,_,_,_,_ : Str) ->
|
||||
Gender -> Number -> Person -> Pronoun =
|
||||
\il,le,lui,Lui,son,sa,ses,see,g,n,p ->
|
||||
{s = table {
|
||||
Ton Nom => il ;
|
||||
Ton x => prepCase x ++ Lui ;
|
||||
Aton Nom => strOpt il ; ---- [] ;
|
||||
Aton Acc => le ;
|
||||
Aton (CPrep P_a) => lui ;
|
||||
Aton q => prepCase q ++ Lui ; ---- GF bug with c or p!
|
||||
Poss {n = Sg ; g = Masc} => son ;
|
||||
Poss {n = Sg ; g = Fem} => sa ;
|
||||
Poss {n = Pl ; g = Masc} => ses ;
|
||||
Poss {n = Pl ; g = Fem} => see
|
||||
} ;
|
||||
a = {g = g ; n = n ; p = p} ;
|
||||
hasClit = True
|
||||
} ;
|
||||
--
|
||||
--
|
||||
----2 Determiners
|
||||
----
|
||||
---- Determiners, traditionally called indefinite pronouns, are inflected
|
||||
---- in gender and number, like adjectives.
|
||||
--
|
||||
pronForms : Adj -> Gender -> Number -> Str = \tale,g,n -> tale.s ! AF g n ;
|
||||
--
|
||||
}
|
||||
2
next-lib/src/catalan/NounCat.gf
Normal file
2
next-lib/src/catalan/NounCat.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete NounCat of Noun = CatCat ** NounRomance with
|
||||
(ResRomance = ResCat) ;
|
||||
170
next-lib/src/catalan/NumeralCat.gf
Normal file
170
next-lib/src/catalan/NumeralCat.gf
Normal file
@@ -0,0 +1,170 @@
|
||||
concrete NumeralCat of Numeral = CatCat **
|
||||
open CommonRomance, ResRomance, MorphoCat, Prelude in {
|
||||
|
||||
--
|
||||
-- gcc M3.5.1, M3.5.2
|
||||
--
|
||||
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
|
||||
-- Auxiliaries
|
||||
|
||||
oper
|
||||
-- Use cardinal for big ordinals [M3.5.2]
|
||||
cent : Number => CardOrd => Str = \\n,co => case n of {
|
||||
Pl => case co of {
|
||||
NCard Masc => "-cents" ;
|
||||
NCard Fem => "-centes" ;
|
||||
_ => "-cents" ---- variants {} ---- AR 23/6/2008
|
||||
} ;
|
||||
Sg => "cent"
|
||||
} ;
|
||||
cardOrd1 : CardOrd -> (_,_,_:Str) -> Str = \co,dos,dues,segon -> case co of {
|
||||
NCard Masc => dos ;
|
||||
NCard Fem => dues ;
|
||||
NOrd Masc Sg => segon ;
|
||||
NOrd Fem Sg => segon + "a" ;
|
||||
NOrd Masc Pl => segon + "s" ;
|
||||
NOrd Fem Pl => segon + "es"
|
||||
} ;
|
||||
|
||||
|
||||
cardOrdReg : CardOrd -> Str -> Str -> Str = \co,sis,si -> case co of {
|
||||
NCard _ => sis ;
|
||||
NOrd Masc Sg => si + "è" ;
|
||||
NOrd Fem Sg => si + "ena" ;
|
||||
NOrd Masc Pl => si + "ens" ;
|
||||
NOrd Fem Pl => si + "enes"
|
||||
} ;
|
||||
|
||||
cardOrd2 : CardOrd -> Str -> Str = \co,sis -> let si = init sis in
|
||||
case (last sis) of {
|
||||
"e" => cardOrdReg co sis si ;
|
||||
"a" => cardOrdReg co sis si ;
|
||||
"u" => cardOrdReg co sis (si + "v") ;
|
||||
_ => cardOrdReg co sis sis
|
||||
} ;
|
||||
|
||||
cardOrd3 : CardOrd -> (m,f:Str) -> Str = \co,dos,dues -> case co of {
|
||||
NCard Masc => dos ;
|
||||
NCard Fem => dues ;
|
||||
NOrd Masc Sg => dos + "è" ;
|
||||
NOrd Fem Sg => dos + "ena" ;
|
||||
NOrd Masc Pl => dos + "ens" ;
|
||||
NOrd Fem Pl => dos + "enes"
|
||||
} ;
|
||||
|
||||
|
||||
digitPl1 : (u,t,d,dp:Str) -> (fem,ord:Str) -> {s: DForm => CardOrd => Str} = \dos,dotze,vint,vinti,dues,segon -> {
|
||||
s = \\df,co =>
|
||||
case df of {
|
||||
unit => cardOrd1 co dos dues segon ;
|
||||
teen => cardOrd2 co dotze ;
|
||||
ten => cardOrd2 co vint ;
|
||||
tenplus => cardOrd2 co vinti ;
|
||||
_ => cardOrd3 co dos dues
|
||||
}
|
||||
} ;
|
||||
|
||||
digitPl2 : (u,t,d,dp:Str) -> {s: DForm => CardOrd => Str} = \sis,setze,seixanta,seixantai -> {
|
||||
s = \\df,co => case df of {
|
||||
unit => cardOrd2 co sis;
|
||||
teen => cardOrd2 co setze ;
|
||||
ten => cardOrd2 co seixanta ;
|
||||
tenplus => cardOrd2 co seixantai ;
|
||||
_ => cardOrd2 co sis
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
lin
|
||||
num x = x ;
|
||||
|
||||
n2 = digitPl1 "dos" "dotze" "vint" "vint-i-" "dues" "segon" ;
|
||||
n3 = digitPl1 "tres" "tretze" "trenta" "trenta-" "tres" "tercer" ;
|
||||
n4 = digitPl1 "quatre" "catorze" "quaranta" "quaranta-" "quatre" "quart" ;
|
||||
n5 = digitPl1 "cinc" "quinze" "cinquanta" "cinquanta-" "cinc" "quint" ;
|
||||
n6 = digitPl2 "sis" "setze" "seixanta" "seixanta-" ;
|
||||
n7 = digitPl2 "set" "disset" "setanta" "setanta-" ;
|
||||
n8 = digitPl2 "vuit" "divuit" "vuitanta" "vuitanta-" ;
|
||||
n9 = digitPl2 "nou" "dinou" "noranta" "noranta-" ;
|
||||
|
||||
pot01 = {s= \\df,co =>
|
||||
case df of {
|
||||
unit => cardOrd1 co "un" "una" "primer" ;
|
||||
teen => cardOrd2 co "onze" ;
|
||||
ten => cardOrd2 co "deu" ;
|
||||
tenplus => variants {} ;
|
||||
OrdF => cardOrd2 co "un" ;
|
||||
Aunit => []
|
||||
};
|
||||
n= Sg} ;
|
||||
|
||||
pot0 d = d ** {n= Pl} ;
|
||||
pot110 = {s= \\co => cardOrdReg co "deu" "des"; n= Pl} ;
|
||||
pot111 = {s= \\co => cardOrd2 co "onze"; n= Pl} ;
|
||||
pot1to19 d = {s= \\co => d.s ! teen ! co ; n= Pl} ;
|
||||
pot0as1 n = {s= n.s ! unit; n= n.n} ;
|
||||
pot1 d = {s= \\co => d.s ! ten ! co; n= Pl} ;
|
||||
pot1plus d e =
|
||||
{s= \\co => ((d.s ! tenplus ! (NCard Masc)) ++ (e.s ! OrdF ! co)); n= Pl} ;
|
||||
pot1as2 n = n ;
|
||||
pot2 d = {s= \\co => (d.s ! Aunit ! co) ++ (cent ! (d.n) ! co); n= Pl} ;
|
||||
pot2plus d n = {
|
||||
s= \\co => (d.s ! Aunit ! co) ++ (cent ! (d.n) ! co) ++ (n.s ! co);
|
||||
n= Pl} ;
|
||||
pot2as3 n = n ;
|
||||
pot3 n = {s= \\co => (table {Sg => []; Pl => (n.s ! co) } ! n.n) ++ "mil"; n= Pl} ;
|
||||
pot3plus n m =
|
||||
{s= \\co => (table {Sg => []; Pl => (n.s ! co)} ! n.n) ++ "mil" ++ (m.s !co);
|
||||
n= Pl} ;
|
||||
|
||||
|
||||
param
|
||||
DForm = unit | teen | ten | tenplus | Aunit | OrdF ;
|
||||
|
||||
-- numerals as sequences of digits
|
||||
|
||||
lincat
|
||||
Dig = TDigit ;
|
||||
|
||||
lin
|
||||
IDig d = d ;
|
||||
|
||||
IIDig d i = {
|
||||
s = \\o => d.s ! NCard Masc ++ i.s ! o ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
D_0 = mkDig "0" ;
|
||||
D_1 = mk3Dig "1" "1:o" Sg ; ---- gender
|
||||
D_2 = mk2Dig "2" "2:o" ;
|
||||
D_3 = mk2Dig "3" "3:o" ;
|
||||
D_4 = mkDig "4" ;
|
||||
D_5 = mkDig "5" ;
|
||||
D_6 = mkDig "6" ;
|
||||
D_7 = mkDig "7" ;
|
||||
D_8 = mkDig "8" ;
|
||||
D_9 = mkDig "9" ;
|
||||
|
||||
oper
|
||||
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
|
||||
mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":o") ;
|
||||
|
||||
mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> {
|
||||
s = table {NCard _ => c ; NOrd _ _ => o} ; ---- gender
|
||||
n = n
|
||||
} ;
|
||||
|
||||
TDigit = {
|
||||
n : Number ;
|
||||
s : CardOrd => Str
|
||||
} ;
|
||||
|
||||
}
|
||||
391
next-lib/src/catalan/ParadigmsCat.gf
Normal file
391
next-lib/src/catalan/ParadigmsCat.gf
Normal file
@@ -0,0 +1,391 @@
|
||||
--# -path=.:../romance:../common:../abstract:../../prelude
|
||||
|
||||
----1 Catalan Lexical Paradigms
|
||||
----
|
||||
---- Aarne Ranta 2003
|
||||
----
|
||||
---- This is an API to the user of the resource grammar
|
||||
---- for adding lexical items. It gives functions for forming
|
||||
---- expressions of open categories: nouns, adjectives, verbs.
|
||||
----
|
||||
---- Closed categories (determiners, pronouns, conjunctions) are
|
||||
---- accessed through the resource syntax API, $Structural.gf$.
|
||||
----
|
||||
---- The main difference with $MorphoCat.gf$ is that the types
|
||||
---- referred to are compiled resource grammar types. We have moreover
|
||||
---- had the design principle of always having existing forms, rather
|
||||
---- than stems, as string arguments of the paradigms.
|
||||
----
|
||||
---- The structure of functions for each word class $C$ is the following:
|
||||
---- first we give a handful of patterns that aim to cover all
|
||||
---- regular cases. Then we give a worst-case function $mkC$, which serves as an
|
||||
---- escape to construct the most irregular words of type $C$.
|
||||
--
|
||||
resource ParadigmsCat =
|
||||
open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
CommonRomance,
|
||||
ResCat,
|
||||
MorphoCat,
|
||||
BeschCat,
|
||||
CatCat in {
|
||||
|
||||
flags optimize=all ;
|
||||
--
|
||||
----2 Parameters
|
||||
----
|
||||
---- To abstract over gender names, we define the following identifiers.
|
||||
--
|
||||
oper
|
||||
Gender : Type ;
|
||||
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
|
||||
---- To abstract over number names, we define the following.
|
||||
--
|
||||
-- Number : Type ;
|
||||
--
|
||||
-- singular : Number ;
|
||||
-- plural : Number ;
|
||||
--
|
||||
-- Prepositions used in many-argument functions are either strings
|
||||
-- (including the 'accusative' empty string) or strings that
|
||||
-- amalgamate with the following word (the 'genitive' "de" and the
|
||||
-- 'dative' "a").
|
||||
|
||||
--- Preposition : Type ;
|
||||
|
||||
accusative : Prep ;
|
||||
genitive : Prep ;
|
||||
dative : Prep ;
|
||||
|
||||
mkPrep : Str -> Prep ;
|
||||
|
||||
|
||||
--2 Nouns
|
||||
|
||||
-- Worst case: two forms (singular + plural),
|
||||
-- and the gender.
|
||||
|
||||
mkN : (_,_ : Str) -> Gender -> N ; -- uomo, uomini, masculine
|
||||
|
||||
-- The regular function takes the singular form and the gender,
|
||||
-- and computes the plural and the gender by a heuristic.
|
||||
-- The heuristic says that the gender is feminine for nouns
|
||||
-- ending with "a" or "z", and masculine for all other words.
|
||||
-- Nouns ending with "a", "o", "e" have the plural with "s",
|
||||
-- those ending with "z" have "ces" in plural; all other nouns
|
||||
-- have "es" as plural ending. The accent is not dealt with.
|
||||
|
||||
regN : Str -> N ;
|
||||
|
||||
-- To force a different gender, use one of the following functions.
|
||||
|
||||
mascN : N -> N ;
|
||||
femN : N -> N ;
|
||||
|
||||
--3 Compound nouns
|
||||
--
|
||||
-- Some nouns are ones where the first part is inflected as a noun but
|
||||
-- the second part is not inflected. e.g. "número de telèfon".
|
||||
-- They could be formed in syntax, but we give a shortcut here since
|
||||
-- they are frequent in lexica.
|
||||
|
||||
compN : N -> Str -> N ;
|
||||
|
||||
|
||||
--3 Relational nouns
|
||||
--
|
||||
-- Relational nouns ("filla de x") need a case and a preposition.
|
||||
|
||||
mkN2 : N -> Prep -> N2 ;
|
||||
|
||||
-- The most common cases are the genitive "de" and the dative "a",
|
||||
-- with the empty preposition.
|
||||
|
||||
deN2 : N -> N2 ;
|
||||
-- aN2 : N -> N2 ; s'usa ?
|
||||
|
||||
-- Three-place relational nouns ("la connexió de x a y") need two prepositions.
|
||||
|
||||
mkN3 : N -> Prep -> Prep -> N3 ;
|
||||
|
||||
|
||||
----3 Relational common noun phrases
|
||||
----
|
||||
---- In some cases, you may want to make a complex $CN$ into a
|
||||
---- relational noun (e.g. "the old town hall of"). However, $N2$ and
|
||||
---- $N3$ are purely lexical categories. But you can use the $AdvCN$
|
||||
---- and $PrepNP$ constructions to build phrases like this.
|
||||
--
|
||||
----
|
||||
--3 Proper names and noun phrases
|
||||
--
|
||||
-- Proper names need a string and a gender.
|
||||
|
||||
mkPN : Str -> Gender -> PN ; -- Joan
|
||||
|
||||
-- To form a noun phrase that can also be plural,
|
||||
-- you can use the worst-case function.
|
||||
|
||||
makeNP : Str -> Gender -> Number -> NP ;
|
||||
|
||||
----2 Adjectives
|
||||
--
|
||||
---- Non-comparison one-place adjectives need five forms in the worst
|
||||
---- case (masc and fem singular, masc plural, adverbial).
|
||||
--
|
||||
mkA : (fort,forta,forts,fortes, fortament : Str) -> A ;
|
||||
--
|
||||
-- For regular adjectives, all other forms are derived from the
|
||||
-- masculine singular. The types of adjectives that are recognized are
|
||||
-- "alto", "fuerte", "util".
|
||||
|
||||
regA : Str -> A ;
|
||||
|
||||
---- These functions create postfix adjectives. To switch
|
||||
---- them to prefix ones (i.e. ones placed before the noun in
|
||||
---- modification, as in "petite maison"), the following function is
|
||||
---- provided.
|
||||
--
|
||||
prefA : A -> A ;
|
||||
--
|
||||
----3 Two-place adjectives
|
||||
----
|
||||
---- Two-place adjectives need a preposition for their second argument.
|
||||
--
|
||||
mkA2 : A -> Prep -> A2 ;
|
||||
--
|
||||
----3 Comparison adjectives
|
||||
--
|
||||
---- Comparison adjectives are in the worst case put up from two
|
||||
---- adjectives: the positive ("bueno"), and the comparative ("mejor").
|
||||
--
|
||||
mkADeg : A -> A -> A ;
|
||||
--
|
||||
-- If comparison is formed by "més", as usual in Catalan,
|
||||
-- the following pattern is used:
|
||||
|
||||
compADeg : A -> A ;
|
||||
|
||||
---- The regular pattern is the same as $regA$ for plain adjectives,
|
||||
---- with comparison by "mas".
|
||||
--
|
||||
regADeg : Str -> A ;
|
||||
--
|
||||
--
|
||||
----2 Adverbs
|
||||
|
||||
-- Adverbs are not inflected. Most lexical ones have position
|
||||
-- after the verb.
|
||||
|
||||
mkAdv : Str -> Adv ;
|
||||
|
||||
---- Some appear next to the verb (e.g. "siempre").
|
||||
--
|
||||
mkAdV : Str -> AdV ;
|
||||
--
|
||||
---- Adverbs modifying adjectives and sentences can also be formed.
|
||||
--
|
||||
mkAdA : Str -> AdA ;
|
||||
--
|
||||
--
|
||||
--2 Verbs
|
||||
--
|
||||
-- Regular verbs are ones inflected like "cantar", "servir"/"dormir", or "perdre"/"treure".
|
||||
-- The regular verb function is the first conjugation ("ar") recognizes
|
||||
-- the variations corresponding to the patterns
|
||||
-- "actuar, cazar, guiar, pagar, sacar". The module $BeschCat$ gives
|
||||
-- the complete set of "Bescherelle" conjugations.
|
||||
|
||||
regV : Str -> V ;
|
||||
|
||||
---- The module $BeschCat$ gives all the patterns of the "Bescherelle"
|
||||
---- book. To use them in the category $V$, wrap them with the function
|
||||
|
||||
verbV : Verbum -> V ;
|
||||
|
||||
---- To form reflexive verbs:
|
||||
--
|
||||
reflV : V -> V ;
|
||||
--
|
||||
-- Verbs with a deviant passive participle: just give the participle
|
||||
-- in masculine singular form as second argument.
|
||||
|
||||
special_ppV : V -> Str -> V ;
|
||||
|
||||
--3 Two-place verbs
|
||||
--
|
||||
-- Two-place verbs need a preposition, except the special case with direct object.
|
||||
-- (transitive verbs). Notice that a particle comes from the $V$.
|
||||
|
||||
mkV2 : V -> Prep -> V2 ;
|
||||
|
||||
dirV2 : V -> V2 ;
|
||||
|
||||
---- You can reuse a $V2$ verb in $V$.
|
||||
--
|
||||
-- v2V : V2 -> V ;
|
||||
--
|
||||
----3 Three-place verbs
|
||||
----
|
||||
---- Three-place (ditransitive) verbs need two prepositions, of which
|
||||
---- the first one or both can be absent.
|
||||
|
||||
mkV3 : V -> Prep -> Prep -> V3 ; -- parlar, a, de
|
||||
dirV3 : V -> Prep -> V3 ; -- donar,_,a
|
||||
dirdirV3 : V -> V3 ; -- donar,_,_
|
||||
|
||||
----3 Other complement patterns
|
||||
----
|
||||
---- Verbs and adjectives can take complements such as sentences,
|
||||
---- questions, verb phrases, and adjectives.
|
||||
--
|
||||
mkV0 : V -> V0 ;
|
||||
mkVS : V -> VS ;
|
||||
mkV2S : V -> Prep -> V2S ;
|
||||
mkVV : V -> VV ; -- plain infinitive: "je veux parler"
|
||||
-- deVV : V -> VV ; -- "j'essaie de parler"
|
||||
-- aVV : V -> VV ; -- "j'arrive à parler"
|
||||
mkV2V : V -> Prep -> Prep -> V2V ;
|
||||
-- mkVA : V -> VA ;
|
||||
mkV2A : V -> Prep -> Prep -> V2A ;
|
||||
mkVQ : V -> VQ ;
|
||||
mkV2Q : V -> Prep -> V2Q ;
|
||||
--
|
||||
mkAS : A -> AS ;
|
||||
|
||||
-- mkA2S : A -> Preposition -> A2S ;
|
||||
mkAV : A -> Prep -> AV ;
|
||||
mkA2V : A -> Prep -> Prep -> A2V ;
|
||||
--
|
||||
---- Notice: categories $V2S, V2V, V2Q$ are in v 1.0 treated
|
||||
---- just as synonyms of $V2$, and the second argument is given
|
||||
---- as an adverb. Likewise $AS, A2S, AV, A2V$ are just $A$.
|
||||
---- $V0$ is just $V$.
|
||||
--
|
||||
V0 : Type ;
|
||||
AS, A2S, AV, A2V : Type ;
|
||||
--
|
||||
--
|
||||
----2 The definitions of the paradigms
|
||||
----
|
||||
---- The definitions should not bother the user of the API. So they are
|
||||
---- hidden from the document.
|
||||
----.
|
||||
|
||||
Gender = MorphoCat.Gender ;
|
||||
Number = MorphoCat.Number ;
|
||||
masculine = Masc ;
|
||||
feminine = Fem ;
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
|
||||
--- Preposition = Compl ;
|
||||
accusative = complAcc ;
|
||||
genitive = complGen ;
|
||||
dative = complDat ;
|
||||
mkPrep p = {s = p ; c = Acc ; isDir = False; lock_Prep = <>} ;
|
||||
--
|
||||
--
|
||||
mkN x y g = mkNounIrreg x y g ** {lock_N = <>} ;
|
||||
regN x = mkNomReg x ** {lock_N = <>} ;
|
||||
compN x y = {s = \\n => x.s ! n ++ y ; g = x.g ; lock_N = <>} ;
|
||||
femN x = {s = x.s ; g = feminine ; lock_N = <>} ;
|
||||
mascN x = {s = x.s ; g = masculine ; lock_N = <>} ;
|
||||
|
||||
mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ;
|
||||
deN2 n = mkN2 n genitive ;
|
||||
-- aN2 n = mkN2 n dative ; -- s'usa ?
|
||||
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ;
|
||||
|
||||
mkPN x g = {s = x ; g = g} ** {lock_PN = <>} ;
|
||||
makeNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; hasClit = False} ** {lock_NP = <>} ;
|
||||
--
|
||||
mkA a b c d e =
|
||||
compADeg {s = \\_ => (mkAdj a b c d e).s ; isPre = False ; lock_A = <>} ;
|
||||
regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ; lock_A = <>} ;
|
||||
prefA a = {s = a.s ; isPre = True ; lock_A = <>} ;
|
||||
--
|
||||
mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ;
|
||||
--
|
||||
mkADeg a b =
|
||||
{s = table {Posit => a.s ! Posit ; _ => b.s ! Posit} ;
|
||||
isPre = a.isPre ; lock_A = <>} ;
|
||||
compADeg a =
|
||||
{s = table {Posit => a.s ! Posit ; _ => \\f => "més" ++ a.s ! Posit ! f} ;
|
||||
isPre = a.isPre ;
|
||||
lock_A = <>} ;
|
||||
regADeg a = compADeg (regA a) ;
|
||||
|
||||
mkAdv x = ss x ** {lock_Adv = <>} ;
|
||||
-- mkAdV x = ss x ** {lock_AdV = <>} ;
|
||||
-- mkAdA x = ss x ** {lock_AdA = <>} ;
|
||||
--
|
||||
regV x = -- cantar
|
||||
let
|
||||
ar = Predef.dp 2 x ;
|
||||
z = Predef.dp 1 (Predef.tk 2 x) ;
|
||||
verb = case ar of {
|
||||
"re" => viure_119 x ;
|
||||
"ir" => patir_81 x ;
|
||||
_ => cantar_15 x
|
||||
}
|
||||
-- "er" => deber_6 x ;
|
||||
-- _ => case z of {
|
||||
-- "u" => actuar_9 x ;
|
||||
-- "z" => cazar_21 x ;
|
||||
-- "i" => guiar_43 x ;
|
||||
-- "g" => pagar_53 x ;
|
||||
-- "c" => sacar_72 x ;
|
||||
-- _ => cortar_5 x
|
||||
-- }
|
||||
in verbBesch verb ** {vtyp = VHabere ; lock_V = <>} ;
|
||||
|
||||
reflV v = {s = v.s ; vtyp = VRefl ; lock_V = <>} ;
|
||||
|
||||
verbV ve = verbBesch ve ** {vtyp = VHabere ; lock_V = <>} ;
|
||||
|
||||
special_ppV ve pa = {
|
||||
s = table {
|
||||
VPart g n => (adjFort pa).s ! AF g n ;
|
||||
p => ve.s ! p
|
||||
} ;
|
||||
lock_V = <> ;
|
||||
vtyp = VHabere
|
||||
} ;
|
||||
|
||||
|
||||
mkV2 v p = {s = v.s ; vtyp = v.vtyp ; c2 = p ; lock_V2 = <>} ;
|
||||
dirV2 v = mkV2 v accusative ;
|
||||
-- v2V v = v ** {lock_V = <>} ;
|
||||
--
|
||||
mkV3 v p q = {s = v.s ; vtyp = v.vtyp ;
|
||||
c2 = p ; c3 = q ; lock_V3 = <>} ;
|
||||
dirV3 v p = mkV3 v accusative p ;
|
||||
dirdirV3 v = dirV3 v dative ;
|
||||
--
|
||||
V0 : Type = V ;
|
||||
AS, AV : Type = A ;
|
||||
A2S, A2V : Type = A2 ;
|
||||
--
|
||||
mkV0 v = v ** {lock_V0 = <>} ;
|
||||
mkVS v = v ** {m = \\_ => Indic ; lock_VS = <>} ; ---- more moods
|
||||
mkV2S v p = mkV2 v p ** {mn,mp = Indic ; lock_V2S = <>} ;
|
||||
mkVV v = v ** {c2 = complAcc ; lock_VV = <>} ;
|
||||
-- deVV v = v ** {c2 = complGen ; lock_VV = <>} ;
|
||||
-- aVV v = v ** {c2 = complDat ; lock_VV = <>} ;
|
||||
mkV2V v p t = mkV3 v p t ** { lock_V2V = <>} ;
|
||||
-- mkVA v = v ** {lock_VA = <>} ;
|
||||
mkV2A v p q = mkV3 v p q ** {lock_V2A = <>} ;
|
||||
mkVQ v = v ** {lock_VQ = <>} ;
|
||||
mkV2Q v p = mkV2 v p ** {lock_V2Q = <>} ;
|
||||
--
|
||||
mkAS v = v ** {lock_AS = <>} ; ---- more moods
|
||||
-- mkA2S v p = mkA2 v p ** {lock_A2S = <>} ;
|
||||
mkAV v p = v ** {c = p.p1 ; s2 = p.p2 ; lock_AV = <>} ;
|
||||
mkA2V v p q = mkA2 v p ** {s3 = q.p2 ; c3 = q.p1 ; lock_A2V = <>} ;
|
||||
--
|
||||
} ;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user