summaryrefslogtreecommitdiff
path: root/src/GF/Data/Glue.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Data/Glue.hs')
-rw-r--r--src/GF/Data/Glue.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/GF/Data/Glue.hs b/src/GF/Data/Glue.hs
new file mode 100644
index 000000000..247224075
--- /dev/null
+++ b/src/GF/Data/Glue.hs
@@ -0,0 +1,19 @@
+module Glue where
+
+import Trie
+import Operations
+import List
+
+-------- AR 8/11/2003, using Markus Forsberg's implementation of Huet's unglue
+
+tcompileSimple :: [String] -> Trie
+tcompileSimple ss = tcompile [(s,[(atWP,s)]) | s <- ss]
+
+decomposeSimple :: Trie -> String -> Err [String]
+decomposeSimple t s = do
+ let ss = map (decompose t) $ words s
+ if any null ss
+ then Bad "unknown word in input"
+ else return $ concat [intersperse "&+" ws | ws <- ss]
+
+exTrie = tcompileSimple $ words "ett två tre tjugo trettio hundra tusen"