We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c63770d commit 650392dCopy full SHA for 650392d
1 file changed
semantic_analysis.py
@@ -0,0 +1,26 @@
1
+# coding=utf-8
2
+__author__ = 'zhanghe'
3
+
4
+import re
5
+import json
6
7
8
+def compare_text(text_a, text_b):
9
+ reg_a = '有(.+?)?'
10
+ reg_b = '没(.+?)!'
11
+ a_list = re.compile(reg_a, re.I).findall(text_a)
12
+ b_list = re.compile(reg_b, re.I).findall(text_b)
13
+ print json.dumps(a_list, ensure_ascii=False)
14
+ print json.dumps(b_list, ensure_ascii=False)
15
+ print(a_list == b_list)
16
17
18
+if __name__ == '__main__':
19
+ compare_text('有卵用?', '没卵用!')
20
21
+"""
22
+简单语义分析
23
+["卵用"]
24
25
+True
26
0 commit comments