diff options
| author | aarne <aarne@chalmers.se> | 2009-11-11 20:34:09 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2009-11-11 20:34:09 +0000 |
| commit | 6898667b3e34773fb9e98819461f7a46462b1926 (patch) | |
| tree | 4abbd068adc11343ea135a9b2b38bee5c39074be /src | |
| parent | 2a22325678bac22d16ece1c357e9a9858dc66897 (diff) | |
questions, relatives, numerals - most of Dutch syntax soon in place
Diffstat (limited to 'src')
| -rw-r--r-- | src/PGF/VisualizeTree.hs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/PGF/VisualizeTree.hs b/src/PGF/VisualizeTree.hs index bd419e14f..857c1b08d 100644 --- a/src/PGF/VisualizeTree.hs +++ b/src/PGF/VisualizeTree.hs @@ -244,6 +244,36 @@ lin2graph ss = trace (show ss) $ prelude ++ nodes ++ links edge i v w = struct i ++ ":" ++ mark v ++ ":e -> " ++ struct (i+1) ++ ":" ++ mark w ++ ":w ;" +{- +alignmentData :: PGF -> [Expr] -> Map.Map String (Map.Map String Double) +alignmentData pgf = mkStat . concatMap (mkAlign . linsMark) where + linsMark t = + [s | la <- take 2 (cncnames pgf), s <- take 1 (linearizesMark pgf la t)] + + mkStat :: [(String,String)] -> Map.Map String (Map.Map String Double) + mkStat = + + mkAlign :: [String] -> [(String,String)] + mkAlign ss = + + nlins :: [(Int,[((Int,String),String)])] + nlins = [(i, [((j,showp p),unw ws) | (j,((_,p),ws)) <- zip [0..] vs]) | + (i,vs) <- zip [0..] (map (wlins . readPosText) ss)] + + nodes = map mkStruct nlins + + mkStruct (i, ws) = struct i ++ "[label = \"" ++ fields ws ++ "\"] ;" + + fields ws = concat (intersperse "|" [tag (mark m) ++ " " ++ w | (m,w) <- ws]) + + links = nub $ concatMap mkEdge (init nlins) + + mkEdge (i,lin) = let lin' = snd (nlins !! (i+1)) in -- next lin in the list + [edge i v w | (v@(_,p),_) <- lin, (w@(_,q),_) <- lin', p == q] + + edge i v w = + struct i ++ ":" ++ mark v ++ ":e -> " ++ struct (i+1) ++ ":" ++ mark w ++ ":w ;" +-} wlins :: PosText -> [((Maybe CId,[Int]),[String])] wlins pt = case pt of |
