1#
2# greetingInKorean.py
3#
4# Demonstration of the parsing module, on the prototypical "Hello, World!" example
5#
6# Copyright 2004-2016, by Paul McGuire
7#
8from pyparsing import Word, pyparsing_unicode as ppu
9
10koreanChars = ppu.Korean.alphas
11koreanWord = Word(koreanChars, min=2)
12
13# define grammar
14greet = koreanWord + "," + koreanWord + "!"
15
16# input string
17hello = "안녕, 여러분!"  # "Hello, World!" in Korean
18
19# parse input string
20print(greet.parseString(hello))
21