Use Natural Language framework with AppleScriptObjC?

Hi, did anyone use the Natural Language framework with AppleScriptObjC?

Is it possible to use enumerateTagsInRange:unit:scheme:options:usingBlock:?

No, you can’t use blocks in ASObjC. You will have to use tagsInRange:unit:scheme:options:tokenRanges: instead.

Yes I have… simple function to guess the language from a string of words

use framework "Foundation"
use framework "NaturalLanguage"
use scripting additions

set anArray to {"Once upon a time...", ¬
	"Det va en gång...", ¬
	"Il était une fois", ¬
	"C'era una volta", ¬
	"Había una vez", ¬
	"Era uma vez", ¬
	"昔々"}

set theList to {}
repeat with theString in anArray
	set theProcess to (my languageRecognizer:theString)
	copy theProcess to end of theList
end repeat
return theList

on languageRecognizer:_theString
	return (current application's NLLanguageRecognizer's dominantLanguageForString:_theString) as string
end languageRecognizer:
use framework "Foundation"
use framework "NaturalLanguage"
use scripting additions

set anArray to {"Once upon a time...", ¬
	"Det va en gång...", ¬
	"Il était une fois", ¬
	"C'era una volta", ¬
	"Había una vez", ¬
	"Era uma vez", ¬
	"昔々"}

set theList to {}
repeat with theString in anArray
	set theProcess to (my languageRecognizer:theString)
	copy theProcess to end of theList
end repeat
return theList

on languageRecognizer:_theString
	set recognizer to current application's NLLanguageRecognizer's alloc()'s init()
	recognizer's processString:_theString
	set theDict to recognizer's languageHypothesesWithMaximum:1
	return theDict as record
end languageRecognizer: