This app generates startup names from Hacker News so your company can totally crush it - Technical.ly Philly

Dev

Oct. 16, 2018 8:21 am

This app generates startup names from Hacker News so your company can totally crush it

Act now and PipeWhy, VoiceTwo and ShareShare could be yours! Vicki Boykis explains how she made the tool in this installment of Code Annotated.

Pick a name, any name.

(Technical.ly file photo)

This is a guest post by Vicki Boykis, a senior data scientist at CapTech Ventures.

This is part of an occasional Technical.ly series called Code Annotated, in which we ask local technologists what they’re developing. Got something you’re working on? Get in touch: philly@technical.ly.


If you keep up with the tech industry, chances are you read Hacker News, a news aggregation site run by Y Combinator, a seed accelerator in California that has funded popular startups like Airbnb and Dropbox.

Hacker News is great in that the stories listed and discussed make up the zeitgeist of the tech industry, and its simple layout and API make it easy to scrape data. As a data scientist who loves to scrape data and someone who is extremely skeptical of the startup hype and loves to gently poke fun at the tech industry, Hacker News is catnip to me.

I’ve previously made a Markov chain generator for Hacker News headlines, and recently decided to take it a step further: Why not generate startup names from the latest, hottest news items?

There are a lot of blog posts of how to generate random names with neural networks, but it turns out we don’t need anything nearly as complicated: all we need is Python and a little bit of elbow grease.

What this code snippet does is pull a given number of headlines trending on Hacker News right now (I picked 50 so it wouldn’t hit the API too hard), strips out the proper nouns (i.e. all the words that are capitalized — the assumption is that these will mostly be startup names, although there are some actual proper nouns thrown in), and if they have more than one syllable, takes those syllables into a common pool of syllables to draw from. Then, it picks two syllables at random to generate a startup name.

The code works like this: It uses the hackernews unofficial Python library to pull in the Hacker News front page as an object. We use hn.top_stories(limit=50) to access the top stories, split each word that is mixed case (proper nouns) into syllables, and pull all of those into a list that we then pick two random syllables from. If you’re interested in some of the concepts drawn from here, check out Python list comprehensions, which are doing the heavy lifting.

Advertisement

# Import Python HN API and Pyphen
from hackernews import HackerNews
import pyphen
import random
from itertools import chain

# Generate dictionary
dic = pyphen.Pyphen(lang='en')

# Generate HN
hn = HackerNews()

# Get top 50 Stories
top_stories = hn.top_stories(limit=50)

# Get individual words in titles
words = [title for story in top_stories for title in story.title.strip("'").strip(",").split(' ')]

# Get syllables per word
syllables = [syllable for word in words if not word.islower() and not word.isupper() for syllable in dic.inserted(word).split("-") ]

# Generate mixed list of syllables
mixed_bag = [syllable for syllable in syllables if len(syllables) > 1]

print("***Congrats on your new startup:***")
print(f"{random.choice(mixed_bag).upper()}{random.choice(mixed_bag).upper()}")

Here are some fun results I’ve generated recently:

***Congrats on your new startup:***
BIPRODI

***Congrats on your new startup:***
PIPEWHY

***Congrats on your new startup:***
VOICETWO

***Congrats on your new startup:***
SHARESHARE

To run the script, save it as [yourfilenameofchoice.py] on your computer and run python yourfilenameofchoice.py. (You’ll need to make sure you have all the libraries in the import statement installed.)

Or you can click the link below. I made a (super basic) web app so people can try it out for themselves.

Hack Ur Name

Go forth and hustle!

-30-
JOIN THE COMMUNITY, BECOME A MEMBER
Already a member? Sign in here

Advertisement

How this analog experience cements Deacom’s culture

That snow storm sent SEPTA trains to new ‘Turbo F*cked’ status

Thinking of starting a business? This founder wants you to be real about how hard it can be

SPONSORED

Philly

Find entrepreneurial ‘collaboration and collision’ at 1776 at Ambler Yards

Chesterbrook, PA

Deacom

Junior Software Developer

Apply Now
Conshohocken, Pa

ShopRunner

Data Engineer

Apply Now
Chesterbrook, PA

Deacom

IT Specialist

Apply Now

How can employers improve the job hunt? ‘Please just have some goddamn empathy’

3 reasons why you don’t want to miss the 2018 Timmy Awards

CS4Philly needs your help getting computer science into Philly schools

SPONSORED

Philly

How UArts’ JavaScript certificate program helped this developer successfully change careers

Malvern, PA

Vanguard

Sr. Full Stack Developer-Client Experience Lab

Apply Now
Malvern, PA

Vanguard

Product Owner of Data Science Solutions

Apply Now
Malvern, PA

Vanguard

Java Developer-Entry

Apply Now

Sign-up for daily news updates from Technical.ly Philadelphia

Do NOT follow this link or you will be banned from the site!