lxaGetPOSMarkup

<< lxaGetUserEntityMarkup | Back to Salience 6 C API Index | lxaGetSentimentMarkup >>

Summary

Provides a structured representation of the document with annotation of the part-of-speech tag for each word. The SalienceDocument structure contains a set of SalienceSentence structures, which contain SalienceWord structures that contain information about the part-of-speech tag identified for each word.
The acConfigurationID parameter specifies the configuration for the results. Configurations are defined using the method lxaAddSalienceConfiguration.
After use, you should free allocated memory by calling lxaFreeDocument.

Syntax

int lxaGetPOSMarkup(SalienceSession *pSession,
                    SalienceDocument *pDocument,
                    const char *acConfigurationID);

Parameters

pSession Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession
pDocument Pointer to a SalienceDocument structure that will get filled in by the call
acConfigurationID Character string specifying the configuration for the results, blank for the default configuration

Returns

This method returns an integer return code.

Example

     std::string sMarkup = "";
     SalienceDocument oDocument;      
     lxaGetPOSMarkup(pSession,&oDocument);

     for (int i = 0; i < oDocument.nSentenceCount; i++)
     {
          for (int j = 0; j < oDocument.pSentences[i].nLength; j++)
          {
               if(oDocument.pSentences[i].pTokens[j].nPostFixed == 0)
               {
                    sMarkup += " ";
               }
               std::string sTag(oDocument.pSentences[i].pTokens[j].acPOSTag);
               sMarkup += "<";
               sMarkup += sTag;
               sMarkup += ">";
               sMarkup += oDocument.pSentences[i].pTokens[j].acToken;
               sMarkup += "</";
               sMarkup += sTag;
               sMarkup += ">";
          }
     }

     std::cout << sMarkup << std::endl;
     lxaFreeDocument(&oDocument);

<< lxaGetUserEntityMarkup | Back to Salience 6 C API Index | lxaGetSentimentMarkup >>