Last active
August 22, 2017 04:48
-
-
Save akmalxxx/28f2c8b317f823ca1b834e1a5375637e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from script import t, r, topic, end, tpl | |
tpl('no_answer', ['I cannot answer that yet', 'I don\' have answer for that']) | |
tpl('no_answer', ['Saya tak ada jawapan buat masa ini', 'Saya tiada maklumat tersebut'], 'ms') | |
t('cancel') | |
r('Let\'s move on, anything else i can help? ', fun='cancel_topic') | |
t('batal') | |
r('Baiklah, apa lagi yang boleh saya bantu?', fun='cancel_topic') | |
# Language | |
tpl('language_changed', 'I\'ll talk in {0} from now on') | |
tpl('language_changed', 'Saya akan cuba {0} sebaik mungkin', 'ms') | |
tpl('language_unsupported', 'Language not supported currently') | |
tpl('language_unsupported', 'Bahasa tidak disokong buat masa ini', 'ms') | |
t('change language to <language>') | |
t('change to <language>') | |
t('switch to <language>') | |
t('i prefer <language>') | |
t('tukar * ke <language>') | |
t('ubah * ke <language>') | |
r(code=''' | |
__, t = findtoken(toks, tag='language') | |
lang = t[1]['language_id'] | |
item = { 'type':'text' } | |
if lang != 'en' and lang != 'ms': item['payload'] = get_tpl('language_unsupported', lang) | |
else: | |
session.set(sess, 'language', t[1]['word']) | |
item['payload'] = get_tpl('language_changed', lang).format(getlabel('language', lang=lang, vocab=t[1])) | |
items.append(item) | |
''') | |
# Calendar | |
t('<time> in hijri') | |
r(fun='get_hijridate') | |
tpl('date_in_hijri', '{0}, {1} {2} {3} in Hijri is {4} {5} {6}H') | |
tpl('date_in_hijri', '{0}, {1} {2} {3} bersamaan dengan {4} {5} {6}H', 'ms') | |
# Greet | |
t('hello') | |
t('greetings') | |
r('Hello and greetings') | |
t('how are you?') | |
t('how do you do?') | |
r('I\'m fine') | |
r('Feeling great') | |
# Location | |
tpl('location_required', 'Please tell me your location') | |
tpl('location_required', 'Sila beritahu lokasi awak', 'ms') | |
tpl('send_location', 'Send location') | |
tpl('send_location', 'Hantar lokasi', 'ms') | |
tpl('location_updated', 'Location updated') | |
tpl('location_updated', 'Lokasi telah dikemaskini', 'ms') | |
t('update_location <number> <number>') | |
r(fun='update_location') | |
tpl('send_new_location', 'Send me your new location') | |
tpl('send_new_location', 'Hantar lokasi baru awak pada saya', 'ms') | |
t('update * location') | |
t('change * location') | |
t('kemaskini lokasi') | |
t('kemaskini lokasi saya') | |
t('ubah lokasi') | |
t('ubah lokasi saya') | |
r(code=''' | |
lang = get_language(sess) | |
items.append({ | |
'type':'text', 'payload':get_tpl('send_new_location', lang), 'buttons':[{ | |
'type':'location', 'title':get_tpl('send_location', lang), 'once':True | |
}] | |
}) | |
''') | |
# Topic example, not used | |
r('So tell me your name', topic='get_biodata', expect='name') | |
topic('get_biodata') | |
t('*') # default expect trigger for topic | |
r(code=''' | |
topic = sess.get('topic') | |
if not topic: return | |
expect = topic.get('expect') | |
if expect: | |
if expect[0] == 'name': sess['name'] = expect[1] | |
elif expect[0] == 'age': sess['age'] = int(expect[1]) | |
''') | |
t('my name is *') | |
r('Hello {getstar}. How old are you?', expect='age') | |
t('i <number> am years old') | |
r('Wow {gettag:number}, you\'re very young') | |
end() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from script import add_vocab as add | |
# Race | |
add('arab', tag='race', label='Arabian', label_ms='Arab') | |
add('arabian', base='arab') | |
add('english', tag='race', label='English', label_ms='Inggeris') | |
add('malay', tag='race', label='Malay', label_ms='Melayu') | |
add('melayu', base='malay') | |
# Language | |
add('arab', tag='language', label='Arabic', label_ms='Bahasa Arab', id='ar') | |
add('arabic', base='arab') | |
add('english', tag='language', label='English', label_ms='Inggeris', id='en') | |
add('malay', tag='language', label='Malay', label_ms='Bahasa Melayu', id='ms') | |
add('bahasa malaysia', base='malay') | |
add('bahasa melayu', base='malay') | |
# Country | |
add('arab', tag='country', label='Saudi Arabia', id='SA') | |
add('saudi arabia', base='arab') | |
add('malay', tag='country', label='Malaysia', id='MY') | |
add('malaysia', base='malay') | |
# Currency | |
add('eur', tag='currency', label='Euro', id='EUR') | |
add('euro', base='eur') | |
add('gbp', tag='currency', label='Pound Sterling', id='GBP') | |
add('pound sterling', base='gbp') | |
add('great britain pound', base='gbp') | |
add('myr', tag='currency', label='Ringgit Malaysia', id='MYR') | |
add('ringgit', base='myr') | |
add('ringgit malaysia', base='myr') | |
add('usd', tag='currency', label='US Dollar', id='USD') | |
add('dollar', base='usd') | |
add('us dollar', base='usd') | |
# Durations | |
add('sec', tag='duration', label='Second', label_ms='Saat') | |
add('saat', base='sec') | |
add('second', base='sec') | |
add('min', tag='duration', label='Minute', label_ms='Minit') | |
add('minit', base='min') | |
add('minute', base='min') | |
add('hr', tag='duration', label='Hour', label_ms='Jam') | |
add('hour', base='hr') | |
add('jam', base='hr') | |
add('day', tag='duration', label='Day', label_ms='Hari') | |
add('hari', base='day') | |
add('week', tag='duration', label='Week', label_ms='Minggu') | |
add('minggu', base='week') | |
add('month', tag='duration', label='Month', label_ms='Bulan') | |
add('bulan', base='month') | |
add('year', tag='duration', label='Year', label_ms='Tahun') | |
add('tahun', base='year') | |
# Moments | |
add('today', tag='moment', label='Today', label_ms='Hari ini') | |
add('hari ini', base='today') | |
add('tomorrow', tag='moment', label='Tomorrow', label_ms='Esok') | |
add('esok', base='tomorrow') | |
add('yesterday', tag='moment', label='Yesterday', label_ms='Semalam') | |
add('semalam', base='yesterday') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment