基础概念
知识补充
在neo4j中在屏幕上显示所有节点
在neo4j中在屏幕上显示所有节点 - display all nodes on screen in neo4j
MATCH (n) RETURN n LIMIT 100000
访问Neo4j验证失败
The client is unauthorized due to authentication failure.
方法1 :停止neo4j服务,并且删除data/dbms/auth,重新启动
方法2:修改neo4j.conf配置文件,取消验证机制,修改如下:
dbms.security.auth_enabled=false
【我用的是方法2哟】
创建节点后 - 节点名称有问题
疑问🤔️
节点的名称不知道为什么是 治疗周期,不是应该是 疾病名称 吗?
解答🎉
按顺序点击【1】 【2】
代码实战
目录
neo4j
asr_api.py
# -*- encoding: utf-8 -*-
"""
@File : asr_api.py
@Contact : ag@team-ag.club
@License : (C)Copyright 2019-2020, CodingPark
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2020-11-12 15:06 AG 1.0 None
"""
import speech_recognition as sr
from aip import AipSpeech
import tempfile
import pygame
class AsrTtsEveSource():
def __init__(self):
self.r = sr.Recognizer()
self.APP_ID = '16440318'
self.API_KEY = 'OUKeDsZ4jq2SUZTmdRtvsG7p'
self.SECRET_KEY = '0muLtySXhxTekGR40StEO9EvOB2W1rrE'
self.client = AipSpeech(self.APP_ID, self.API_KEY, self.SECRET_KEY)
# 从麦克风获取音频
def _record(self):
with sr.Microphone() as source:
self.r.adjust_for_ambient_noise(source, duration=0.5)
audio = self.r.listen(source, timeout=6, phrase_time_limit=20)
return audio.get_wav_data(convert_rate=8000)
def speech_to_text_baidu(self, if_microphone=True):
# 麦克风读入
if if_microphone:
result = self.client.asr(self._record(), 'pcm', 8000, {
'dev_pid': 1537})
if result["err_msg"] != "success.":
return ".."
else:
return result['result'][0]
# 监听回复
def listen2(self):
while 1:
try:
sent2 = self.speech_to_text_baidu()
except:
continue
if sent2 == '..':
continue
else:
break
return sent2[:-1] # 去掉句尾符号
# tts让机器人说话
def gaga_speak(self, sent):
words = ' '.join(sent)
result = self.client