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

korean-random-words

v1.0.3

Published

A simple, lightweight random word string generator in Korean

Downloads

52

Readme

TLDR: I needed a quick not-so-boring random generator with several million combinations.

  • 🌏 View README in... korean-badge | korean-badge

📃 Overview

korean-random-words generates a 3-word phrase in the general form of [adjective][suffix]-[adjective]한-[noun] , such as 뾰족하고-용감한-선인장. Using default properties, the randomly generated phrase with the form above will be one of 256^3 * 5 = 83,886,080 possible phrases, with (currently) 256 nouns, 256 adjectives, and 5 variations of the suffix for the first adjective.

As a disclaimer, the package is not designed with cryptographycally secure randomness in mind.


✨ Demo

Coming Soon


💾 Install

npm install korean-random-words # npm
yarn add korean-random-words # yarn

🧠 Usage

// ES6
import PhraseGen from 'korean-random-words';
const phraseGen = new PhraseGen();

// Node
var PhraseGen = require('korean-random-words');
var phraseGen = new PhraseGen();

phraseGen.generatePhrase(); // '유식하고-말랑한-해삼'

constructor

The constructor takes an object with 4 optional properties:

  • adjSuffix: string - customizable suffix for the first adjective.
    • default: '하고' | '하지만' | '한데' | '해도' | '해서' and is randomized upon each call.
    • example: { adjSuffix: '헸어도' } //would create '무심했어도-착한-오소리'
  • delimiter: string - overrides default delimiter to the provided string(conventionally a character)
    • default: '-'
    • example: { delimiter: '__' } // would create '진지하고__굉장한__감자'
  • customNouns: [string] - custom set of nouns to randomize the phrase from
    • default: a word bank of common nouns
    • example: { customNouns: ['키보드','마우스','웹캠','모니터'] }
  • customAdjectives: [string] - custom set of adjectives to randomize the phrase from
    • default: a word bank of common adjectives
    • *The form of adjectives should be words that are compatible with the form of -하다 without the suffix, in order to keep the phrase gramatically accurate, as shown in the example below:
    • example: { customNouns: ['당당','소심','건들건들','위대'] }

Below are some examples of constructing the phrase generator:

import PhraseGen from 'korean-random-words';

// default constructor
const phraseGen = new PhraseGen();
phraseGen.generatePhrase(); // '유식하고-말랑한-해삼'

// partial object
const phraseGen = new PhraseGen({
  delimiter: '__',
  adjSuffix: '했어도'
});
phraseGen.generatePhrase(); // '유식했어도__말랑한__해삼'

// pass in configuration
const phraseGenConfig = {
  customNouns: ['키보드','마우스','웹캠','모니터'],
  customAdjectives: ['당당','소심','건들건들','위대'],
  delimiter: '__',
  adjSuffix: '했어도'
};
const phraseGen = new PhraseGen(phraseGenConfig);
phraseGen.generatePhrase(); // '소심했어도__위대한__모니터'

generatePhrase: string

  • returns a generated phrase with the supplied configurations
const phraseGenConfig = { /* optional configs */ }
const phraseGen = new PhraseGen(phraseGenConfig);
phraseGen.generatePhrase(); // '소심했어도__위대한__모니터'

getNoun: string

  • returns a random noun, either from the default noun bank or the supplied list of custom nouns
const phraseGen = new PhraseGen();
phraseGen.getNoun(); // 고슴도치 | 땅콩 | 오이, ...

const customPhraseGen = new PhraseGen({ customNouns: ['보라돌이', '뚜비', '나나', '뽀'] });
phraseGen.getNoun(); // 보라돌이 | 뚜비 | 나나 | 뽀

getAdjective: string

getAdjective() takes one optional parameter:

  • suffix: string - optional override on the suffix for the adjective
    • default: '하다'
  • returns a random adjective in the form of [adjective][suffix] // ex) '예리하다'
const phraseGen = new PhraseGen();
phraseGen.getAdjective(); // 당당하다, 굉장하다, 대단하다
phraseGen.getAdjective("해요"); // 당당해요, 굉장해요, 대단해요

const customPhraseGen = new PhraseGen({ customAdjectives: ['발그레','누리끼리','거무스름'] });
phraseGen.getAdjective(); // 발그레하다 | 누리끼리하다 | 거무스름하다

set

used to reconfigure one or more properties of the phrase generator object. Takes in one Object as parameter with optional properties as below:

  • adjSuffix: string - customizable suffix for the first adjective.

    • example: { adjSuffix: '헸어도' } //would create '무심했어도-착한-오소리'
  • delimiter: string - overrides default delimiter to the provided string(conventionally a character)

    • example: { delimiter: '__' } // would create '진지하고__굉장한__감자'
  • nouns: [string] - custom set of nouns to randomize the phrase from

    • example: { customNouns: ['키보드','마우스','웹캠','모니터'] }
  • adjectives: [string] - custom set of adjectives to randomize the phrase from

    • *The form of adjectives should be words that are compatible with the form of -하다 without the suffix, in order to keep the phrase gramatically accurate, as shown in the example below:

    • example: { customNouns: ['당당','소심','건들건들','위대'] }

const phraseGen = new PhraseGen();
phraseGen.generatePhrase(); // 적합하고-진지한-상추

// Valid #1
phraseGen.set({ delimiter: '__' , adjSuffix: '하지만'});
phraseGen.generatePhrase(); // 단단하지만__상냥한__호두

// Valid #2
const config = {
  adjSuffix: '하지만',
  nouns: ['개발자', '매니저', '디자이너'],
  adjectives: ['부지런','성실','나태','유능'],
  delimiter: '..'
};
phraseGen.set(config);
phraseGen.generatePhrase(); // 나태하지만..유능한..디자이너

// Invalid #1
phraseGen.set('string'); // Must be an object

// Invalid #2
phraseGen.set({ randomProp: 'random' , adjSuffix: '하지만'}); // Error -- cannot contain foreign property

🧑🏻‍💻 Author

👤 Ju An Kang


☕️ Brain fluid


⭐️ Share support

If you find this useful or fun, ⭐️ this project!


📝 License

Copyright © 2021 Ju An Kang. This project is Apache--2.0 licensed.