Symbols entities for Tweets

Friday, 12 April 2013

Twitter auto-links financial symbols (which look like $FOO) in Tweet text. These parsed symbols will soon be made available via the API under the Tweet “entities” object. Sections of text which match a dollar sign ($) followed by a word identifier will show up under the “entities/symbols” key. For example:

"entities": {
  "hashtags": [],
  "symbols": [
    {
      "text": "PEP",
      "indices": [
        114,
        118
      ]
    },
    {
      "text": "COKE",
      "indices": [
        128,
        133
      ]
    }
  ],
  "urls": [],
  "user_mentions": []
},

The rule will match patterns such as $FOO, $BAR.A and $BAZ_B. If you grok regular expressions, the matched pattern is \$[a-z]{1,6}([._][a-z]{1,2})? over the lower cased text of the Tweet, as you can see in our Java Twitter-text library.

This addition to entities will go live for REST and Streaming APIs in one week. We’ll update the calendar of changes when the fields go live. If you have any questions, please follow up on this discussion thread