about summary refs log tree commit diff
path: root/users/glittershark/owothia/src
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-08-21T13·21-0400
committerglittershark <grfn@gws.fyi>2020-08-24T15·11+0000
commita57f1469efff3e70398ef7f351bf43853194f418 (patch)
tree82c4b70ef877c378efbf65206c347276f186d48c /users/glittershark/owothia/src
parent35b214ae9f8f4eaf4e3f0fd22165184f05e219fe (diff)
fix(owothia): Use correct articles r/1709
I'm an owothia, owo

Change-Id: I59d523268851e792067e10d440147d12409c60f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1833
Tested-by: BuildkiteCI
Reviewed-by: eta <eta@theta.eu.org>
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