added a copy of uddeps.labels; script for generating a table of abstract RGL functions and information on them; an instance of running the script, absfuns.html, to be used as documentation

This commit is contained in:
aarne
2015-10-14 08:04:09 +00:00
parent 8e469675df
commit d277fe88e1
5 changed files with 1987 additions and 4 deletions

42
lib/doc/AbsFunDoc.hs Normal file
View File

@@ -0,0 +1,42 @@
import System.Process(system)
import qualified Data.Map as M
import qualified Data.Set as S
import Data.List
-- building a table of RGL functions and their types, examples, and documentation
-- to run:
-- $ runghc AbsFunDoc.hs >absfuns.txt
-- $ txt2tags -thtml absfuns.txt
-- this creates the file absfuns.html
main = do
system "grep \" : \" ../src/abstract/*.gf ../src/translator/Extensions.gf >absfuns.tmp"
funs <- readFile "absfuns.tmp" >>= return . lines
deps <- readFile "../src/uddeps.labels" >>= return . lines
let depmap = M.fromList [(fun,deps) | fun:deps <- map words deps]
let rows = sort $ filter (flip S.notMember hiddenModules . last) $ map (mkRow depmap) (map words funs)
let entries = map sepFields rows
putStrLn $ "GF RGL Functions"
putStrLn $ "generated by lib/src/doc/AbsFunFoc.hs"
putStrLn $ ""
putStrLn $ sepFields ["Function","Type","Example","Dependencies","Module"]
putStrLn $ unlines entries
hiddenModules = S.fromList
["Backward","Structural","Extra","Construction","Compatibility",
"Documentation","Lexicon","NumeralTransfer","Terminology","Transfer","MarkHTML","Markup","ERROR"] ----
mkRow depmap ws = case ws of
file:fun:":":typecomment -> fun : getTypeComment typecomment ++ [getDep fun, getModule file]
_ -> ["ERROR"]
where
getModule = reverse . takeWhile (/='/') . tail . dropWhile (/='.') . reverse -- ../src/abstract/Adverb.gf: --> Adverb
getTypeComment ws = case span (/= ";") ws of
(ty,rest) -> [unwords ty, unwords (drop 2 rest)] -- PredVP : NP -> VP -> Cl ; -- John walks
getDep fun = maybe "-" (unwords . takeWhile (/="--")) $ M.lookup fun depmap
-- sepFields = concat . intersperse "\t"
sepFields fs = "| " ++ concat (intersperse " | " fs) ++ " |"

1789
lib/doc/absfuns.html Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
--1 Common: Structures with Common Implementations.
-- This module defines the categories that uniformly have the linearization
-- ${s : Str}$ in all languages.
-- This module defines the categories that uniformly have the
-- linearization type ${s:Str}$ in all languages.
abstract Common = {

View File

@@ -13,8 +13,8 @@ abstract Phrase = Cat ** {
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
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

152
lib/src/uddeps.labels Normal file
View File

@@ -0,0 +1,152 @@
PredVP nsubj head
PredVPS nsubj head
DirectComplVQ empty nsubj head ccomp -- Temp argument can only be empty in English
DirectComplVS empty nsubj head ccomp -- Temp argument can only be empty in English
SlashVP nsubj head
SlashVS nsubj head ccomp
FocusObjS nsubj head -- again might be wrong; more correct to call it dobj
QuestIAdv advmod head -- "where does John sleep" cf. AdvVP
QuestIComp head nsubj -- "where is John": John is clearly nsubj, but is where the head?
QuestQVP nsubj head
QuestSlash dobj head
QuestVP nsubj head
PredVP PassVPSlash nsubjpass head
PredSCVP csubj head
ComplSlash head dobj
ComplSlashIP head dobj
Slash3V3 head dobj
SlashV2VNP head dobj xcomp
PastPartAgentAP head dobj
AdvQVP head dobj
Slash2V3 head iobj
ComplVS head ccomp
ComplVQ head ccomp
SlashV2S head ccomp
SlashV2Q head ccomp
CleftAdv head advcl -- not sure
ComplVA head xcomp
ComplVV head xcomp
SlashVV head acl
SlashV2A head xcomp
SlashV2V head xcomp
AdvNP head nmod -- not sure
ExtAdvNP head nmod -- not sure
PassAgentVPSlash head nmod -- not sure
CleftNP head acl -- this cannot be nmod, not with type RS
SSubjS head mark advcl
RelS head advcl
AdNum advmod head
AdAP advmod head
AdvAP head advmod
ComparAdvAdj advmod amod head
ComparAdvAdjS advmod amod head
AdvIAdv advmod head
AdVVP advmod head
AdvVP head advmod
ExtAdvVP head advmod
AddAdvQVP head advmod
AdVVPSlash advmod head
AdvVPSlash head advmod
AdvSlash head advmod
ExistIPAdv head advmod
AdvS advmod head
ExtAdvS advmod head
SubjS mark head
RelVP mark head
RelSlash mark head
ComplN2 head nmod
ComplN3 nmod head
AdvCN head nmod
PossNP nmod head
PartNP nmod head
ExistNPAdv head nmod
OrdNumeralSuperl nummod head -- quite wrong; cannot find relevant details in the documentation; but most probably head lies outside the score of this function
DetQuant head nummod -- quite wrong; I think the head lies outside the scope of the function
CNNumNP head nummod
ApposCN head appos
ApposNP head appos
RelNP head acl
RelCN head acl
SentCN head acl
SentAP amod acl
DetQuantOrd head nummod amod -- quite wrong; again for same reason as DetQuant function
DetCN det head
CountNP det head
PredetNP det head
AdjCN amod head
AdjDAP head amod
CAdvAP case amod head
ComparA amod head
ComplA2 amod head
CompoundAP head amod
AdAdV amod head
AdAdv amod head
CompoundN compound head
IIDig head goeswith
PrepNP case head
PrepIP case head
SlashPrep head case
VPSlashPrep head case
UttImpPl empty head
UttImpPol empty head
UttImpSg empty head
MkVPS empty empty head
UseCl empty empty head
UseQCl empty empty head
UseRCl empty empty head
UseSlash empty empty head
UseVC empty empty head
BaseAP head conj
BaseAdV head conj
BaseAdv head conj
BaseCN head conj
BaseDAP head conj
BaseIAdv head conj
BaseNP head conj
BaseRS head conj
BaseS head conj
ConsAP head conj
ConsAdV head conj
ConsAdv head conj
ConsCN head conj
ConsDAP head conj
ConsIAdv head conj
ConsNP head conj
ConsRS head conj
ConsS head conj
ConjAP cc head
ConjAdV cc head
ConjAdv cc head
ConjCN cc head
ConjDet cc head
ConjIAdv cc head
ConjNP cc head
ConjRS cc head
ConjS cc head
PhrUtt cc head discourse
PlusChunk head dep
TTAnt empty empty head