diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,7 @@
+Copyright (c) 2016 Alexander Thiemann
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,5 @@
+# text-utils
+
+[![CircleCI](https://circleci.com/gh/agrafix/text-utils.svg?style=svg)](https://circleci.com/gh/agrafix/text-utils)
+
+Simple text utils
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/package.yaml b/package.yaml
new file mode 100644
--- /dev/null
+++ b/package.yaml
@@ -0,0 +1,34 @@
+name:                text-utils
+version:             0.1.0.0
+synopsis:            Various text utilities
+description:         Please see README.md
+homepage:            https://github.com/agrafix/text-utils#readme
+license:             MIT
+author:              Alexander Thiemann
+maintainer:          mail@athiemann.net
+copyright:           2016 Alexander Thiemann <mail@athiemann.net>
+category:            Web
+extra-source-files:
+  - README.md
+  - package.yaml
+  - stack.yaml
+
+dependencies:
+  - base >= 4.7 && < 5
+  - text
+
+library:
+  source-dirs: src
+  exposed-modules:
+    - Data.Text.KGrams
+    - Data.Text.ToFromText
+
+tests:
+  spec:
+    cpp-options: -DTest
+    main: Test.hs
+    source-dirs:
+      - test
+      - src
+    dependencies:
+      - HTF
diff --git a/src/Data/Text/KGrams.hs b/src/Data/Text/KGrams.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/Text/KGrams.hs
@@ -0,0 +1,20 @@
+module Data.Text.KGrams where
+
+import qualified Data.Text as T
+
+textRemovePunc :: T.Text -> T.Text
+textRemovePunc = T.map (\ch -> if ch `elem` ".?!-;\'\"" then ' ' else ch)
+
+textNormalizedWords :: T.Text -> [T.Text]
+textNormalizedWords = filter (not . T.null) . T.words . T.toLower . textRemovePunc
+
+textKGrams :: Int -> T.Text -> [T.Text]
+textKGrams size = concatMap (kgrams size) . textNormalizedWords
+
+kgrams :: Int -> T.Text -> [T.Text]
+kgrams size inp =
+    let loop txt =
+            if T.length txt < size
+            then []
+            else T.take size txt : loop (T.drop 1 txt)
+    in loop inp
diff --git a/src/Data/Text/ToFromText.hs b/src/Data/Text/ToFromText.hs
new file mode 100644
--- /dev/null
+++ b/src/Data/Text/ToFromText.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE DefaultSignatures #-}
+{-# LANGUAGE TypeSynonymInstances #-}
+{-# LANGUAGE FlexibleInstances #-}
+module Data.Text.ToFromText where
+
+import qualified Data.Text as T
+
+class ToFromText a where
+    toText :: a -> T.Text
+    fromText :: Monad m => T.Text -> m a
+
+    default fromText :: (Enum a, Bounded a, Monad m) => T.Text -> m a
+    fromText = fromTextHelper toText
+
+instance ToFromText T.Text where
+    toText = id
+    fromText = pure
+
+instance ToFromText String where
+    toText = T.pack
+    fromText = pure . T.unpack
+
+fromTextHelper :: (Enum a, Bounded a, Monad m) => (a -> T.Text) -> T.Text -> m a
+fromTextHelper mkT q =
+    loop [minBound .. maxBound]
+    where
+      loop [] = fail ("Could not read " ++ show q)
+      loop (x : xs) =
+          if mkT x == q then pure x else loop xs
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1,5 @@
+resolver: lts-7.9
+packages:
+  - .
+extra-deps:
+  - aeson-1.0.2.1
diff --git a/test/Data/Text/KGramsTest.hs b/test/Data/Text/KGramsTest.hs
new file mode 100644
--- /dev/null
+++ b/test/Data/Text/KGramsTest.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_GHC -F -pgmF htfpp #-}
+module Data.Text.KGramsTest where
+
+import Data.Text.KGrams
+
+import Test.Framework
+
+test_removePunc :: IO ()
+test_removePunc =
+    do assertEqual "hallo" (textRemovePunc "hallo")
+       assertEqual "hallo welt" (textRemovePunc "hallo-welt")
+       assertEqual "hallo welt " (textRemovePunc "hallo.welt!")
+
+test_normalizedWords :: IO ()
+test_normalizedWords =
+    do assertEqual ["hallo"] (textNormalizedWords "hallo")
+       assertEqual ["hallo", "welt"] (textNormalizedWords "!hallo WeLt  ")
+       assertEqual ["foo", "bar"] (textNormalizedWords "foo-bar")
+       assertEqual ["foo", "bar"] (textNormalizedWords "Foo- bar")
+       assertEqual ["foo", "bar"] (textNormalizedWords "Foo.- bar")
+
+test_kgrams :: IO ()
+test_kgrams =
+    do assertEqual ["foo"] (kgrams 3 "foo")
+       assertEqual ["fo", "oo"] (kgrams 2 "foo")
+       assertEqual ["f", "o", "o"] (kgrams 1 "foo")
+       assertEqual [] (kgrams 3 "fo")
+
+test_textKGrams :: IO ()
+test_textKGrams =
+    do assertEqual ["foo"] (textKGrams 3 "foo")
+       assertEqual ["hal", "all", "llo", "wel", "elt"] (textKGrams 3 "Hallo-Welt")
+       assertEqual ["thi", "hie", "iem", "ema", "man", "ann"] (textKGrams 3 "Thiemann")
diff --git a/test/Data/Text/ToFromTextTest.hs b/test/Data/Text/ToFromTextTest.hs
new file mode 100644
--- /dev/null
+++ b/test/Data/Text/ToFromTextTest.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# OPTIONS_GHC -F -pgmF htfpp #-}
+module Data.Text.ToFromTextTest where
+
+import Data.Text.ToFromText
+
+import Test.Framework
+
+data SomeEnum
+    = SomeEnumA
+    | SomeEnumB
+    | SomeEnumC
+    deriving (Show, Eq, Enum, Bounded)
+
+instance ToFromText SomeEnum where
+    toText e =
+        case e of
+          SomeEnumA -> "A"
+          SomeEnumB -> "B"
+          SomeEnumC -> "C"
+
+test_autoFromText :: IO ()
+test_autoFromText =
+    do assertEqual (Just SomeEnumA) (fromText "A")
+       assertEqual (Just SomeEnumB) (fromText "B")
+       assertEqual (Just SomeEnumC) (fromText "C")
+       assertEqual (Nothing :: Maybe SomeEnum) (fromText "asdasdasd")
diff --git a/test/Test.hs b/test/Test.hs
new file mode 100644
--- /dev/null
+++ b/test/Test.hs
@@ -0,0 +1,10 @@
+{-# OPTIONS_GHC -F -pgmF htfpp #-}
+module Main where
+
+import Test.Framework
+import {-@ HTF_TESTS @-} Data.Text.KGramsTest
+import {-@ HTF_TESTS @-} Data.Text.ToFromTextTest
+
+main :: IO ()
+main =
+    htfMain htf_importedTests
diff --git a/text-utils.cabal b/text-utils.cabal
new file mode 100644
--- /dev/null
+++ b/text-utils.cabal
@@ -0,0 +1,53 @@
+-- This file has been generated from package.yaml by hpack version 0.14.0.
+--
+-- see: https://github.com/sol/hpack
+
+name:           text-utils
+version:        0.1.0.0
+synopsis:       Various text utilities
+description:    Please see README.md
+category:       Web
+homepage:       https://github.com/agrafix/text-utils#readme
+author:         Alexander Thiemann
+maintainer:     mail@athiemann.net
+copyright:      2016 Alexander Thiemann <mail@athiemann.net>
+license:        MIT
+license-file:   LICENSE
+build-type:     Simple
+cabal-version:  >= 1.10
+
+extra-source-files:
+    package.yaml
+    README.md
+    stack.yaml
+
+library
+  hs-source-dirs:
+      src
+  build-depends:
+      base >= 4.7 && < 5
+    , text
+  exposed-modules:
+      Data.Text.KGrams
+      Data.Text.ToFromText
+  other-modules:
+      Paths_text_utils
+  default-language: Haskell2010
+
+test-suite spec
+  type: exitcode-stdio-1.0
+  main-is: Test.hs
+  hs-source-dirs:
+      test
+    , src
+  cpp-options: -DTest
+  build-depends:
+      base >= 4.7 && < 5
+    , text
+    , HTF
+  other-modules:
+      Data.Text.KGramsTest
+      Data.Text.ToFromTextTest
+      Data.Text.KGrams
+      Data.Text.ToFromText
+  default-language: Haskell2010
