forked from GitHub/gf-core
Separate .trees and .treebank, and add a script for making the latter from the former
This commit is contained in:
14
testsuite/lpgf/Foods.treebank
Normal file
14
testsuite/lpgf/Foods.treebank
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
Foods: Pred (That Wine) Delicious
|
||||||
|
FoodsEng: that wine is delicious
|
||||||
|
|
||||||
|
Foods: Pred (This Pizza) (Very Boring)
|
||||||
|
FoodsEng: this pizza is very boring
|
||||||
|
|
||||||
|
Foods: Pred (This Cheese) Fresh
|
||||||
|
FoodsEng: this cheese is fresh
|
||||||
|
|
||||||
|
Foods: Pred (Those Fish) Warm
|
||||||
|
FoodsEng: those fish are warm
|
||||||
|
|
||||||
|
Foods: Pred (That (Mod Boring (Mod Italian Pizza))) Expensive
|
||||||
|
FoodsEng: that boring Italian pizza is expensive
|
||||||
@@ -1,29 +1,5 @@
|
|||||||
Foods: Pred (This Pizza) (Very Boring)
|
Pred (That Wine) Delicious
|
||||||
FoodsEng: this pizza is very boring
|
Pred (This Pizza) (Very Boring)
|
||||||
|
Pred (This Cheese) Fresh
|
||||||
Foods: Pred (That Pizza) Delicious
|
Pred (Those Fish) Warm
|
||||||
FoodsEng: that pizza is delicious
|
Pred (That (Mod Boring (Mod Italian Pizza))) Expensive
|
||||||
|
|
||||||
Foods: Pred (That Wine) Boring
|
|
||||||
FoodsEng: that wine is boring
|
|
||||||
|
|
||||||
Foods: Pred (This Cheese) Fresh
|
|
||||||
FoodsEng: this cheese is fresh
|
|
||||||
|
|
||||||
Foods: Pred (Those Fish) Boring
|
|
||||||
FoodsEng: those fish are boring
|
|
||||||
|
|
||||||
Foods: Pred (This Cheese) Warm
|
|
||||||
FoodsEng: this cheese is warm
|
|
||||||
|
|
||||||
Foods: Pred (That (Mod Boring (Mod Italian Pizza))) Italian
|
|
||||||
FoodsEng: that boring Italian pizza is Italian
|
|
||||||
|
|
||||||
Foods: Pred (Those Cheese) Expensive
|
|
||||||
FoodsEng: those cheeses are expensive
|
|
||||||
|
|
||||||
Foods: Pred (Those Wine) Italian
|
|
||||||
FoodsEng: those wines are Italian
|
|
||||||
|
|
||||||
Foods: Pred (This Wine) Boring
|
|
||||||
FoodsEng: this wine is boring
|
|
||||||
|
|||||||
11
testsuite/lpgf/Walking.treebank
Normal file
11
testsuite/lpgf/Walking.treebank
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Walking: Pred John Walk
|
||||||
|
WalkingEng: John walks
|
||||||
|
WalkingGer: John geht
|
||||||
|
|
||||||
|
Walking: Pred We Walk
|
||||||
|
WalkingEng: we walk
|
||||||
|
WalkingGer: wir gehen
|
||||||
|
|
||||||
|
Walking: And (Pred John Walk) (Pred We Walk)
|
||||||
|
WalkingEng: John walks and we walk
|
||||||
|
WalkingGer: John geht und wir gehen
|
||||||
@@ -1,11 +1,3 @@
|
|||||||
Walking: Pred John Walk
|
Pred John Walk
|
||||||
WalkingEng: John walks
|
Pred We Walk
|
||||||
WalkingGer: John geht
|
And (Pred John Walk) (Pred We Walk)
|
||||||
|
|
||||||
Walking: Pred We Walk
|
|
||||||
WalkingEng: we walk
|
|
||||||
WalkingGer: wir gehen
|
|
||||||
|
|
||||||
Walking: And (Pred John Walk) (Pred We Walk)
|
|
||||||
WalkingEng: John walks and we walk
|
|
||||||
WalkingGer: John geht und wir gehen
|
|
||||||
|
|||||||
10
testsuite/lpgf/mkTreebank.sh
Executable file
10
testsuite/lpgf/mkTreebank.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "Must specify trees file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
ABSNAME="${1%.*}"
|
||||||
|
echo "read_file -file=$1 -lines -tree | linearize -treebank | write_file -file=$ABSNAME.treebank" | gf --run $ABSNAME*.gf
|
||||||
|
echo "Wrote $ABSNAME.treebank"
|
||||||
|
echo "(you will have to add newlines separating the trees manually)"
|
||||||
@@ -34,7 +34,7 @@ doGrammar gname = do
|
|||||||
lpgf <- readLPGF $ gname ++ ".lpgf"
|
lpgf <- readLPGF $ gname ++ ".lpgf"
|
||||||
|
|
||||||
-- Read treebank
|
-- Read treebank
|
||||||
gs <- groups . lines <$> readFile (dir </> gname <.> "trees")
|
gs <- groups . lines <$> readFile (dir </> gname <.> "treebank")
|
||||||
forM_ gs $ \grp -> do
|
forM_ gs $ \grp -> do
|
||||||
let ast = drop 2 $ dropWhile (/=':') $ head grp
|
let ast = drop 2 $ dropWhile (/=':') $ head grp
|
||||||
printf "%s: %s\n" gname ast
|
printf "%s: %s\n" gname ast
|
||||||
|
|||||||
Reference in New Issue
Block a user