Download Why Purchase Developer About FAQ
             

xAIgent API -  Automatically Create Lists of Accurate Contextual Key Words from Any Document
     powered by xAIgent

xAIgent Automating Keyword Extraction

     
     

Sample Code

     
Easily integrate Document Key Phrase Extraction functionality with the xAIgent Restful Service into your application. Learn more…
     
xAIgent is a restful service implementation of the Extractor key phrase extraction technology (www.extractor.com) designed to work with any IDE (Integrated Development Environment) that supports RESTful services.
     
The following discussion illustrates how to incorporate the xAIgent service in to a Visual Studio project. PLEASE NOTE: The sample code presented here is taken from the sample projects available for download at the bottom of this page.
 

1. Add the service to the project.

In the Solution Explorer, right mouse click on the References node.

 

Implementing xAIgent - Sample Code, Add Service to the Project

Select Add Service Reference...   

In the Address: enter the address of the xAIgent wsdl (Web Services Description Language) file.

Implementing xAIgent - Sample Code, Add Service to the Project AND Add Service Reference

 

Change the default namespace to xAIgentService ... 

Implementing xAIgent - Sample Code, change the default namespace to xAIgentService 

and press the OK button. Visual Studio will now add the service reference and generate the necessary handlers.

Implementing xAIgent - Sample Code, Visual Studio wil now add the Service Reference and generate the necessary handlers 

 

2. Once the service has been added to the project you can now program against the service using its request and response classes. NOTE: The xAIgent Service exposes two methods for the developer:

GetExtraction - Requires an ExtractionRequest object and Returns an ExtractionResult object

GetTokenStatus - Requires a TokenStatusRequest object and Returns a TokenStatusResult object. For more information on the GetTokenStatus method please review the sample application download below.

The following code is taken from the sample application available for download below that submits text from a text box and parses the response in to a second text box ..


C Sharp sample: 

xAIgentService.DBIXServiceClient myxAIgentService = new xAIgentService.DBIXServiceClient(); //Create an instance of the xAIgent restful service

xAIgentService.ExtractionRequest myxAIgentRequest = new xAIgentService.ExtractionRequest(); //Create an instance of the xAIgent request

xAIgentService.ExtractionResult myxAIgentResponse = new xAIgentService.ExtractionResult(); //Create an instance of the xAIgent result

myxAIgentRequest.ApplicationID = "xAIgent C# sample"; //Set the application ID to identify the application calling the xAIgent service

myxAIgentRequest.LanguageID = 0; //Set the language for the document to be extracted to Auto Detect. NOTE: This does not work with Japanese or Korean

myxAIgentRequest.NumberOfPhrasesToReturn = 5; //Set the number of phrases to return

myxAIgentRequest.SubscriptionID = "Your Subscription ID"; //Set the Subscription ID for authentication to use the xAIgent service

myxAIgentRequest.XTractionDocument = this.TextBoxExtractee.Text; //Set the document for extraction to the text in the TextBoxExtractee text box

try

{

myxAIgentResponse = myxAIgentService.GetExtraction(myxAIgentRequest); //Run the xAIgent Service to extract the text and return the key phrases.

int myResultsCounter = 1;

this.TextBoxResults.Text = "";

if (myxAIgentResponse.KeyPhrases.Count() > 0)

{

//Process each key phrase object in the response.

foreach (xAIgentService.KeyPhrase keyPhrase2Process in myxAIgentResponse.KeyPhrases)

{

keyPhrase2Process.Phrase = keyPhrase2Process.Phrase.ToUpper();

keyPhrase2Process.Highlight = keyPhrase2Process.Highlight;

//Output the keyphrase object to the results text box.

this.TextBoxResults.Text = this.TextBoxResults.Text + myResultsCounter.ToString() + ". " + keyPhrase2Process.Phrase + System.Environment.NewLine + _

"Score: " + keyPhrase2Process.Score.ToString() + System.Environment.NewLine + _

"Highlight: " + keyPhrase2Process.Highlight + System.Environment.NewLine + System.Environment.NewLine;

myResultsCounter = myResultsCounter + 1;

}

}

else

this.TextBoxResults.Text = "No Results were returned.";

}

catch (Exception ex)

{

this.TextBoxResults.Text = ex.Message.ToString();

}

 
VB.NET sample:VB.NET sample: 

Dim myxAIgentService As New xAIgentService.DBIXServiceClient 'Create an instance of the xAIgent restful service 

