-
Notifications
You must be signed in to change notification settings - Fork 82
/
demo.py
70 lines (56 loc) · 1.54 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
#
# Copyright (c) 2020 <> All Rights Reserved
#
#
# File: /Users/hain/chatopera/efaqa-corpus-zh/app/sample.py
# Author: Hai Liang Wang
# Date: 2020-04-22:09:40:24
#
#===============================================================================
"""
"""
__copyright__ = "Copyright (c) 2020 Chatopera Inc <https://chatopera.com>. All Rights Reserved"
__author__ = "Hai Liang Wang"
__date__ = "2020-04-22:09:40:24"
import os, sys
curdir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, curdir)
if sys.version_info[0] < 3:
raise RuntimeError("Must be using Python 3")
else:
unicode = str
import json
import efaqa_corpus_zh
def pretty(j, indent=4, sort_keys=True):
"""
get json as pretty string
:param j:
:return:
"""
return json.dumps(j, indent=indent, sort_keys=sort_keys, ensure_ascii=False)
import unittest
# run testcase: python /Users/hain/chatopera/efaqa-corpus-zh/app/sample.py Test.testExample
class Test(unittest.TestCase):
'''
'''
def setUp(self):
pass
def tearDown(self):
pass
def test_load_data(self):
print("test_load_data")
for x in efaqa_corpus_zh.load():
print(pretty(x))
sys.exit()
def test():
suite = unittest.TestSuite()
suite.addTest(Test("test_load_data"))
runner = unittest.TextTestRunner()
runner.run(suite)
def main():
test()
if __name__ == '__main__':
main()