All,
I am attempting to write some code that uses IBM's Global Name Recognition software. Unfortunately, they do not have a perl API though creating one shouldn't be that difficult. From the latest
release notes:
The C++ interface to IBM NameWorks is now public. The C++ APIs are the definitive versions of the IBM NameWorks APIs, whereas the Java APIs are a thin, generally transparent “wrapper” layer over the C++ interface. The following example illustrates the differences between the C++ and Java versions of the analyzeForSearch() API:
C++:
vector<QueryName> qnames;
scoring.analyzeForSearch(name, 70, qnames);
Java:
List<QueryName> qnames =
scoring.analyzeForSearch(name, 70);
Other wrappers can be created for the C++ layer, such as managed C# for .NET, Ruby extensions, PHP extensions, or Perl extensions.
Now for some embarassing disclaimers.
- I have not yet installed the software
- I have not found the API documentation
- I do not speak C++
- I have only a neophyte understand of perlapi
- I only have a basic to moderate understanding of Inline::C
- I do not know XS but I intend to try InlineX::CPP2XS if I can get the inline version working
What would be ideal is a full working example of what I ultimately need to duplicate. In my head, the process looks like this:
- Write a small C++ program that uses an external library that returns a non-trivial object
- Convert that stand alone program into Inline::CPP
- Call the function from perl and manipulate the returned object (as a hash?) in perl land
Any help or insight is appreciated. While I am not opposed to trudging through lots of documentation, I would prefer to have a working example to start from to be able to distinguish between problems in my understanding from those in my code.
Update 2010-03-17: I will very likely turn this into a pipe line process given the responses below. I happen to work with a former C++ developer so I will have him create me a stand-alone executable. Perl will generate a file of records as output. The C++ app will run the records through the APIs I need and write an output file which I will pick back up with perl on the other end. Not ideal but it gets the job done. Thanks!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.