forked from GitHub/gf-core
cf for restricted import; new API funs
This commit is contained in:
@@ -11,52 +11,71 @@
|
|||||||
abstract Clause = Categories ** {
|
abstract Clause = Categories ** {
|
||||||
|
|
||||||
fun
|
fun
|
||||||
SPredV : NP -> V -> Cl ; -- "John walks"
|
SPredV : NP -> V -> Cl ; -- "John walks"
|
||||||
SPredPassV : NP -> V -> Cl ; -- "John is seen"
|
SPredPassV : NP -> V -> Cl ; -- "John is seen"
|
||||||
SPredV2 : NP -> V2 -> NP -> Cl ; -- "John sees Mary"
|
SPredV2 : NP -> V2 -> NP -> Cl ; -- "John sees Mary"
|
||||||
SPredV3 : NP -> V3 -> NP -> NP -> Cl ; -- "John tells Mary everything"
|
SPredV3 : NP -> V3 -> NP -> NP -> Cl ; -- "John tells Mary everything"
|
||||||
SPredReflV2 : NP -> V2 -> Cl ; -- "John loves himself"
|
SPredReflV2 : NP -> V2 -> Cl ; -- "John loves himself"
|
||||||
SPredVS : NP -> VS -> S -> Cl ; -- "John says that Mary runs"
|
SPredVS : NP -> VS -> S -> Cl ; -- "John says that Mary runs"
|
||||||
SPredVV : NP -> VV -> VPI -> Cl ; -- "John must walk"
|
SPredVV : NP -> VV -> VPI -> Cl ; -- "John must walk"
|
||||||
SPredVQ : NP -> VQ -> QS -> Cl ; -- "John asks who will come"
|
SPredVQ : NP -> VQ -> QS -> Cl ; -- "John asks who will come"
|
||||||
SPredVA : NP -> VA -> AP -> Cl ; -- "John looks ill"
|
SPredVA : NP -> VA -> AP -> Cl ; -- "John looks ill"
|
||||||
SPredV2A : NP -> V2A -> NP ->AP ->Cl ; -- "John paints the house red"
|
SPredV2A : NP -> V2A -> NP ->AP ->Cl ; -- "John paints the house red"
|
||||||
SPredSubjV2V : NP -> V2V -> NP ->VPI ->Cl ; -- "John promises Mary to leave"
|
SPredSubjV2V : NP -> V2V -> NP ->VPI ->Cl ; -- "John promises Mary to leave"
|
||||||
SPredObjV2V : NP -> V2V -> NP -> VPI -> Cl ; -- "John asks me to come"
|
SPredObjV2V : NP -> V2V -> NP -> VPI -> Cl ; -- "John asks me to come"
|
||||||
SPredV2S : NP -> V2S -> NP -> S -> Cl ; -- "John told me that it is good"
|
SPredV2S : NP -> V2S -> NP -> S -> Cl ; -- "John told me that it is good"
|
||||||
SPredV2Q : NP -> V2Q -> NP -> QS -> Cl ; -- "John asked me if it is good"
|
SPredV2Q : NP -> V2Q -> NP -> QS -> Cl ; -- "John asked me if it is good"
|
||||||
|
|
||||||
SPredAP : NP -> AP -> Cl ; -- "John is old"
|
SPredAP : NP -> AP -> Cl ; -- "John is old"
|
||||||
SPredCN : NP -> CN -> Cl ; -- "John is a man"
|
SPredCN : NP -> CN -> Cl ; -- "John is a man"
|
||||||
SPredNP : NP -> NP -> Cl ; -- "John is Bill"
|
SPredNP : NP -> NP -> Cl ; -- "John is Bill"
|
||||||
SPredAdv : NP -> Adv -> Cl ; -- "John is in France"
|
SPredAdv : NP -> Adv -> Cl ; -- "John is in France"
|
||||||
|
|
||||||
SPredProgVP : NP -> VPI -> Cl ; -- "he is eating"
|
SPredProgVP : NP -> VPI -> Cl ; -- "he is eating"
|
||||||
|
|
||||||
|
QPredV : IP -> V -> QCl ; -- "who walks"
|
||||||
|
QPredPassV : IP -> V -> QCl ; -- "who is seen"
|
||||||
|
QPredV2 : IP -> V2 -> NP -> QCl ; -- "who sees Mary"
|
||||||
|
QPredV3 : IP -> V3 -> NP -> NP -> QCl ; -- "who gives Mary food"
|
||||||
|
QPredReflV2 : IP -> V2 -> QCl ; -- "who loves himself"
|
||||||
|
QPredVS : IP -> VS -> S -> QCl ; -- "who says that Mary runs"
|
||||||
|
QPredVV : IP -> VV -> VPI -> QCl ; -- "who must walk"
|
||||||
|
QPredVQ : IP -> VQ -> QS -> QCl ; -- "who asks who will come"
|
||||||
|
QPredVA : IP -> VA -> AP -> QCl ; -- "who looks ill"
|
||||||
|
QPredV2A : IP -> V2A -> NP ->AP ->QCl ; -- "who paints the house red"
|
||||||
|
QPredSubjV2V : IP -> V2V -> NP ->VPI ->QCl ; -- "who promises Mary to leave"
|
||||||
|
QPredObjV2V : IP -> V2V -> NP -> VPI -> QCl ; -- "who asks me to come"
|
||||||
|
QPredV2S : IP -> V2S -> NP -> S -> QCl ; -- "who told me that it is good"
|
||||||
|
QPredV2Q : IP -> V2Q -> NP -> QS -> QCl ; -- "who asked me if it is good"
|
||||||
|
|
||||||
QPredV : IP -> V -> QCl ; -- "who walks"
|
QPredAP : IP -> AP -> QCl ; -- "who is old"
|
||||||
QPredPassV : IP -> V -> QCl ; -- "who is seen"
|
QPredCN : IP -> CN -> QCl ; -- "who is a man"
|
||||||
QPredV2 : IP -> V2 -> NP -> QCl ; -- "who sees Mary"
|
QPredNP : IP -> NP -> QCl ; -- "who is Bill"
|
||||||
---- QPredV3 : IP -> V3 -> NP -> NP -> QCl ; -- "who gives Mary food"
|
QPredAdv : IP -> Adv -> QCl ; -- "who is in France"
|
||||||
QPredReflV2 : IP -> V2 -> QCl ; -- "who loves himself"
|
|
||||||
QPredVS : IP -> VS -> S -> QCl ; -- "who says that Mary runs"
|
|
||||||
QPredVV : IP -> VV -> VPI -> QCl ; -- "who must walk"
|
|
||||||
QPredVQ : IP -> VQ -> QS -> QCl ; -- "who asks who will come"
|
|
||||||
QPredVA : IP -> VA -> AP -> QCl ; -- "who looks ill"
|
|
||||||
QPredV2A : IP -> V2A -> NP ->AP ->QCl ; -- "who paints the house red"
|
|
||||||
QPredSubjV2V : IP -> V2V -> NP ->VPI ->QCl ; -- "who promises Mary to leave"
|
|
||||||
QPredObjV2V : IP -> V2V -> NP -> VPI -> QCl ; -- "who asks me to come"
|
|
||||||
QPredV2S : IP -> V2S -> NP -> S -> QCl ; -- "who told me that it is good"
|
|
||||||
QPredV2Q : IP -> V2Q -> NP -> QS -> QCl ; -- "who asked me if it is good"
|
|
||||||
|
|
||||||
QPredAP : IP -> AP -> QCl ; -- "who is old"
|
QPredProgVP : IP -> VPI -> QCl ; -- "who is eating"
|
||||||
QPredCN : IP -> CN -> QCl ; -- "who is a man"
|
|
||||||
QPredNP : IP -> NP -> QCl ; -- "who is Bill"
|
|
||||||
QPredAdv : IP -> Adv -> QCl ; -- "who is in France"
|
|
||||||
|
|
||||||
IPredV : Ant -> V -> VPI ; -- "walk"
|
IPredV : Ant -> V -> VPI ; -- "walk"
|
||||||
IPredV2 : Ant -> V2 -> NP -> VPI ; -- "see Mary"
|
IPredPassV : Ant -> V -> VPI ; -- "be seen"
|
||||||
IPredAP : Ant -> AP -> VPI ; -- "be old"
|
IPredV2 : Ant -> V2 -> NP -> VPI ; -- "see Mary"
|
||||||
|
IPredV3 : Ant -> V3 -> NP -> NP -> VPI ; -- "give Mary food"
|
||||||
|
IPredReflV2 : Ant -> V2 -> VPI ; -- "love himself"
|
||||||
|
IPredVS : Ant -> VS -> S -> VPI ; -- "say that Mary runs"
|
||||||
|
IPredVV : Ant -> VV -> VPI -> VPI ; -- "want to walk"
|
||||||
|
IPredVQ : Ant -> VQ -> QS -> VPI ; -- "ask who will come"
|
||||||
|
IPredVA : Ant -> VA -> AP -> VPI ; -- "look ill"
|
||||||
|
IPredV2A : Ant -> V2A -> NP ->AP ->VPI ; -- "paint the house red"
|
||||||
|
IPredSubjV2V : Ant -> V2V -> NP ->VPI ->VPI ; -- "promise Mary to leave"
|
||||||
|
IPredObjV2V : Ant -> V2V -> NP -> VPI ->VPI ; -- "ask me to come"
|
||||||
|
IPredV2S : Ant -> V2S -> NP -> S -> VPI ; -- "tell me that it is good"
|
||||||
|
IPredV2Q : Ant -> V2Q -> NP -> QS -> VPI ; -- "ask me if it is good"
|
||||||
|
|
||||||
|
IPredAP : Ant -> AP -> VPI ; -- "be old"
|
||||||
|
IPredCN : Ant -> CN -> VPI ; -- "be a man"
|
||||||
|
IPredNP : Ant -> NP -> VPI ; -- "be Bill"
|
||||||
|
IPredAdv : Ant -> Adv -> VPI ; -- "be in France"
|
||||||
|
|
||||||
|
IPredProgVP : Ant -> VPI -> VPI ; -- "be eating"
|
||||||
|
|
||||||
|
|
||||||
{-
|
{-
|
||||||
|
|||||||
@@ -111,9 +111,11 @@ fun
|
|||||||
PrepNP : Prep -> NP -> PP ; -- "in London", "after the war"
|
PrepNP : Prep -> NP -> PP ; -- "in London", "after the war"
|
||||||
|
|
||||||
AdvCN : CN -> PP -> CN ; -- "house in London"
|
AdvCN : CN -> PP -> CN ; -- "house in London"
|
||||||
|
AdvPN : PN -> PP -> NP ; -- "x to the power of k"
|
||||||
AdvAP : AdA -> AP -> AP ; -- "very good"
|
AdvAP : AdA -> AP -> AP ; -- "very good"
|
||||||
AdvAdv : AdA -> Adv -> Adv ; -- "very well"
|
AdvAdv : AdA -> Adv -> Adv ; -- "very well"
|
||||||
|
|
||||||
|
|
||||||
--!
|
--!
|
||||||
--3 Sentences and relative clauses
|
--3 Sentences and relative clauses
|
||||||
--
|
--
|
||||||
@@ -195,6 +197,12 @@ fun
|
|||||||
SubjImper : Subj -> S -> Imp -> Imp ; -- "if it is hot, use a glove!"
|
SubjImper : Subj -> S -> Imp -> Imp ; -- "if it is hot, use a glove!"
|
||||||
SubjQS : Subj -> S -> QS -> QS ; -- "if you are new, who are you?"
|
SubjQS : Subj -> S -> QS -> QS ; -- "if you are new, who are you?"
|
||||||
|
|
||||||
|
-- This rule makes a subordinate clause into a sentence adverb, which
|
||||||
|
-- can be attached to e.g. noun phrases. It might even replace the
|
||||||
|
-- previous subjunction rules.
|
||||||
|
|
||||||
|
AdvSubj : Subj -> S -> Adv ; -- "when he arrives"
|
||||||
|
|
||||||
--!
|
--!
|
||||||
--2 One-word utterances
|
--2 One-word utterances
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -33,15 +33,14 @@ concrete ClauseEng of Clause = CategoriesEng **
|
|||||||
QPredPassV np v = predBeGroupQ np (passVerb v) ;
|
QPredPassV np v = predBeGroupQ np (passVerb v) ;
|
||||||
QPredV2 np v x = intVerbClause np v (complTransVerb v x) ;
|
QPredV2 np v x = intVerbClause np v (complTransVerb v x) ;
|
||||||
QPredReflV2 np v = intVerbClause np v (reflTransVerb v) ;
|
QPredReflV2 np v = intVerbClause np v (reflTransVerb v) ;
|
||||||
|
QPredV3 np v x y = intVerbClause np v (complDitransVerb v x y) ;
|
||||||
QPredVS np v x = intVerbClause np v (complSentVerb v x) ;
|
QPredVS np v x = intVerbClause np v (complSentVerb v x) ;
|
||||||
QPredVV np v x = intVerbClause np (aux2verb v) (complVerbVerb v x) ;
|
QPredVV np v x = intVerbClause np (aux2verb v) (complVerbVerb v x) ;
|
||||||
QPredVQ np v x = intVerbClause np v (complQuestVerb v x) ;
|
QPredVQ np v x = intVerbClause np v (complQuestVerb v x) ;
|
||||||
QPredVA np v x = intVerbClause np v (complAdjVerb v x) ;
|
QPredVA np v x = intVerbClause np v (complAdjVerb v x) ;
|
||||||
QPredV2A np v x y = intVerbClause np v (complDitransAdjVerb v x y) ;
|
QPredV2A np v x y = intVerbClause np v (complDitransAdjVerb v x y) ;
|
||||||
QPredSubjV2V np v x y = intVerbClause np v (complDitransVerbVerb
|
QPredSubjV2V np v x y = intVerbClause np v (complDitransVerbVerb False v x y) ;
|
||||||
False v x y) ;
|
QPredObjV2V np v x y = intVerbClause np v (complDitransVerbVerb True v x y) ;
|
||||||
QPredObjV2V np v x y = intVerbClause np v (complDitransVerbVerb
|
|
||||||
True v x y) ;
|
|
||||||
QPredV2S np v x y = intVerbClause np v (complDitransSentVerb v x y) ;
|
QPredV2S np v x y = intVerbClause np v (complDitransSentVerb v x y) ;
|
||||||
QPredV2Q np v x y = intVerbClause np v (complDitransQuestVerb v x y) ;
|
QPredV2Q np v x y = intVerbClause np v (complDitransQuestVerb v x y) ;
|
||||||
|
|
||||||
@@ -50,10 +49,29 @@ concrete ClauseEng of Clause = CategoriesEng **
|
|||||||
QPredNP np v = predBeGroupQ np (complNounPhrase v) ;
|
QPredNP np v = predBeGroupQ np (complNounPhrase v) ;
|
||||||
QPredAdv np v = predBeGroupQ np (complAdverb v) ;
|
QPredAdv np v = predBeGroupQ np (complAdverb v) ;
|
||||||
|
|
||||||
|
QPredProgVP np vp = predBeGroupQ np (vp.s ! VIPresPart) ;
|
||||||
|
|
||||||
IPredV a v = predVerbI True a v (complVerb v) ;
|
IPredV a v = predVerbI True a v (complVerb v) ;
|
||||||
|
IPredPassV a v = predVerbI True a v (passVerb v) ;
|
||||||
IPredV2 a v x = predVerbI True a v (complTransVerb v x) ;
|
IPredV2 a v x = predVerbI True a v (complTransVerb v x) ;
|
||||||
|
IPredReflV2 a v = predVerbI True a v (reflTransVerb v) ;
|
||||||
|
IPredV3 a v x y = predVerbI True a v (complDitransVerb v x y) ;
|
||||||
|
IPredVS a v x = predVerbI True a v (complSentVerb v x) ;
|
||||||
|
IPredVV a v x = predVerbI True a (aux2verb v) (complVerbVerb v x) ;
|
||||||
|
IPredVQ a v x = predVerbI True a v (complQuestVerb v x) ;
|
||||||
|
IPredVA a v x = predVerbI True a v (complAdjVerb v x) ;
|
||||||
|
IPredV2A a v x y = predVerbI True a v (complDitransAdjVerb v x y) ;
|
||||||
|
IPredSubjV2V a v x y = predVerbI True a v (complDitransVerbVerb False v x y) ;
|
||||||
|
IPredObjV2V a v x y = predVerbI True a v (complDitransVerbVerb True v x y) ;
|
||||||
|
IPredV2S a v x y = predVerbI True a v (complDitransSentVerb v x y) ;
|
||||||
|
IPredV2Q a v x y = predVerbI True a v (complDitransQuestVerb v x y) ;
|
||||||
|
|
||||||
IPredAP a v = predBeGroupI True a v.s ;
|
IPredAP a v = predBeGroupI True a v.s ;
|
||||||
|
IPredCN a v = predBeGroupI True a (complCommNoun v) ;
|
||||||
|
IPredNP a v = predBeGroupI True a (complNounPhrase v) ;
|
||||||
|
IPredAdv a v = predBeGroupI True a (complAdverb v) ;
|
||||||
|
|
||||||
|
IPredProgVP a vp = predBeGroupI True a (vp.s ! VIPresPart) ;
|
||||||
|
|
||||||
{-
|
{-
|
||||||
-- Use VPs
|
-- Use VPs
|
||||||
|
|||||||
@@ -19,4 +19,5 @@ lin
|
|||||||
PNCountry x = x ;
|
PNCountry x = x ;
|
||||||
ANationality x = x ;
|
ANationality x = x ;
|
||||||
NLanguage x = x ;
|
NLanguage x = x ;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ lin
|
|||||||
AdvCN = advCommNounPhrase ;
|
AdvCN = advCommNounPhrase ;
|
||||||
AdvAP = advAdjPhrase ;
|
AdvAP = advAdjPhrase ;
|
||||||
AdvAdv = cc2 ;
|
AdvAdv = cc2 ;
|
||||||
|
AdvPN pn pp = nameNounPhrase {s = \\c => pn.s ! c ++ pp.s ; g = pn.g} ;
|
||||||
|
|
||||||
--3 Sentences and relative clauses
|
--3 Sentences and relative clauses
|
||||||
--
|
--
|
||||||
@@ -180,6 +180,7 @@ lin
|
|||||||
SubjS = subjunctSentence ;
|
SubjS = subjunctSentence ;
|
||||||
SubjImper = subjunctImperative ;
|
SubjImper = subjunctImperative ;
|
||||||
SubjQS = subjunctQuestion ;
|
SubjQS = subjunctQuestion ;
|
||||||
|
AdvSubj if A = ss (if.s ++ A.s) ;
|
||||||
|
|
||||||
PhrNP = useNounPhrase ;
|
PhrNP = useNounPhrase ;
|
||||||
PhrOneCN = useCommonNounPhrase singular ;
|
PhrOneCN = useCommonNounPhrase singular ;
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
-- Stability : (stable)
|
-- Stability : (stable)
|
||||||
-- Portability : (portable)
|
-- Portability : (portable)
|
||||||
--
|
--
|
||||||
-- > CVS $Date: 2005/04/21 16:21:11 $
|
-- > CVS $Date: 2005/05/31 12:47:52 $
|
||||||
-- > CVS $Author: bringert $
|
-- > CVS $Author: aarne $
|
||||||
-- > CVS $Revision: 1.13 $
|
-- > CVS $Revision: 1.14 $
|
||||||
--
|
--
|
||||||
-- AR 27\/1\/2000 -- 3\/12\/2001 -- 8\/6\/2003
|
-- AR 27\/1\/2000 -- 3\/12\/2001 -- 8\/6\/2003
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
@@ -42,17 +42,22 @@ canon2cf opts gr c = tracePrt "#size of CF" (err id (show.length.rulesOfCF)) $ d
|
|||||||
a <- M.abstractOfConcrete gr c
|
a <- M.abstractOfConcrete gr c
|
||||||
let cncs = [m | (n, M.ModMod m) <- M.modules gr, elem n ms]
|
let cncs = [m | (n, M.ModMod m) <- M.modules gr, elem n ms]
|
||||||
let mms = [(a, tree2list (M.jments m)) | m <- cncs]
|
let mms = [(a, tree2list (M.jments m)) | m <- cncs]
|
||||||
rules0 <- liftM concat $ mapM (uncurry (cnc2cfCond opts)) mms
|
cnc <- liftM M.jments $ M.lookupModMod gr c
|
||||||
|
rules0 <- liftM concat $ mapM (uncurry (cnc2cfCond opts cnc)) mms
|
||||||
let bindcats = map snd $ allBindCatsOf gr
|
let bindcats = map snd $ allBindCatsOf gr
|
||||||
let rules = filter (not . isCircularCF) rules0 ---- temporarily here
|
let rules = filter (not . isCircularCF) rules0 ---- temporarily here
|
||||||
let grules = groupCFRules rules
|
let grules = groupCFRules rules
|
||||||
let predef = mkCFPredef opts bindcats grules
|
let predef = mkCFPredef opts bindcats grules
|
||||||
return $ CF predef
|
return $ CF predef
|
||||||
|
|
||||||
cnc2cfCond :: Options -> Ident -> [(Ident,Info)] -> Err [CFRule]
|
cnc2cfCond :: Options -> BinTree Ident Info ->
|
||||||
cnc2cfCond opts m gr =
|
Ident -> [(Ident,Info)] -> Err [CFRule]
|
||||||
|
cnc2cfCond opts cnc m gr =
|
||||||
liftM concat $
|
liftM concat $
|
||||||
mapM lin2cf [(m,fun,cat,args,lin) | (fun, CncFun cat args lin _) <- gr]
|
mapM lin2cf [(m,fun,cat,args,lin) |
|
||||||
|
(fun, CncFun cat args lin _) <- gr, is fun]
|
||||||
|
where
|
||||||
|
is f = isInBinTree f cnc
|
||||||
|
|
||||||
type IFun = Ident
|
type IFun = Ident
|
||||||
type ICat = CIdent
|
type ICat = CIdent
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ trees2trms opts sg cn as ts0 info = do
|
|||||||
,checkWarn (unlines ("Raw CF trees:":(map prCFTree ts0))) >> return []
|
,checkWarn (unlines ("Raw CF trees:":(map prCFTree ts0))) >> return []
|
||||||
]
|
]
|
||||||
_ -> do
|
_ -> do
|
||||||
let num = optIntOrN opts flagRawtrees 99999
|
let num = optIntOrN opts flagRawtrees 999999
|
||||||
let (ts01,rest) = splitAt num ts0
|
let (ts01,rest) = splitAt num ts0
|
||||||
if null rest then return ()
|
if null rest then return ()
|
||||||
else checkWarn ("Warning: only" +++ show num +++ "raw parses out of" +++
|
else checkWarn ("Warning: only" +++ show num +++ "raw parses out of" +++
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
-- Stability : (stable)
|
-- Stability : (stable)
|
||||||
-- Portability : (portable)
|
-- Portability : (portable)
|
||||||
--
|
--
|
||||||
-- > CVS $Date: 2005/05/11 10:28:16 $
|
-- > CVS $Date: 2005/05/31 12:47:52 $
|
||||||
-- > CVS $Author: peb $
|
-- > CVS $Author: aarne $
|
||||||
-- > CVS $Revision: 1.23 $
|
-- > CVS $Revision: 1.24 $
|
||||||
--
|
--
|
||||||
-- (Description of the module)
|
-- (Description of the module)
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
@@ -104,7 +104,7 @@ trees2trms opts sg cn as ts0 info = do
|
|||||||
,checkWarn (unlines ("Raw CF trees:":(map prCFTree ts0))) >> return []
|
,checkWarn (unlines ("Raw CF trees:":(map prCFTree ts0))) >> return []
|
||||||
]
|
]
|
||||||
_ -> do
|
_ -> do
|
||||||
let num = optIntOrN opts flagRawtrees 99999
|
let num = optIntOrN opts flagRawtrees 999999
|
||||||
let (ts01,rest) = splitAt num ts0
|
let (ts01,rest) = splitAt num ts0
|
||||||
if null rest then return ()
|
if null rest then return ()
|
||||||
else raise ("Warning: only" +++ show num +++ "raw parses out of" +++
|
else raise ("Warning: only" +++ show num +++ "raw parses out of" +++
|
||||||
|
|||||||
Reference in New Issue
Block a user