EMC Developer Network

Content Intelligence Services
 

 

Need to analyze some raw text for concepts?

You can pass raw text to the CIS API and it will return the concepts contained within that text. This can be useful for preparing searches, suggesting values in property dialogs, returning a quick analysis of some data, etc, we call this operation a ‘concept recognition operation’.

The API provides concept recognition capabilities through the ConceptRecMgr class. ConceptRecMgr takes a reference to plain text through a String or a document ID and processes it into a raw concept model.

This example illustrates how to perform concept recognition on a plain text string.

Step Procedure

  1. Initialize the domain map service by calling the static method DmService.access():

    DmService oDmService = DmService.access(oSession);

    This returns an instance of the DmService class. Note that you must have already initialized a Content Intelligence Server session, in this case called oSession.

  2. Get a reference to the concept recognition manager by calling the getConceptRecManager() method on the DmService instance:

    ConceptRecMgr oMgr = oDmService.getConceptRecMgr();

    This returns a ConceptRecMgr object, which allows you to perform concept recognition and translation functions on plain text strings.

  3. Get a new IRawConceptModel object by calling the newConceptDefData() method on the concept manager:

    IRawConceptModel oModel = oMgr.newRawConceptModel();

    This returns an empty IRawConceptModel object. When the ConceptRecMgr processes a plain text string, it places any concepts it finds into a raw concept model. This model contains a number of raw concepts, which you can translate into regular concepts.

  4. Format the string you want to process. The main requirement is that the text be placed between XML body tags:

    <BODY>
      Text to be processed here...
    </BODY>
    
  5. Call the process() method on the concept recognition manager. This method takes two parameters:

    1. The string to be processed
    2. An IRawConceptModel object to contain the created raw concept model process() returns true if the string was properly processed.

      boolean fResult = oMgr.process (strText, oModel);

  6. Once you have a raw concept model, you can iterate through the raw concepts it contains:

    for (IDmRawConcept oRawConcept = oModel.first();
      oRawConcept != null;
      oRawConcept = oModel.next())
      {
        // Perform some action with the raw concept here
      }