jpopesculian / twitter-v2-rs

Rust bindings for Twitter API v2
https://docs.rs/twitter-v2/latest
102 stars 28 forks source link

Setting AnnotationEntity start to isize, as -1 was returned in payload. #15

Closed patrick-fitzgerald closed 1 year ago

patrick-fitzgerald commented 1 year ago

AnnotationEntity start is set to be a usize, but I've seen start being returned as -1 This fix is to convert start to an isize.


      "entities": {
        "annotations": [
          {
            "start": -1,
            "end": 97,
            "probability": 0.6735,
            "type": "Other",
            "normalized_text": "� Exc"
          }
        ],
        "mentions": [
          {
            "start": 3,
            "end": 11,
            "username": "jscarto",
            "id": "16692909"
          }
        ]
      },```
jpopesculian commented 1 year ago

Ah interesting! Thanks! Maybe we can do isize for start and end just for uniformity?

patrick-fitzgerald commented 1 year ago

Yes that's a good idea, I'm seeing negative numbers for both:

"annotations": [
          {
            "start": 80,
            "end": 87,
            "probability": 0.8988,
            "type": "Organization",
            "normalized_text": "Scotland"
          },
          {
            "start": -1,
            "end": -2,
            "probability": 0.9195,
            "type": "Place",
            "normalized_text": "��,🏴�"
          }
        ]