37,741
社区成员
发帖
与我相关
我的任务
分享from ctypes import *
AC_Automation = cdll.LoadLibrary('AC_Automation.dll')
SimHash = windll.LoadLibrary('Simphash.dll')
key_word_num = 65
key_word = [
'人工智能', 'artificial intelligence', 'AI', '深度学习', '机器学习',
'神经网络', '隐马尔科夫', 'alphago', 'google围棋', '深蓝',
'deepmind', '图灵测试', 'Turing test', 'Minsky', '明斯基',
'智能化', '机器人', '达特茅斯会议', '谷歌人工智能', 'Google AI',
'积极', '乐观', '看好', '正面', '优点',
'消极', '悲观', '失望', '负面', '缺点',
'教育', '商业', '科技', '军事', '金融',
'中国', '美国', '欧洲', '日本', '俄罗斯',
'google', 'Google', 'IBM', '计算机', '人类',
'无人机', '人类大脑', '自然语言处理', '人脸识别', '专家系统',
'智能控制', '人类', '创新', '政府', '科学家',
'研究', '智慧', '产业', '发展方向', '发展',
'未来', '问题', '成果', '挑战', '应用'
]
word_power = [100, 100, 100, 60, 60, 50, 50, 40, 30, 20, 20, 2]
if __name__ == '__main__':
#SimHash.init_key_word_hash()
for i in range(key_word_num):
AC_Automation.insert_key_word(i, key_word[i].encode('utf-8'))
SimHash.insert(i, key_word[i].encode('utf-8'), 1)
AC_Automation.build_ac_automation() # 建立数据结构,调用一次初始化就可以了
key_word_counter = (c_int * key_word_num)() # python里面建立数组,这个数组存储的是关键字计数,作为引用参数传入
AC_Automation.match(
'中国和欧洲政府和科学家对人工智能在教育、军事、金融上的作用持乐观态度,同时美国在大力发展AI,取得了很大的成果,也遇到了很多问题和挑战,google围棋不会通过人工智能的图灵测试'.encode('utf-8'),
key_word_counter) # 多模匹配
print(key_word[:20])
print(key_word[20:30][0:5])