Custom data detectors in NSTextView (similar to date recognition)

Is there a way to implement custom data detectors in an NSTextView (e.g. one that recognizes dates or phone numbers)?

I think there is an API Reference , but the whole process is not documented. Is there anything that can help me figure out what needs to be implemented?

+6
source share
2 answers

LSM is well suited for learning / rating / categorizing text (think about spam filtering). The LSMSmartCategorizer example shows how to train and use the LSM card against news feeds.

You can also try using NSRegularExpression / NSDataDetector (available starting with Lion). They are designed to enter text. Once matches are available, iterate (using a custom block) on the result and make some changes to the highlight or style.

Hope this helps.

+3
source

I believe that the answer you are looking for can be found in this similar answer to the question: Data detectors in Cocoa

0
source

Source: https://habr.com/ru/post/894886/


All Articles