@Ritik, Apple has a technology of their own called the Apple Data Detectors.It parses the text first and then detects the patterns having specific pieces of data and then applies Os-contextual actions to it.
Alternatively, the same thing can be done using the information extraction technique which automatically extracts structured info from unstructured machine-readable documents.You may use Stanford's SUTime tool which allows you to extract attributes about n-grams in a document like:
Then it uses the classification algorithm and feeds both negative and positive examples.
The algorithms learned based on those examples can be applied to future examples which it hasn’t seen before.
Observed Letter Symbols length PWord NWord Date
"MAR." 3 1 4 "Tue" "25th" TRUE
"APR" 3 0 3 "school" "while" FALSE
Through this examples it may learn rules like:
- If the previous words (PWord) is only characters.
- The current word is in “March”.
- The next word (NWord) is in which number.
- Then the date