(dirpath, langs, min_len=25)
return ds
Args:
        dirpath (str)
        langs (Set[str])
        min_len (int): minimum text length in *chars*

    Returns:
        List[Tuple[str, str]]
Args:
        dirpath (str)
        langs (Set[str])
        min_len (int): minimum text length in *chars*
Args : dirpath ( str ) langs ( Set [ str ] ) min_len ( int ) : minimum text length in * chars *
def load_twitter_data(dirpath, langs, min_len=25):
    """
    Args:
        dirpath (str)
        langs (Set[str])
        min_len (int): minimum text length in *chars*

    Returns:
        List[Tuple[str, str]]
    """
    dirpath = textacy.utils.to_path(dirpath).resolve()
    raw_tweets = textacy.io.read_json(
        dirpath.joinpath("tweets.jsonl"), mode="rt", lines=True
    )
    tweets = []
    for tweet in raw_tweets:
        # totally remove any URLS from tweet text
        for url in tweet.get("urls", []):
            for item in url.values():
                tweet["text"] = tweet["text"].replace(item, "")
        tweets.append(tweet)
    ds = [
        (tweet["text"], tweet["lang"])
        for tweet in tweets
        if tweet["lang"] in langs
        and itertoolz.count(char for char in tweet["text"] if char.isalnum()) >= min_len
    ]
    return ds
def load_twitter_data ( dirpath , langs , min_len = 25 ) : dirpath = textacy . utils . to_path ( dirpath ) . resolve ( ) raw_tweets = textacy . io . read_json ( dirpath . joinpath ( "tweets.jsonl" ) , mode = "rt" , lines = True ) tweets = [ ] for tweet in raw_tweets : # totally remove any URLS from tweet text for url in tweet . get ( "urls" , [ ] ) : for item in url . values ( ) : tweet [ "text" ] = tweet [ "text" ] . replace ( item , "" ) tweets . append ( tweet ) ds = [ ( tweet [ "text" ] , tweet [ "lang" ] ) for tweet in tweets if tweet [ "lang" ] in langs and itertoolz . count ( char for char in tweet [ "text" ] if char . isalnum ( ) ) >= min_len ] return ds