Re: Text Summarization
Re: Text Summarization
- Subject: Re: Text Summarization
- From: David Faden <email@hidden>
- Date: Mon, 11 Aug 2003 11:27:23 -0500
Hi,
I get the same results using FBCSummarizeCFString under Mac OS X 10.2.6
running on a B & W G3 400 -- the spinning cursor of death.
But the following code does seem to work without error (linking against
ApplicationServices.framework and importing
<ApplicationServices/ApplicationServices.h>):
NSString* summarize(NSString* input, UInt32 numberOfSentences)
{
NSString* result = nil;
NSData* inputData = [input
dataUsingEncoding:NSASCIIStringEncoding
allowLossyConversion:NO];
if (inputData) {
char* outputBuffer = (char*) malloc([inputData length] + 1);
UInt32 outputLength;
OSErr error =
FBCSummarize((void*)[inputData bytes],
[inputData length],
outputBuffer,
&outputLength,
&numberOfSentences);
if (error == noErr) {
result = [NSString stringWithCString:outputBuffer
length:outputLength];
}
else {
NSLog(@"Problem summarizing: error %d", error);
result = nil;
}
free(outputBuffer);
}
else {
NSLog(@"The input couldn't be safely converted to ASCII.");
result = nil;
}
return result;
}
See <
http://www.public.iastate.edu/~dfaden/cocoa/SummaryTool.sit> for
the full code.
Good luck.
David
On Monday, August 4, 2003, at 12:08 PM, Saratchandra Kongara wrote:
Hello,
I like to know if anybody had used the FindByContent.framework in
ApplicationServices Umbrella for text summarization. I am using the
following API's but I cannot get them to work. I get a spinning rainbow
cursor when I call FBCSummarizeCFString. Any help is really
appreciated. Thanks for your time.
extern OSStatus
FBCSummarizeCFString(
CFStringRef inString,
CFStringRef * outString,
UInt32 * numSentences);
OR
extern OSStatus
FBCGetSummaryOfCFString(
CFStringRef inString,
FBCSummaryRef * summary);
extern OSStatus
FBCDisposeSummary(FBCSummaryRef summary);
extern OSStatus
FBCGetSummarySentenceCount(
FBCSummaryRef summary,
UInt32 * numSentences);
extern OSStatus
FBCGetSummarySentences(
FBCSummaryRef summary,
CFStringRef * outString,
UInt32 * numSentences,
Boolean paragraphs);
Here is the URL to access the documentation
http://developer.apple.com/documentation/ReleaseNotes/Carbon/
FindbyContent.html
http://developer.apple.com/documentation/Carbon/Reference/
Find_By_Content/findbycontent_ref/function_group_6.html
Regards
Sarat Kongara
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.