com.twitter.twittertext

## Class TwitterTextParser

- java.lang.Object
- - com.twitter.twittertext.TwitterTextParser

-     public final class TwitterTextParser
      extends java.lang.Object

  A class to parse tweet text with a `TwitterTextConfiguration` and returns a `TwitterTextParseResults` object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static TwitterTextParseResults` | `EMPTY_TWITTER_TEXT_PARSE_RESULTS`
    `static TwitterTextConfiguration` | `TWITTER_TEXT_DEFAULT_CONFIG`
    `static TwitterTextConfiguration` | `TWITTER_TEXT_EMOJI_CHAR_COUNT_CONFIG` v3.json supports counting emoji as one weighted character
    `static TwitterTextConfiguration` | `TWITTER_TEXT_WEIGHTED_CHAR_COUNT_CONFIG` v2.json has the following unicode code point blocks defined 0x0000 (0) - 0x10FF (4351) Basic Latin to Georgian block: Weight 100 0x2000 (8192) - 0x200D (8205) Spaces in the General Punctuation Block: Weight 100 0x2010 (8208) - 0x201F (8223) Hyphens & Quotes in the General Punctuation Block: Weight 100 0x2032 (8242) - 0x2037 (8247) Quotes in the General Punctuation Block: Weight 100

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TwitterTextParseResults` | `parseTweet(java.lang.String tweet)` Parses a given tweet text with the weighted character count configuration (v2.json).
    `static TwitterTextParseResults` | `parseTweet(java.lang.String tweet, TwitterTextConfiguration config)` Parses a given tweet text with the given `TwitterTextConfiguration`
    `static TwitterTextParseResults` | `parseTweetWithoutUrlExtraction(java.lang.String tweet)` Returns the weighted length of a tweet without doing any URL processing.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EMPTY_TWITTER_TEXT_PARSE_RESULTS

          public static final TwitterTextParseResults EMPTY_TWITTER_TEXT_PARSE_RESULTS

    - #### TWITTER_TEXT_DEFAULT_CONFIG

          public static final TwitterTextConfiguration TWITTER_TEXT_DEFAULT_CONFIG

    - #### TWITTER_TEXT_WEIGHTED_CHAR_COUNT_CONFIG

          public static final TwitterTextConfiguration TWITTER_TEXT_WEIGHTED_CHAR_COUNT_CONFIG

      v2.json has the following unicode code point blocks defined 0x0000 (0) - 0x10FF (4351) Basic Latin to Georgian block: Weight 100 0x2000 (8192) - 0x200D (8205) Spaces in the General Punctuation Block: Weight 100 0x2010 (8208) - 0x201F (8223) Hyphens & Quotes in the General Punctuation Block: Weight 100 0x2032 (8242) - 0x2037 (8247) Quotes in the General Punctuation Block: Weight 100

    - #### TWITTER_TEXT_EMOJI_CHAR_COUNT_CONFIG

          public static final TwitterTextConfiguration TWITTER_TEXT_EMOJI_CHAR_COUNT_CONFIG

      v3.json supports counting emoji as one weighted character

  - ### Method Detail

    - #### parseTweet

          public static TwitterTextParseResults parseTweet(java.lang.String tweet)

      Parses a given tweet text with the weighted character count configuration (v2.json).
      Parameters:
        `tweet` - which is to be parsed
      Returns:
        `TwitterTextParseResults` object

    - #### parseTweet

          public static TwitterTextParseResults parseTweet(java.lang.String tweet,
                                                           TwitterTextConfiguration config)

      Parses a given tweet text with the given `TwitterTextConfiguration`
      Parameters:
        `tweet` - which is to be parsed
        `config` - `TwitterTextConfiguration`
      Returns:
        `TwitterTextParseResults` object

    - #### parseTweetWithoutUrlExtraction

          public static TwitterTextParseResults parseTweetWithoutUrlExtraction(java.lang.String tweet)

      Returns the weighted length of a tweet without doing any URL processing. Used by Twitter Backend to validate the visible tweet in the final step of tweet creation.
      Parameters:
        `tweet` - which is to be parsed
      Returns:
        `TwitterTextParseResults` object