owoify-hs: Turn any English text into nonsensical babyspeaks.

[ library, mit, text ] [ Propose Tags ]
Versions [RSS] 1.0.0.0, 1.0.0.1, 1.1.0.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), random (>=1.2.0 && <1.3), regex (==1.1.0.0), regex-with-pcre (==1.1.0.0), text (>=1.2.4 && <1.3) [details]
License MIT
Copyright 2021 Chehui Chou
Author Chehui Chou
Maintainer tetsuki.syu1315@gmail.com
Category Text
Home page https://github.com/deadshot465/owoify-hs#readme
Bug tracker https://github.com/deadshot465/owoify-hs/issues
Source repo head: git clone https://github.com/deadshot465/owoify-hs
Uploaded by tetsuki_syu1315 at 2021-10-17T19:01:53Z
Distributions
Downloads 189 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for owoify-hs-1.0.0.1

[back to package description]

owoify-hs

Turning your worst nightmare into a Haskell package.

Haskell CI

This is a Haskell port of mohan-cao's owoify-js, which will help you turn any string into nonsensical babyspeak similar to LeafySweet's infamous Chrome extension.

Just like my other Owoify ports, three levels of owoness are available. Each level has been implemented using a discriminated union, so it should work like enums people are used to seeing in other imperative languages.

  1. owo (default): The most vanilla one.
  2. uwu: The moderate one.
  3. uvu: Litewawwy unweadabwal. Please refer to the original owoify-js repository for more information.

Functional programming is fun, so of course I'll port it to FP languages. 😜

Also I love Haskell. ❤️

Reason for development

Because I love Haskell and currently Hackage doesn't have any owoify package yet. Also PureScript is influenced by Haskell and they have nearly the same syntax, so it doesn't make sense to have a PureScript port while not having a Haskell port.

The difference is that owoify-hs makes use of Haskell's lazy evaluation. Data.Text.Lazy is used instead of Data.Text. This possibly solved stack overflow problem with purescript-owoify when owoifying very long texts (i.e. chapter 1-20 of Tolstoy's War and Peace). The reason for using Data.Text.Lazy.Text instead of the good old String is because Data.Text.Lazy.Text and the eager version Data.Text.Text are meant for handling Unicode texts.

Having said that, you would need to do Data.Text.Lazy.pack <text> before passing the text to the owoify function.

Install instructions

Add owoify-hs to your package.yaml in your Stack project:

dependencies:
- owoify-hs == 1.0.0.1

If you are using Cabal, add the package the usual way.

cabal install owoify-hs

Usage

owoify-hs is implemented as a single function. You will need to provide a source string and a owoify level. Due to random number generator and regular expressions, the result will be inside IO monad, so you will also need to handle that.

module MyAwesomeModule where

import Prelude

import Data.Owoify.Owoify (OwoifyLevel(..), owoify)
import Data.Text.Lazy (pack, unpack)

main :: IO ()
main = do
  owoResult <- owoify (pack "This is the string to owo! Kinda cute, isn't it?") Owo
  uvuResult <- owoify (pack "This is the string to owo! Kinda cute, isn't it?") Uvu
  -- `print` won't print out Unicode emojis correctly.
  putStrLn $ unpack owoResult
  putStrLn $ unpack uvuResult

-- Possible outputs:
-- This is teh stwing two owo! Kinda cute, isn't it?
-- fwis is teh stwing two owowouvu Kinda cuteowo isn't it?

Disclaimer

As usual, I'm writing this package for both practicing and bots' needs. Performance is NOT guaranteed.

That being said, Data.Text.Lazy is used, so it should be able to handle both short texts and long texts without any problem.

See also

  • owoify-js - The original owoify-js repository.
  • Owoify.Net - The C# port of Owoify written by me.
  • Owoify++ - The C++ header-only port of Owoify written by me.
  • owoify_rs - The Rust port of Owoify written by me.
  • owoify-py - The Python port of Owoify written by me.
  • owoify_dart - The Dart port of Owoify written by me.
  • owoify_rb - The Ruby port of Owoify written by me.
  • owoify-go - The Go port of Owoify written by me.
  • owoifySwift - The Swift port of Owoify written by me.
  • owoifyKt - The Kotlin port of Owoify written by me.
  • owoify_ex - The Elixir port of Owoify written by me.
  • owoify_cr - The Crystal port of Owoify written by me.
  • owoifynim - The Nim port of Owoify written by me.
  • owoify-clj - The Clojure port of Owoify written by me.
  • purescript-owoify - The PureScript port of Owoify written by me.

License

MIT License

Copyright (c) 2021 Chehui Chou

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.