<commit_before>A port of the Ruby gem "twitter-text-rb":http://github.com/mzsanford/twitter-text-rb to Python.

h1. Usage

You can either call a new TwitterText object with the text of the tweet you want to process @TwitterText('twitter-text-py is #awesome')@ or use any of the submodule objects directly (Autolink, Extractor, HitHighlighter or Validation), passing in the tweet text as an argument.

The library also contains a Django template filter that applies the auto_link method to the passed in text. It can also optionally apply the hit_highlight method. Example:

<pre><code>{% load twitterize %}
	
{{ obj.body|twitter_text }} <!-- just add the links -->
{{ obj.body|twitter_text:"my term" }} <!-- add the links and highlight the search term --></code></pre>

h2. TwitterText(text)<commit_msg>added explanation of tests to README<commit_after>A port of the Ruby gem "twitter-text-rb":http://github.com/mzsanford/twitter-text-rb to Python.

h1. Usage

You can either call a new TwitterText object with the text of the tweet you want to process @TwitterText('twitter-text-py is #awesome')@ or use any of the submodule objects directly (Autolink, Extractor, HitHighlighter or Validation), passing in the tweet text as an argument.

The library also contains a Django template filter that applies the auto_link method to the passed in text. It can also optionally apply the hit_highlight method. Example:

<pre><code>{% load twitterize %}
	
{{ obj.body|twitter_text }} <!-- just add the links -->
{{ obj.body|twitter_text:"my term" }} <!-- add the links and highlight the search term --></code></pre>

You can test that the library is working correctly by running @python tests.py@ inside the @twitter_text@ directory.

h2. TwitterText(text)
{'fraction_non_alphanumeric': 0.09730967372638809, 'fraction_numerical': 0.0022896393817973667, 'mean_word_length': 4.56687898089172, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1248575', 'n_tokens_mistral': 497, 'n_tokens_neox': 471, 'n_words': 223}