npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hulkify

v0.0.9

Published

Turn normal English into HULK-SPEAK

Downloads

3

Readme

HULKIFY

Turns normal English into HULK-SPEAK!

This is a combined Python/JavaScript package -- it should be easily usable by either language, with the other language's files just appearing as cruft. At the moment, all the logic is duplicated. Could this be unified through some kind of clever cross-language regex engine? PERHAPS! But I am not really interested in making such a thing. (I already have the aphoristic "two problems," and I have a feeling trying to generalize regex logic would lead to many more than two.)

BUT YOU ARE NOT HERE TO HEAR ABOUT PROGRAMMING CONUNDRA! You are here to turn plain English into something that might be said by the Hulk.

Both implementations follow the same basic algorithm:

  1. Change contractions to a designated main word. ("can't" -> "not")
  2. Drop all linking verbs. ("am," "to be," etc.)
  3. Remove articles. ("a," "an," and "the")
  4. Replace all personal pronouns ("I"/"me"/"I've"/"I'm"/etc.) with "Hulk."
  5. Change verbs to present tense.
  6. Replace any diminutive adjective with "puny."
  7. Exclamation points.
  8. If the word "strong" is present, add, "Hulk is the strongest there is!"
  9. Convert the whole thing to uppercase.

(Note: I would also like to make it change the occasional verb to "smash," but it's not clear how to select those verbs properly. Needs to only be particularly active or violent verbs, but I haven't found any linguistic databases with attributes like that.)

You can also specify a maximum character length for the returned Hulk string (for example, 140), and it will be smart about what it appends.

There is some randomness involved in the exclamation marks, so the output is not always the same.

Important note: Presently, the Python version tends to produce better results than the JavaScript one. So far as I can tell, the grammatical library I'm using with Python (pattern.en) is better at figuring out correct semantics and conjugations than the two JavaScript libraries I'm using (pos and nlp_compromise). I'd love to get them into parity, but JavaScript isn't my usual rowboat, so I don't know how best to explore. If you have thoughts, please open a pull request! :D

Also note that it's been developed and tested with only bite-sized text; my eyes were towards a particularly popular microblogging service and producing text for it. It might work with larger texts? Might not? If it seems to break, try doing smaller chunks at a time. Or not. Just consider this an admonition.

Installation

Python

Hulkify is available in PyPI.

$ pip install hulkify

Node.js

Hulkify is available in npm.

$ npm install hulkify

Example Code

Python

from hulkify import hulkify

bannerText = "Hello, I'm very happy to be seeing you all. It's a small wonder that I survived."

print hulkify(bannerText)

output: HELLO, HULK VERY HAPPY TO SEE YOU ALL! IT PUNY WONDER THAT HULK SURVIVED!!!

Node.js

// (for Node.js; presently Hulkify won't work in the browser)
var hulkify = require('hulkify');

var bannerText = 'You are very kind to try and educate me as to the perils of smoking, but I\'m content to risk it. "Health" is a relative matter.';

console.log(hulkify(bannerText));

output: YOU VERY KIND TO TRY AND EDUCATE HULK AS TO PERILS OF SMOKING, BUT HULK CONTENT TO RISK IT!! "HEALTH" RELATIVE MATTER!