1
0
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:
John J. Camilleri
2021-02-02 21:46:38 +01:00
parent c94bffe435
commit d09838e97e
6 changed files with 44 additions and 41 deletions

View 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

View File

@@ -1,29 +1,5 @@
Foods: Pred (This Pizza) (Very Boring)
FoodsEng: this pizza is very boring
Foods: Pred (That Pizza) Delicious
FoodsEng: that pizza is delicious
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
Pred (That Wine) Delicious
Pred (This Pizza) (Very Boring)
Pred (This Cheese) Fresh
Pred (Those Fish) Warm
Pred (That (Mod Boring (Mod Italian Pizza))) Expensive

View 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

View File

@@ -1,11 +1,3 @@
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
Pred John Walk
Pred We Walk
And (Pred John Walk) (Pred We Walk)

10
testsuite/lpgf/mkTreebank.sh Executable file
View 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)"

View File

@@ -34,7 +34,7 @@ doGrammar gname = do
lpgf <- readLPGF $ gname ++ ".lpgf"
-- Read treebank
gs <- groups . lines <$> readFile (dir </> gname <.> "trees")
gs <- groups . lines <$> readFile (dir </> gname <.> "treebank")
forM_ gs $ \grp -> do
let ast = drop 2 $ dropWhile (/=':') $ head grp
printf "%s: %s\n" gname ast