nehing_generator

pub package License: MIT CI

🎲 의미 μ—†λŠ” 랜덀 ν•œκΈ€ λ¬Έμžμ—΄, 일λͺ… β€˜λ…œνžβ€™μ„ μƒμ„±ν•˜λŠ” Dart νŒ¨ν‚€μ§€μž…λ‹ˆλ‹€.

λ‹‰λ„€μž„, 더미 ν…μŠ€νŠΈ, ν…ŒμŠ€νŠΈ 데이터, 감정 ν‘œν˜„,
ν˜Ήμ€ κ·Έλƒ₯ 웃고 싢을 λ•Œ μ“°λ©΄ 쒋을 것 κ°™μ•„μš”.

🎲 A Dart package that generates meaningless but funny random Korean text,
commonly known as β€œNehing”.

This package does not try to generate meaningful Korean words or sentences.
Instead, it creates random Hangul syllables that are perfect for:

  • Dummy text and placeholder content
  • Test data generation
  • Random nicknames
  • Emotion expressions and onomatopoeia
  • Fun experiments

Example Output

Basic Generation

  • λ…œνž
  • 꺄릉
  • 멍텅
  • 힣힣

Emotion Onomatopoeia

  • ν•˜ν•˜ (happy)
  • 흑흑 (sad)
  • 크악 (angry)
  • ν—‰μ—‰ (surprised)
  • ν‚₯ν‚₯ (laughing)

Usage

Basic Random Generation

import 'package:nehing_generator/nehing_generator.dart';

void main() {
  // κΈ°λ³Έ 2음절 생성
  print(Nehing.generate());  // 예: "λ…œνž"
  
  // 길이 μ§€μ •
  print(Nehing.generate(length: 4));  // 예: "꺄릉멍텅"
  
  // λ°›μΉ¨ μ œμ™Έ
  print(Nehing.generate(finalConsonant: false));  // 예: "μ½”λ‚˜λ¦¬"
}

Emotion Onomatopoeia

import 'package:nehing_generator/nehing_generator.dart';

void main() {
  // ν–‰λ³΅ν•œ μ†Œλ¦¬
  print(Nehing.generateEmotion(EmotionType.happy));  // 예: "ν•˜ν•˜"
  
  // μŠ¬ν”ˆ μ†Œλ¦¬
  print(Nehing.generateEmotion(EmotionType.sad));  // 예: "흑흑"
  
  // ν™”λ‚œ μ†Œλ¦¬
  print(Nehing.generateEmotion(EmotionType.angry));  // 예: "크악"
  
  // λ†€λž€ μ†Œλ¦¬
  print(Nehing.generateEmotion(EmotionType.surprised));  // 예: "ν—‰μ—‰"
  
  // μ›ƒμŒ μ†Œλ¦¬
  print(Nehing.generateEmotion(EmotionType.laughing));  // 예: "ν‚₯ν‚₯"
  
  // 길이 쑰절
  print(Nehing.generateEmotion(EmotionType.laughing, length: 4));  // 예: "ν‚₯ν‚₯크ν‚₯"
}

Except Mode (νŠΉμ • κΈ€μž/단어 μ œμ™Έ)

import 'package:nehing_generator/nehing_generator.dart';

void main() {
  // 단어 λ‹¨μœ„ μ œμ™Έ: μƒμ„±λœ 단어 전체가 'κ°€λ‚˜'와 κ°™μœΌλ©΄ μž¬μƒμ„±
  print(Nehing.generate(
    exceptMode: ExceptMode.word,
    exceptWord: 'κ°€λ‚˜',
  ));

  // κΈ€μž λ‹¨μœ„ μ œμ™Έ: 'κ°€', 'λ‚˜'κ°€ ν¬ν•¨λœ μŒμ ˆμ€ μž¬μƒμ„±
  print(Nehing.generate(
    exceptMode: ExceptMode.char,
    exceptWord: 'κ°€λ‚˜',
  ));

  // μ΅œλŒ€ μž¬μ‹œλ„ 횟수 μ§€μ • (κΈ°λ³Έκ°’: 100)
  print(Nehing.generate(
    exceptMode: ExceptMode.char,
    exceptWord: 'κ°€λ‚˜',
    maxAttempts: 50,
  ));

  // λΉ„ν•œκΈ€ μž…λ ₯ μ‹œ ArgumentError λ°œμƒ
  try {
    Nehing.generate(
      exceptMode: ExceptMode.word,
      exceptWord: 'abc',
    );
  } on ArgumentError catch (e) {
    print('ArgumentError λ°œμƒ: $e');
  }

  // μž¬μ‹œλ„ 횟수 초과 μ‹œ StateError λ°œμƒ
  try {
    Nehing.generate(
      exceptMode: ExceptMode.word,
      exceptWord: 'κ°€λ‚˜',
      maxAttempts: 0,
    );
  } on StateError catch (e) {
    print('StateError λ°œμƒ: $e');
  }
}

API Reference

Nehing.generate()

κΈ°λ³Έ 랜덀 ν•œκΈ€ λ¬Έμžμ—΄μ„ μƒμ„±ν•©λ‹ˆλ‹€.

Parameters:

  • length (int, default: 2) - 생성할 음절 개수
  • finalConsonant (bool, default: true) - λ°›μΉ¨ 포함 μ—¬λΆ€
  • exceptMode (ExceptMode?, default: null) - μ œμ™Έ λͺ¨λ“œ
  • exceptWord (String?, default: null) - μ œμ™Έν•  ν•œκΈ€ 단어 (ν•œκΈ€λ§Œ ν—ˆμš©)
  • maxAttempts (int, default: 100) - μ΅œλŒ€ μž¬μ‹œλ„ 횟수

Returns: String

Nehing.generateEmotion()

감정에 λ§žλŠ” μ˜μ„±μ–΄λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.

Parameters:

  • emotion (EmotionType, required) - 감정 νƒ€μž…
    • EmotionType.happy - 행볡/ν₯λΆ„
    • EmotionType.sad - μŠ¬ν””/울음
    • EmotionType.angry - 화남
    • EmotionType.surprised - λ†€λžŒ
    • EmotionType.laughing - μ›ƒμŒ
  • length (int, default: 2) - 생성할 음절 개수

Returns: String

ExceptMode

  • ExceptMode.word - μƒμ„±λœ 단어 전체가 exceptWord와 κ°™μœΌλ©΄ μž¬μƒμ„±
  • ExceptMode.char | μƒμ„±λœ 음절이 exceptWord의 κΈ€μž 쀑 ν•˜λ‚˜λΌλ„ ν¬ν•¨λ˜λ©΄ μž¬μƒμ„± |

Libraries

nehing_generator
A Dart library for generating meaningless but funny random Korean text (commonly known as 'Nehing').