mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
Spring cleaning
Nothing major...
This commit is contained in:
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
dist/setup-config: gf.cabal Setup.hs
|
dist/setup-config: gf.cabal Setup.hs WebSetup.hs
|
||||||
cabal configure
|
cabal configure
|
||||||
|
|
||||||
build: dist/setup-config
|
build: dist/setup-config
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ document.write('<div style="text-align: right"> <form onsubmit="return sitesear
|
|||||||
<img id=gflogo class=grow src="doc/Logos/gf0.png" alt="">
|
<img id=gflogo class=grow src="doc/Logos/gf0.png" alt="">
|
||||||
<script>
|
<script>
|
||||||
if(document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"))
|
if(document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"))
|
||||||
document.getElementById("gflogo").src="doc/Logos/gf0.svg"
|
document.getElementById("gflogo").src="doc/Logos/gf1.svg"
|
||||||
</script>
|
</script>
|
||||||
<H1>Grammatical Framework</H1>
|
<H1>Grammatical Framework</H1>
|
||||||
<P>
|
<P>
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ module GF.Data.Operations (-- * misc functions
|
|||||||
lookupTree, --lookupTreeMany,
|
lookupTree, --lookupTreeMany,
|
||||||
lookupTreeManyAll, updateTree,
|
lookupTreeManyAll, updateTree,
|
||||||
buildTree, filterBinTree,
|
buildTree, filterBinTree,
|
||||||
sorted2tree, mapTree, mapMTree, tree2list,
|
--sorted2tree,
|
||||||
|
mapTree, --mapMTree,
|
||||||
|
tree2list,
|
||||||
|
|
||||||
|
|
||||||
-- * printing
|
-- * printing
|
||||||
@@ -167,16 +169,16 @@ updateTree (a,b) = Map.insert a b
|
|||||||
|
|
||||||
buildTree :: (Ord a) => [(a,b)] -> BinTree a b
|
buildTree :: (Ord a) => [(a,b)] -> BinTree a b
|
||||||
buildTree = Map.fromList
|
buildTree = Map.fromList
|
||||||
|
{-
|
||||||
sorted2tree :: Ord a => [(a,b)] -> BinTree a b
|
sorted2tree :: Ord a => [(a,b)] -> BinTree a b
|
||||||
sorted2tree = Map.fromAscList
|
sorted2tree = Map.fromAscList
|
||||||
|
-}
|
||||||
mapTree :: ((a,b) -> c) -> BinTree a b -> BinTree a c
|
mapTree :: ((a,b) -> c) -> BinTree a b -> BinTree a c
|
||||||
mapTree f = Map.mapWithKey (\k v -> f (k,v))
|
mapTree f = Map.mapWithKey (\k v -> f (k,v))
|
||||||
|
{-
|
||||||
mapMTree :: (Ord a,Monad m) => ((a,b) -> m c) -> BinTree a b -> m (BinTree a c)
|
mapMTree :: (Ord a,Monad m) => ((a,b) -> m c) -> BinTree a b -> m (BinTree a c)
|
||||||
mapMTree f t = liftM Map.fromList $ sequence [liftM ((,) k) (f (k,x)) | (k,x) <- Map.toList t]
|
mapMTree f t = liftM Map.fromList $ sequence [liftM ((,) k) (f (k,x)) | (k,x) <- Map.toList t]
|
||||||
|
-}
|
||||||
filterBinTree :: Ord a => (a -> b -> Bool) -> BinTree a b -> BinTree a b
|
filterBinTree :: Ord a => (a -> b -> Bool) -> BinTree a b -> BinTree a b
|
||||||
filterBinTree = Map.filterWithKey
|
filterBinTree = Map.filterWithKey
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ pgfMain command (t,pgf) =
|
|||||||
"linearize" -> o =<< doLinearize pgf # tree % to
|
"linearize" -> o =<< doLinearize pgf # tree % to
|
||||||
"linearizeAll" -> o =<< doLinearizes pgf # tree % to
|
"linearizeAll" -> o =<< doLinearizes pgf # tree % to
|
||||||
"linearizeTable" -> o =<< doLinearizeTabular pgf # tree % to
|
"linearizeTable" -> o =<< doLinearizeTabular pgf # tree % to
|
||||||
"random" -> cat >>= \c -> depth >>= \dp -> limit >>= \l -> to >>= \to -> liftIO (doRandom pgf c dp l to) >>= o
|
"random" -> o =<< join (doRandom pgf # cat % depth % limit % to)
|
||||||
"generate" -> o =<< doGenerate pgf # cat % depth % limit % to
|
"generate" -> o =<< doGenerate pgf # cat % depth % limit % to
|
||||||
"translate" -> o =<< doTranslate pgf # input % cat % to % limit %trie
|
"translate" -> o =<< doTranslate pgf # input % cat % to % limit %trie
|
||||||
"translategroup" -> o =<< doTranslateGroup pgf # input % cat % to % limit
|
"translategroup" -> o =<< doTranslateGroup pgf # input % cat % to % limit
|
||||||
@@ -312,10 +312,7 @@ pgfMain command (t,pgf) =
|
|||||||
"grammar" -> o =<< doGrammar pgf # requestAcceptLanguage
|
"grammar" -> o =<< doGrammar pgf # requestAcceptLanguage
|
||||||
"abstrtree" -> outputGraphviz =<< abstrTree pgf # graphvizOptions % tree
|
"abstrtree" -> outputGraphviz =<< abstrTree pgf # graphvizOptions % tree
|
||||||
"alignment" -> outputGraphviz =<< alignment pgf # tree % to
|
"alignment" -> outputGraphviz =<< alignment pgf # tree % to
|
||||||
"parsetree" -> do t <- tree
|
"parsetree" -> outputGraphviz =<< parseTree pgf # from1 % graphvizOptions % tree
|
||||||
Just l <- from
|
|
||||||
opts <- graphvizOptions
|
|
||||||
outputGraphviz (parseTree pgf l opts t)
|
|
||||||
"abstrjson" -> o . jsonExpr =<< tree
|
"abstrjson" -> o . jsonExpr =<< tree
|
||||||
"browse" -> join $ doBrowse pgf # optId % cssClass % href % format "html" % getIncludePrintNames
|
"browse" -> join $ doBrowse pgf # optId % cssClass % href % format "html" % getIncludePrintNames
|
||||||
"external" -> do cmd <- getInput "external"
|
"external" -> do cmd <- getInput "external"
|
||||||
@@ -595,8 +592,9 @@ doLinearizeTabular pgf tree (tos,unlex) = showJSON
|
|||||||
| (ps,ts)<-texts]]
|
| (ps,ts)<-texts]]
|
||||||
| (to,texts) <- linearizeTabular pgf tos tree]
|
| (to,texts) <- linearizeTabular pgf tos tree]
|
||||||
|
|
||||||
doRandom :: PGF -> Maybe PGF.Type -> Maybe Int -> Maybe Int -> To -> IO JSValue
|
doRandom :: PGF -> Maybe PGF.Type -> Maybe Int -> Maybe Int -> To -> CGI JSValue
|
||||||
doRandom pgf mcat mdepth mlimit to =
|
doRandom pgf mcat mdepth mlimit to =
|
||||||
|
liftIO $
|
||||||
do g <- newStdGen
|
do g <- newStdGen
|
||||||
let trees = PGF.generateRandomDepth g pgf cat (Just depth)
|
let trees = PGF.generateRandomDepth g pgf cat (Just depth)
|
||||||
return $ showJSON
|
return $ showJSON
|
||||||
|
|||||||
Reference in New Issue
Block a user