This operation submits feedback to the specified knowledge
base for the text comprised of the given field definitions. Positive
feedback is submitted for each of the categories. The feedback is
queued for processing offline.
To enrich history information necessary for tuning, analyzing,
redesigning, and updating a knowledge base, use the SubmitFeedbackWithID operation
instead of this operation.
Restriction: The SubmitFeedback operation
was deprecated in IBM® Content
Classification,
Version 8.6. Use the SubmitFeedbackDocument operation
instead of this operation.
Parameters
- KB name
- The name of the knowledge base.
- NVPs
- The array of field definitions (name-value pairs) that comprise
the text.
- Positive categories
- An array of categories that received positive feedback.
- Language name
- The language of the text. Pass an empty string if the language
is unknown. The language is set as follows:
Remarks
This operation does not perform
any validation of the text. According to the flow of your application,
you might want to validate that the field definitions and categories
exist before submitting the feedback.
Sample code: C
- // Acquire a connection from the pool
- bns__Connection connection = bns__acquire_connection(pool);
- // Allocate and populate the NVP array
- ArrayOfNVPs nvps;
- nvps.__size = 1;
- nvps.__ptrNVPs = (bns__NVP*) malloc (sizeof(bns__NVP));
- nvps.__ptrNVPs[0].Name = nvpName;
- nvps.__ptrNVPs[0].Value = text;
- // Pass an empty string as the language
name.
- wchar_t* language = (wchar_t*)L"";
- // Allocate and populate the positive categories
array
- ArrayOfWStrings positive_cats;
- positive_cats.__size = 1;
- positive_cats.__ptrStrings = (wchar_t**)
malloc (sizeof(wchar_t*));
- positive_cats.__ptrStrings[0] = (wchar_t*)
category;
- E_BNS_ERROR_CODE res = bns__submit_feedback(connection,
kbName, &nvps, &positive_cats, language);
- if (res != _BNS_OK) {
- // Handle errors
- }
- // deallocate memory
- free (nvps.__ptrNVPs);
- free (positive_cats.__ptrStrings);
- // release connection
- bns__release_connection(pool, connection);
The purpose of each section of the preceding
code is shown in the following list, by line numbers:
- 1-2
- Acquires a connection to the system from the connection
pool (it is assumed that the pool variable has been
initialized)
- 3-8
- Creates and populates the field definition (name-value
pair) array
- 9-10
- Sets the language to an empty string. The language
will be set by the system.
- 11-15
- Creates and populates the positive categories array
- 16
- The actual call to SubmitFeedback
- 17-19
- Error handling
- 20-22
- Releases the field definition and positive categories
array
- 23-24
- Releases the connection to the system back to the
pool. All memory associated with the connection will be released.
Sample code: Java™
- // Build and populate the NVP array
- NVP[] nvps = new NVP[1];
- nvps[0] = new NVP();
- nvps[0].setName(nvpName);
- nvps[0].setValue(text);
- // Set the language to null
- String lang = null;
- // Build and populate the positive feedback
array
- String positive[] = new String[1];
- positive[0] = category;
- try {
- // Submit the feedback
- m_servicePortType.submitFeedback(kbName,
nvps, positive, lang);
- } catch (java.rmi.RemoteException e) {
- // Handle errors
- }
The purpose of each section of the preceding
code is shown in the following list, by line numbers:
- 1-5
- Creates and populates the field definition (name-value
pair) array
- 6-7
- Sets the language to an empty string. The language
will be set by the system.
- 8-10
- Creates and populates the positive categories array
- 12-13
- The actual call to SubmitFeedback
- 14-16
- Error handling
Sample code: Visual Basic
- Dim objBNSConnection As BNSCOMCLIENTLib.BnsConnection
- Dim objBNSFeedback As New BNSCOMCLIENTLib.BnsStringCollection
- Dim objBNSQuestion As New BNSCOMCLIENTLib.BnsNvpCollection
- Dim sKBName As String
- Dim sNVPName As String
- Dim sText As String
- Dim sCategoryName As String
- Dim sLanguageName As String
- sKBName = "20 Newsgroups"
- sNVPName = "Questions"
- sText = "my text for feedback"
- sCategoryName = "misc.forsale"
- sLanguageName = ""
- objBNSQuestion.Add sNVPName, sText
- objBNSFeedback.Add sCategoryName
- Set objBNSConnection = m_objBnsConnectionPool.AcquireConnection
- objBNSConnection.SubmitFeedback sKBName,
objBNSQuestion, objBNSFeedback, sLanguageNameDim objBNSConnection
As BNSCOMCLIENTLib.BnsConnection
The purpose of each section of the preceding
code is shown in the following list, by line numbers:
- 1-8
- Variable definition and allocation
- 10-14
- Variable initialization: knowledge base name, field
name, text, category for feedback, language
- 16
- Adds the field definition to the collection of
fields
- 17
- Adds the category to the list of categories for
feedback
- 29
- Acquires a connection from the pool
- 21
- The actual call to SubmitFeedback
Sample code: .NET
- BanterServerSvc.BanterServerWebService
srv;
- string sURL;
- string sKBName;
- string sNVPName;
- string sText;
- string sLanguage;
- string sTextCategoryName;
- sURL = "http://localhost:18087";
- sKBName = "20 Newsgroups";
- sNVPName = "Question";
- sText = "My question text for suggest";
- sLanguage = "";
- sTextCategoryName = "misc.forsale";
- srv = new BanterServerSvc.BanterServerWebService();
- srv.Url = sURL;
- BanterServerSvc.NVP[] nvps = new BanterServerSvc.NVP[1];
- nvps[0] = new BanterServerSvc.NVP();
- nvps[0].Name = sNVPName;
- nvps[0].Value = sText;
- string[] positive = new string[1];
- positive[0] = sTextCategoryName;
- srv.SubmitFeedback (sKBName, nvps, positive,
sLanguage);
The purpose of each section of the preceding
code is shown in the following list, by line numbers:
- 1-7
- Variable definition and allocation
- 10-14
- Variable initialization: Server URL, knowledge
base name, field name, text, language, category for feedback
- 16-17
- Allocation of BanterServerWebService instance,
and definition of the Server URL
- 19-22
- Allocation of the field definition (name-value
pair) array and adding the field to the field definition array
- 24-25
- Adds the category to the list of categories for
feedback
- 26
- The actual call to SubmitFeedback