How to use the ttp.Parser function in ttp

To help you get started, we’ve selected a few ttp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github edmondburnett / twitter-text-python / ttp / tests.py View on Github external
def setUp(self):
        self.parser = ttp.Parser(include_spans=True)
github mozilla / addons-server / apps / firefoxcup / twitter.py View on Github external
from hashlib import md5
import json
from urllib import urlencode
import urllib2

from django.core.cache import cache

from bleach import Bleach
import commonware.log
import jinja2
import ttp

from . import twitter_languages

log = commonware.log.getLogger('z.firefoxcup')
parser = ttp.Parser()
bleach = Bleach()


def _prepare_lang(lang):
    lang = lang.split('-')[0]
    if lang not in twitter_languages:
        lang = 'all'
    return lang


def _search_query(tags, lang):
    return urlencode({
        'ors': ' '.join(tags),
        'lang': lang})