From a57f1469efff3e70398ef7f351bf43853194f418 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 21 Aug 2020 09:21:53 -0400 Subject: fix(owothia): Use correct articles I'm an owothia, owo Change-Id: I59d523268851e792067e10d440147d12409c60f5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1833 Tested-by: BuildkiteCI Reviewed-by: eta --- users/glittershark/owothia/src/Main.hs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'users/glittershark/owothia/src') 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 -- cgit 1.4.1