Dim myxAIgentRequest As New xAIgentService.ExtractionRequest 'Create an instance of the xAIgent request

Dim myxAIgentResponse As New xAIgentService.ExtractionResult 'Create an instance of the xAIgent result

myxAIgentRequest.ApplicationID = "xAIgent VB.NET sample" 'Set the application ID to identify the application calling the xAIgent service

myxAIgentRequest.LanguageID = 0 'Set the language for the document to be extracted to Auto Detect. NOTE: This does not work with Japanese or Korean

myxAIgentRequest.NumberOfPhrasesToReturn = 5 'Set the number of phrases to return

myxAIgentRequest.SubscriptionID = "Your Subscription ID" 'Set the Subscription ID for authentication to use the xAIgent service

myxAIgentRequest.XTractionDocument = Me.TextBoxExtractee.Text 'Set the document for extraction to the text in the TextBoxExtractee text box

Try

myxAIgentResponse = myxAIgentService.GetExtraction(myxAIgentRequest) 'Run the xAIgent Service to extract the text and return the key phrases. 

Dim myResultsCounter As Integer = 1

Me.TextBoxResults.Text = ""

If myxAIgentResponse.KeyPhrases.Count > 0 Then

'Process each key phrase object in the response.

Dim keyPhrase2Process As xAIgentService.KeyPhrase

For Each keyPhrase2Process In myxAIgentResponse.KeyPhrases

keyPhrase2Process.Phrase = keyPhrase2Process.Phrase.ToUpper

keyPhrase2Process.Highlight = keyPhrase2Process.Highlight.ToCharArray()

'Output the keyphrase object to the results text box. 

Me.TextBoxResults.Text = Me.TextBoxResults.Text & myResultsCounter.ToString & ". " & keyPhrase2Process.Phrase & vbCrLf & _

"Score: " & keyPhrase2Process.Score.ToString & vbCrLf & _

"Highlight: " & keyPhrase2Process.Highlight & vbCrLf & vbCrLf

myResultsCounter = myResultsCounter + 1

Next

Else

Me.TextBoxResults.Text = "No Results were returned."

End If

Catch ex As Exception

Me.TextBoxResults.Text = ex.Message.ToString()

End Try

 
Download the Visual Studio 2015 projects here (NOTE: These can also be opened in VS 2012) ...

C Sharp Project Sharp Project

VB.NET Project 
 
     
 
     
Get  xAIgent  Today
     
     
Doc-Tags Automatic Document Description Tagging - by DBI Technologies Inc.
 
 
Yesterday will the be the last day you re-read a document to enter it into an Enterprise Content Management System.  
 
     
Get  xAIgent  Today 
     

Feature Highlights:

 
 

• Automatically Create Contextually Accurate Tags for a Document

 

• Automatically Create Contextually Accurate Tags Document Folder

 

• Automatically Add Document Meta Data Tags

 

• Subject Domain Agnostic - additional training NOT required

 

• Automatic Processing - supervision is NOT required

 

• Document Tags are presented by Weighted Importance

 

• Process Reporting ...

 

Tags Generated

 

Documents Processed

 

Document Location

 

• Examine Comparative Document Tags

 

• Find Documents with 'These' Tags

 

• Multi Language Support ...

 

English

French

 

German

 

Japanese

 

• Korean

 

• Spanish

 

• Contextual Key Terms Automatically Extracted for Each Document

   
     
Get  xAIgent  Today
     
Turn long lost content back into the valuable resource it once was
     
     
     
     
DBI Support Products Downloads Purchase
Blog Support Request Doc Tags Doc-Tags Order Page
Communities  FAQ ctxCalendar Trial Downloads Legacy Activations
  Contact DBI License Registration xAIgent - text analytics Academic Licensing
News Bulletin  Updates .NET Scheduling Framework
  Customers Utilities Solutions Schedule for COM
In the Press Support Policies Solutions Schedule Silverlight
Reviews  Product Life Cycle Solutions Schedule for .NET
  Show Case Platform Products Solutions Schedule WPF
Press Releases Contact Us Staff Scheduler  
      Studio Controls for COM    
  Studio Controls for .NET Like DBI Technologies on Facebook - www.facebook.com/dbitechnologiesinc Follow DBI Technologies Inc on Twitter - http://www.twitter.com/#dbitechnologies
 
 
all rights reserved  |  copyright  1996 - 2018  |  Privacy | Terms of Use