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.
精彩评论