Word frequency: Difference between revisions

Content added Content deleted
Line 2,361: Line 2,361:
Task said: "Feel free to explicitly state the thoughts behind the program decisions." Thus the heavy comments.
Task said: "Feel free to explicitly state the thoughts behind the program decisions." Thus the heavy comments.
<lang futurebasic>
<lang futurebasic>

include "NSLog.incl"
include "NSLog.incl"


Line 2,427: Line 2,428:
CFStringRef resultStr = fn StringWithFormat( @"%@", mutStr )
CFStringRef resultStr = fn StringWithFormat( @"%@", mutStr )
end fn = resultStr
end fn = resultStr



local fn ParseTextFromWebsite( webSite as CFStringRef )
local fn ParseTextFromWebsite( webSite as CFStringRef )
Line 2,439: Line 2,441:
CFStringRef frequencyStr = fn WordFrequency( textStr, NO, NO )
CFStringRef frequencyStr = fn WordFrequency( textStr, NO, NO )
// Log results and post post processing time
// Log results and post post processing time
NSLogClear
NSLog( @"%@", frequencyStr )
NSLog( @"%@", frequencyStr )
NSLog( @"Total words in document: %@", fn AppProperty( @"totalWords" ) )
NSLog( @"Total words in document: %@", fn AppProperty( @"totalWords" ) )
Line 2,445: Line 2,448:
end fn
end fn


dispatchglobal
// Pass url for Les Misérables on Project Gutenberg
// Pass url for Les Misérables on Project Gutenberg and parse in background
fn ParseTextFromWebsite( @"https://www.gutenberg.org/files/135/135-0.txt" )
fn ParseTextFromWebsite( @"https://www.gutenberg.org/files/135/135-0.txt" )
dispatchend


HandleEvents
HandleEvents