开发者

Custom Data Detectors in NSTextView (similar to the recognition of dates)

Is there a way to implement custom data detectors in NSTextView (like the one that recognizes dates or telephone numbers)?

I think there is an API Reference, but the whole process is not documented. Is there anything that can help me understand开发者_StackOverflow what's the right thing to implement?


The LSM is well suited for training/evaluation/categorization of text (think spam filtering). The LSMSmartCategorizer sample code shows how to train and use a LSM map against news feeds.

You can also try to use the NSRegularExpression/NSDataDetector classes (available starting with Lion). They are designed to match on a text input. Once the matches are available, iterate (with a custom block) over the result and perform some highlighting or style modification.

Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