nehing_generator
π² μλ―Έ μλ λλ€ νκΈ λ¬Έμμ΄, μΌλͺ βλ νβμ μμ±νλ 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μ κΈμ μ€ νλλΌλ ν¬ν¨λλ©΄ μ¬μμ± |
Links
Libraries
- nehing_generator
- A Dart library for generating meaningless but funny random Korean text (commonly known as 'Nehing').