about summary refs log tree commit diff
path: root/users/glittershark/owothia/src
diff options
context:
space:
mode:
Diffstat (limited to 'users/glittershark/owothia/src')
-rw-r--r--users/glittershark/owothia/src/Main.hs20
1 files changed, 16 insertions, 4 deletions
diff --git a/users/glittershark/owothia/src/Main.hs b/users/glittershark/owothia/src/Main.hs
index 6c954b7c3f72..65578f258c1a 100644
--- a/users/glittershark/owothia/src/Main.hs
+++ b/users/glittershark/owothia/src/Main.hs
@@ -85,11 +85,23 @@ instance Random OwoType where
   random = over _1 (bool Noun Verb) . random
   randomR = const random
 
+vowels :: [Char]
+vowels = "aeiou"
+
+article :: Text -> Text
+article (x :< _) | x `elem` vowels = "an"
+article _ = "a"
+
 owo :: OwoType -> Text -> Text
-owo Noun n =
-          if "o" `Data.Text.isSuffixOf` n
-          then "I'm a " <> n <> "wo"
-          else "I'm a " <> n <> " owo"
+owo Noun n = mconcat
+  [ "I'm "
+  , article n
+  , " "
+  , n
+  , if "o" `Data.Text.isSuffixOf` n
+    then "wo"
+    else " owo"
+  ]
 owo Verb v = v <> " me owo"
 
 pickOwo :: OwoType -> POS Tag -> Maybe Text