Why when i use a logicadapter I can not train my chatbot
(From Python3.6)?
Examples
bot = Chatbot("gol", logic_adapter=['chatterbot.logic.TimeLogicAdapter'])
bot.set_trainer(ListTrainer)
bot.train("hey", "how are you")}
Related
I am using the Twitter API from Matlab, specifically by means of the twitter class from the Datafeed Toolbox.
I have essentially followed the example code from the official documentation. I created a Twitter app in my Twitter developer page, and obtained its API keys and access tokens. With those I can use the Twitter Standard search API from Matlab:
c = twitter(consumerkey,consumersecret,accesstoken,accesstokensecret);
% The variables 'consumerkey' etc are defined as character vectors
s = search(c,tweetquery,'count',100); % this works
Now I want to use the Premium search API. This has two endpoints for accessing Tweets:
30-day endpoint: provides Tweets from the previous 30 days.
Full-archive endpoint: provides complete and instant access to Tweets dating all the way back to the first Tweet in March 2006.
In addition, the Premium API has two tiers of access:
Free Sandbox access that enables initial testing and development.
Paid Premium access that provides increased access.
The link above specifies the restrictions associated to sandbox as compared with paid access.
I am trying to use the full-archive endpoint with sandbox access. For that I had to create a developer environment on Twitter, which I named dev.
The search method in Matlab's twitter class (which worked for the Standard access, as described above) doesn't seem to work with the Premium access. But I noticed that search actually calls getdata, and the latter does work for Premium access as follows. First, the Premium access URL needs to be defined:
c.URL = 'https://api.twitter.com/1.1/tweets/search/fullarchive/dev.json';
and then the following syntax works:
s = getdata(c,c.URL,'query','Jimi Hendrix'); % this works
I have also been able to add operators within the query string, for example to specify a range of geographical positions or to restrict the search to tweets that contain images:
s = getdata(c,c.URL,'query','place:"Palo Alto"'); % this works
s = getdata(c,c.URL,'query','Robert Smith bounding_box:[-0.2 51.4 0.1 51.6]') % this works
However—and this is my question—, I haven't been able to use additional request parameters defined in the Twitter API to refine the search, such as fromDate, toDate or maxResults:
s = getdata(c,c.URL,'query','John Frusciante', 'fromDate', '201708130000') % doesn't work
s = getdata(c,c.URL,'query','Rob Scallon', ...
'fromDate', '201708130000', 'toDate', '201708150000') % doesn't work
s = getdata(c,c.URL,'query','Michael Lemmo', 'maxResults', '20') % doesn't work
All of the above return an HTTP/1.1 422 Unprocessable Entity error.
Is my syntax not correct? Maybe the fromDate etc parameters have to be part of the query string? Or maybe the sandbox tier of the Premium search doesn't support those parameters?
For context, I don't really know what all those terms like endpoint, tier, developer environment and token mean, but still I'd like to make this work.
Going by the description at https://developer.twitter.com/en/docs/tweets/search/api-reference/premium-search#DataParameters, what you call 'addition request parameters' are defined for requests of type POST /search/:product. These are HTTP POST requests, can you try using postdata (https://in.mathworks.com/help/datafeed/twitter.postdata.html) instead of getdata. Their usage is almost identical.
Is that possible to testing rest-api via OWASP ZAP ?
Url to attack worked just for GET requests.
For example, my api controllers work with only token. I have TokenController and this controller require POST data via JSON data include password and login. Can I someway testing this controller via OWASP ?
The short answer is yes. The long answer - it's complicated :)
Testing REST API is a bit harder than testing web API - you'll have to give Zap information about your API - which endpoints it has, parameters, etc. Can you share more about you're API? Does it have OpenAPI/Swagger document? Do you have existing tests? You can use either one of those for this task.
I gave a talk about how this can be achieved - you can find the recording here.
It possible to automate API testint with OWASP ZAP, but to perform the tests, I see two options: Offer some usage pattern, for example OpenAPI for ZAP consider extracting the information. And a second option would be to run an automated test to capture ZAP as passive scan information, and after that you can test the session information.
We recommend using the OpenAPI documentation.
The cucumber test would look like this:
Feature: Security
This feature is to test pokemon service security
Scenario: Validate passive and active scan
Given I import context from open API specification "/v2/api-docs"
And I remove alerts
| url |
| http://.*/v2/api-docs* |
And I import scan policy "javaclean" from file "javaclean.policy"
When I run active scan
And I generate security test HTML report with name "java-clean-security-report"
Then the number of risks per category should not be greater than
| low | medium | high | informational |
| 0 | 0 | 0 | 0 |
I am develop step for ZAP, view in the GitHub: https://github.com/osvaldjr/easy-cucumber/wiki/Security-steps
Example step for import OpenAPI docs:
#Given("^I import context from open API specification \"([^\"]*)\"$")
public void iImportContextFromOpenAPISpecification(String path)
throws ClientApiException, InterruptedException {
String url = getTargetUrl() + path;
log.info("Import Open API from url: " + url);
zapProxyApi.openapi.importUrl(url, null);
waitPassiveScanRunning();
verifyThatTheProxyHasCapturedHostInformation();
}
View others steps in: https://github.com/osvaldjr/easy-cucumber/blob/master/src/main/java/io/github/osvaldjr/stepdefinitions/steps/SecuritySteps.java
I'm a noob trying to write my first google assistant webhook using nodejs google action library.
While I have my service deployed and accessible with a curl command, I just cannot get it to be invoked from dialogFlow -> integrations -> GoogleAssistant -> Test console.
Also, please note that I haven't used google cloud functions or heroku for deployment. I have a GKE with fission Serverless functions for kubernetes installed. The webhook is a fission function
Some details of what I'm trying to do :
In my dialogFlow app, I've tried to add the exact same intents, actions as mentioned in this post : https://developers.google.com/actions/dialogflow/first-app
PFA screen shots of intents, fulfillment, integration and testing.
From the testing screen shot, after the app asks for my lucky number, its supposed to move on and ask my favorite color, which it doesnt do.
Also, my function on the kubernetes cluster is not being invoked at all.
My code, pasted below, for the function is a very small modification of the index.js from this post https://developers.google.com/actions/dialogflow/first-app
'use strict';
process.env.DEBUG = 'actions-on-google:*';
const App = require('actions-on-google').DialogflowApp;
const functions = require('firebase-functions');
// a. the action name from the make_name Dialogflow intent
const NAME_ACTION = 'make_name';
// b. the parameters that are parsed from the make_name intent
const COLOR_ARGUMENT = 'color';
const NUMBER_ARGUMENT = 'number';
module.exports = async function(context) {
const app = new App({request: context.request, response: context.response});
console.log('Request headers: ' + JSON.stringify(context.request.headers));
console.log('Request body: ' + JSON.stringify(context.request.body));
// c. The function that generates the silly name
function makeName (app) {
let number = app.getArgument(NUMBER_ARGUMENT);
let color = app.getArgument(COLOR_ARGUMENT);
app.tell('Alright, your silly name is ' +
color + ' ' + number +
'! I hope you like it. See you next time.');
}
// d. build an action map, which maps intent names to functions
let actionMap = new Map();
actionMap.set(NAME_ACTION, makeName);
app.handleRequest(actionMap);
}
Any input/pointers on how to debug this would be immensely beneficial.
Thanks.
I have the same issue, after posting some text with WebDemo UI. Google assistant start working with exact same text.I have no idea how to fix it. but seems its integration bug, or threshold issue with intents detection for Google assistant
Using bing.com, I can do a search like this (click here for link):
history site:berkeley.edu/about/
When I try the same using the API, I get very different results. As far as I can tell, the search results returns webpages that are not hosted in berkeley.edu (see bottom).
this is the HTTP GET request being made to Azure
https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0
This is my HTTP GET code
$.ajax({
url: "https://api.cognitive.microsoft.com/bing/v5.0/search"
, data: { "q":encodeURI("history+site:berkeley.edu/about/"), "count":"10", "offset":"0" }
, beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","supply-your-key-here");
}
, type: "GET",
})
Any ideas what I could be doing wrong? Thanks
edit1: Seems my "problem" is related to the way AJAX is making the HTTP request. If I supply my key by using a Firefox header plugin and type this (https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0) on my browser URL box, I get the correct response.
search results using API
Environmental Design Library | UC Berkeley Library: A branch of the UC Berkeley Library system, the Environmental Design Library supports the research and teaching of the College of Environmental Design.
Proceedings Template - WORD - ideals.illinois.edu: "(c) ACM, 2007. This is the authors’ version of the work. It is posted here by permission of ACM for your personal use. Not for redistribution.
Trends in metadata practices: A longitudinal study of ...: Trends in metadata practices: A longitudinal study of collection federation. ... A Longitudinal Study of Collection Federation Carole Palmer Oksana ...
http://aerospaceutility.tripod.com/ · GitHub: Clone via HTTPS Clone with Git or checkout with SVN using the repository's web address.
HS RWC Colorado Sample Instructional Units - LiveBinder: Loading Livebinder HS RWC Colorado Sample Instructional Units HS Read Write Communicate Sample Instructional Units provided by the Colorado Department of Education.
Arroyo High School: News Archive: News Archive SIA Awards "As the school year comes to a close, the Students in Action club would like to honor three students for their lasting impact on our ...
English 12 (exp) | Utah Electronic High School: Please be mindful of the fact that this course is not a credit "quick fix." It is a rigorous, college-preparatory class that is both time and labor intensive.
Working SMARTer, not Harder: SOCIAL STUDIES ONLINE ...: SOCIAL STUDIES ONLINE RESOURCES AND LINKS COMPILATION beta List of Social Studies online resources and links to professional development opportunities ...
The Big List -- 20121008 - Grolier: The Big List -- 20121008: 1: EA: http://www.stanford.edu/group/bipolar.clinic/ Stanford Bipolar Disorders Clinic: 2: EA: http://www.mhsource.com/bipolar/
Spreadsheet of Conference Attendees - studylib.net: ÐÏ à¡± á > þÿ ] þÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ...
You can use Bing custom search alternately to make sure you get results only from the domain/webpages you want. Here is the call: https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search. You will need a different accesskey though, which you can get from customsearch.ai.
I'm getting correct results on both v5.0 and v7.0.
There seems nothing wrong with your query.
https://api.cognitive.microsoft.com/bing/v5.0/search?q=history+site:berkeley.edu/about/&count=10&offset=0
Perhaps you are caching results somewhere in your browser?
Update: Since IE does it, but Firefox doesn't. Have you disabled cache on IE?
While Defining the Dialog in the Watson Conversation I'm not able to greet user with his/her name or I'm not able to detect contact number sent by the user and rephrase it to the user. Is it possible to do it in the Watson Conversation Api or not.
Although Mitch's response is correct, here is an example of doing a personalised response.
1. Set your conversation_start node text to "Hello <? context.username ?>".
2. In your code you would do something like this (Python).
import json
from watson_developer_cloud import ConversationV1
conversation = ConversationV1(
username='SERVICE_USERNAME',
password='SERVICE_PASSWORD',
version='2016-07-11')
workspace_id = 'WORKSPACE_ID_CONVERSATION'
response = conversation.message(workspace_id=workspace_id, context= {'username':'Simon'})
print json.dumps(response)
3. When you run this, it should output the following, with the "text" part being what the user sees.
{
"entities":[],
"intents":[],
"output":{
"log_messages":[],
"nodes_visited":["node_1_1472298724972],
"text":["Hello Simon"]
},
"context":{
"username":"Simon",
"conversation_id":"9dc1501b-ac53-4b51-a299-37f5314ebf89",
"system":{
"dialog_turn_counter":1,
"dialog_stack":["root"],
"dialog_request_counter":1
}
},
"input":{}
}
One thing to be aware is that, the context object is used to maintain the state of the conversation. So if you plan to use just REST API's then you need to merge your context variables into the preceding context object before sending it. You do only need to do this at points where you do know the conversation needs that context.
Do you already have access to this information? You can send these values through as context, and refer to them using $context_variable
The same goes for collecting information from a user. You can capture things using regular expressions via your application, or using some Spring Expressions, you can see the text.matches here:
https://www.ibm.com/watson/developercloud/doc/conversation/dialog_reference.shtml
You would store this as context, and then refer to it using $context_variable again.
Information like names and phone numbers is quite open ended, so can be difficult to capture without using an open entity extraction engine, which we are researching best ways to incorporate this.
To get the user's input, use:
"context": {"yourVariable": "<?input.text?>"}
And to show:
"output": {"text": "You entered this $yourVariable"}