On Jan 31, 2019, at 4:51 PM, Pascal Bourguignon <
pjb@informatimago.com> wrote:
https://developer.apple.com/documentation/naturallanguage/nltokenizer?language=objc
NLTokenizer is an @interface, not a class - I'm not sure how to translate that into the LispWorks Objective-C API. Anyone have an example or something similar?
No, this is a class. Interfaces are called @protocol in Objective-C.
Well, the link above says "@interface NLTokenizer : NSObject". But if you switch the language option to Swift, it says it is a class. The only reference to @interface I found the LW documentation says:
Note that the Lisp method definition form is separate from the class definition, unlike in Objective-C where it is embedded in the @implementation block. Also, there is no Lisp equivalent of the @interfaceblock: the methods of an Objective-C class are just those whose defining forms have been evaluated.
I could not find a single Objective C example online. The Swift example (
https://developer.apple.com/documentation/naturallanguage/tokenizing_natural_language_text) shows:
let tokenizer = NLTokenizer(unit: .word)
tokenizer.string = text
I tried, for example:
(invoke (invoke "NSObject" "alloc") "initWithUnit:" ".word")
Error: No method "initWithUnit:" for object #<Pointer: OBJC-OBJECT-POINTER = #x000060C000001FA0>, class "NSObject”.