1
0
forked from GitHub/gf-core

reorganized synopsis, added cat chart

This commit is contained in:
aarne
2007-09-07 08:34:02 +00:00
parent 719a5d1296
commit 0c1a16b0f8
6 changed files with 1816 additions and 1126 deletions

View File

@@ -357,7 +357,7 @@ incomplete resource Constructors = open Grammar in {
mkNP : Num -> N -> NP ; -- 11. almost twenty men
mkNP : Num -> CN -> NP ; -- 12. almost twenty old men
mkNP : Pron -> N -> NP ; -- 13. my man
mkNP : Pron -> CN -> NP; -- 14. my old man
mkNP : Pron -> CN -> NP ; -- 14. my old man
-- Proper names and pronouns can be used as noun phrases.

View File

@@ -20,14 +20,17 @@ main = do
cs1 <- getCats isLatex True commonAPI
cs2 <- getCats isLatex False catAPI
let cs = cs1 ++ cs2
delimit cs
append "==A hierarchic view==\n"
include "categories-intro.txt"
append "==Explanations==\n"
delimit $ reCat cs
space
title "Syntax Rules"
space
link "Source:" syntaxAPI
space
rs <- getRules True isLatex syntaxAPI
delimit rs
delimit $ reTable rs
space
title "Structural Words"
space
@@ -154,3 +157,44 @@ link s f = append $ s ++ " [``" ++ fa ++ "`` " ++ f ++ "]" where
ttf s = "``" ++ s ++ "``"
itf s = "//" ++ s ++ "//"
-----------------
-- sort category synopsis by category, retain one table
reCat t = let (hd,tb) = splitHeader t in hd : sortCat tb
sortCat = sortBy (\r s -> compare (cat r) (cat s)) where
cat r = unquote $ words r !! 1
unquote = takeWhile (/='`') . dropWhile (=='`')
-- sort function synopsis by category, into separate tables
-- table:
-- || Function | Type | Example ||
-- | ``mkText`` | ``Phr -> Text`` | //But John walks.// |
reTable t = let (hd,tb) = splitHeader t in sortTable hd tb
splitHeader (hd:tb) = (hd,tb)
sortTable hd = map (printBack hd) . sortVal . groupVal
groupVal = groupBy sameVal where
sameVal r1 r2 = valRow r1 == valRow r2
-- row: | ``mkText`` | ``Phr -> Text`` | //But John walks.// |
valRow r = case words r of
"|":_:"|":rest -> val where
typ = takeWhile (/="|") rest
val = unquote $ last typ
_ -> error "no row value for: " ++ r
sortVal = sortBy (\t u -> compare (hd t) (hd u)) where
hd = (valRow . head)
printBack hd tb = unlines $ subtitle (valRow (head tb)) : "\n" : [hd] ++ tb
subtitle cat = "==" ++ cat ++ "=="

View File

@@ -0,0 +1,17 @@
The chart below shows the categories in a hierarchical top-down order.
The edges do not define the complete dependency structure; if they did,
the graph would have many many more edges, and also many cycles. The precise
meaning of a directed edge from //C// to //D// is: there is a constructor
of //C// that takes //D// as an argument. What the constructors exactly are,
and what other arguments they take, is described by separate tables for
each category.
| [categories.png] |
The rectangular boxes mark open lexical categories, which have constructors
also in the ``Paradigms`` modules.

View File

@@ -0,0 +1,139 @@
digraph {
size = "12,8" ;
Text [style = "solid", shape = "ellipse"];
Text -> Punct [style = "solid"];
Text -> Phr [style = "solid"];
Punct [style = "solid", shape = "ellipse"];
Phr [style = "solid", shape = "ellipse"];
Phr -> PConj [style = "solid"];
Phr -> Utt [style = "solid"];
Phr -> Voc [style = "solid"];
PConj [style = "solid", shape = "ellipse"];
Voc [style = "solid", shape = "ellipse"];
Utt [style = "solid", shape = "ellipse"];
Utt -> Imp [style = "solid"];
Utt -> S [style = "solid"];
Utt -> QS [style = "solid"];
Imp [style = "solid", shape = "ellipse"];
S [style = "solid", shape = "ellipse"];
S -> Tense [style = "solid"];
S -> Ant [style = "solid"];
S -> Pol [style = "solid"];
S -> Cl [style = "solid"];
S -> ListS [style = "solid"];
S -> Conjs [style = "solid"];
Conjs [label = "Conj,DConj", style = "solid", shape = "ellipse"];
Tense [style = "solid", shape = "ellipse"];
Ant [style = "solid", shape = "ellipse"];
Pol [style = "solid", shape = "ellipse"];
Cl [style = "solid", shape = "ellipse"];
Cl -> NP [style = "solid"];
Cl -> VP [style = "solid"];
Cl -> Adv [style = "solid"];
Adv [style = "solid", shape = "rectangle"];
Adv -> ListAdv [style = "solid"];
NP [style = "solid", shape = "ellipse"];
NP -> Predet [style = "solid"];
NP -> Pron [style = "solid"];
NP -> PN [style = "solid"];
NP -> Det [style = "solid"];
NP -> CN [style = "solid"];
NP -> ListNP [style = "solid"];
Predet [style = "solid", shape = "ellipse"];
Pron [style = "solid", shape = "ellipse"];
PN [style = "solid", shape = "rectangle"];
Det [style = "solid", shape = "ellipse"];
Det -> Quants [style = "solid"];
Det -> Num [style = "solid"];
Det -> Ord [style = "solid"];
Quants [label = "QuantSg,QuantPl", style = "solid", shape = "ellipse"];
Quants -> Quant [style = "solid"];
Quant [style = "solid", shape = "ellipse"];
Num [style = "solid", shape = "ellipse"];
Num -> Numerals [style = "solid"];
Num -> AdN [style = "solid"];
AdN [style = "solid", shape = "ellipse"];
AdN -> CAdv [style = "solid"];
Numerals [label = "Numeral,Int", style = "solid", shape = "ellipse"];
Ord [style = "solid", shape = "ellipse"];
CN [style = "solid", shape = "ellipse"];
CN -> Ns [style = "solid"];
CN -> RS [style = "solid"];
Ns [label = "N,N2,N3", style = "solid", shape = "rectangle"];
VP [style = "solid", shape = "ellipse"];
VP -> AdV [style = "solid"];
VP -> Vs [style = "solid"];
VP -> AP [style = "solid"];
AdV [style = "solid", shape = "ellipse"];
Vs [label = "V,V2,V3,VV,VS,VQ,VA,V2A", style = "solid", shape = "rectangle"];
AP [style = "solid", shape = "ellipse"];
AP -> AdA [style = "solid"];
AP -> As [style = "solid"];
AP -> ListAP [style = "solid"];
As [label = "A, A2", style = "solid", shape = "rectangle"];
QS [style = "solid", shape = "ellipse"];
QS -> QCl [style = "solid"];
QCl [style = "solid", shape = "ellipse"];
QCl -> IP [style = "solid"];
QCl -> IAdv [style = "solid"];
QCl -> Slash [style = "solid"];
IP [style = "solid", shape = "ellipse"];
IP -> IDet [style = "solid"];
IDet [style = "solid", shape = "ellipse"];
IAdv [style = "solid", shape = "ellipse"];
Slash [style = "solid", shape = "ellipse"];
RS [style = "solid", shape = "ellipse"];
RS -> RCl [style = "solid"];
RCl [style = "solid", shape = "ellipse"];
RCl -> RP [style = "solid"];
RP [style = "solid", shape = "ellipse"];
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

File diff suppressed because it is too large Load Diff