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