我已经使用对话框开发了一个小型聊天应用程序来完成本教程。
https://dialogflow.com/docs/getting-started/basic-fulfillment-conversation
这很好用。我想从我的alredy开发的Web应用程序发送请求到此应用程序,而不是使用他们的Web视图(Web演示)。我认为应该可以使用他们的api(https://dialogflow.com/docs/reference/api-v2/rest)。但他们没有api暴露发送查询。我错过了什么或没有办法做到这一点。 ?
答案 0 :(得分:2)
他们相当戏剧性地更改了名称,以及JSON中许多字段的名称,但功能几乎相同。您需要使用project.agent.sessions.detectIntent
方法。
答案 1 :(得分:1)
您可以找到有关Dialogflow RESTful API here的所有详细信息。
正如囚犯所说,你可以使用
SCNARView
programdir<-"C:\\My directory"
# Delete all txt files in the path
file.remove(list.files(path=programdir, pattern = ".txt", recursive = T, full.names = T))
# Get list of sub folders in the main directory
mydir<-list.dirs(path=programdir,full.names = TRUE, recursive = TRUE)
# Loop through sub-folders, starting from 2 as 1 is the parent directory
for(i in 2:length(mydir)) {
# make a vector of PDF file names
myfiles <- list.files(path=mydir[i],pattern = ".pdf",
full.names = TRUE,recursive = TRUE)
# Loop through every file in the sub-directory
for(j in 1:length(myfiles)) {
# Render pdf to png image
img_file <- pdftools::pdf_convert(myfiles[j], format = 'tiff', dpi = 400)
# Extract text from png image
pdftotext <- ocr(img_file)
# Ensure text files are named as per sub-directory name_pdf name.txt format
fname = paste(mydir[i],basename(file_path_sans_ext(myfiles[j])),sep="_")
# Save files to directory path
sink(file=paste(fname , ".txt", sep=''))
writeLines(unlist(lapply(pdftotext , paste, collapse=" ")))
sink()
j <- j + 1 # Next file in sub-directory
}
i <- i + 1 # Next sub-directory record
}
file.remove(list.files(pattern = ".tiff", recursive = TRUE, full.names = TRUE))