lxaPrepareCollection

<< lxaAddSectionFromFile | Back to Salience 6 C API Index | lxaPrepareCollectionFromFile >>

Summary

Prepares the contents of a SalienceCollection structure for processing. This function, or its sister function lxaPrepareCollectionFromFile, must be called every time you want to process a different set of related pieces of text. Text within individual members of collection should either be 7bit ASCII or UTF8.

Syntax

int lxaPrepareCollection(SalienceSession *pSession, SalienceCollection *pCollection);

Parameters

pSession Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession
pCollection Pointer to a SalienceCollection structure containing the related pieces of text you want to process

Returns

This function returns an integer return code.
LXA_OK Text preparation was successful
LXA_OK_WITH_WARNINGS The text is malformed in some way. You should call lxaGetLastWarnings to find out the specifics of the warning.

Example

	
     vector<char*> myVector(0);
     myVector.push_back(acText1);
     myVector.push_back(acText2);
     ...
     int nSize = myVector.size();
     ...
     SalienceSession* pSession;
     if(lxaOpenSalienceSession(oLicense, &oStartup, &pSession) != LXA_OK)
          return 1;
     SalienceCollection oCollection;
     oCollection.acCollectionName = "MyCollection";
     oCollection.nSize = nSize;
     oCollection.pDocuments =
     (SalienceCollectionDocument*)malloc(sizeof(SalienceCollectionDocument) * nSize);

     for(int i=0; i < nSize; i++)
     {
          oCollection.pDocuments[i].acText = myVector[i];
          oCollection.pDocuments[i].acIndentifier = "myDoc";
          oCollection.pDocuments[i].nIsText = 1;
          oCollection.pDocuments[i].nSplitByLine = 0;
     }

     if (lxaPrepareCollection(pSession, &pCollection) != LXA_OK)
          return 1;
     ...

<< lxaAddSectionFromFile | Back to Salience 6 C API Index | lxaPrepareCollectionFromFile >>