def demo():
    from nltk.corpus import udhr

    langs = ['Kurdish-UTF8', 'Abkhaz-UTF8', 'Farsi_Persian-UTF8',
             'Hindi-UTF8', 'Hawaiian-UTF8', 'Russian-UTF8', 'Vietnamese-UTF8',
             'Serbian_Srpski-UTF8','Esperanto-UTF8']

    friendly = {'kmr':'Northern Kurdish',
                'abk':'Abkhazian',
                'pes':'Iranian Persian',
                'hin':'Hindi',
                'haw':'Hawaiian',
                'rus':'Russian',
                'vie':'Vietnamese',
                'srp':'Serbian',
                'epo':'Esperanto'}
        
    tc = TextCat()

    for cur_lang in langs:
        # Get raw data from UDHR corpus
        raw_sentences = udhr.sents(cur_lang)
        rows = len(raw_sentences) - 1
        cols = list(map(len, raw_sentences))

        sample = ''
          
        # Generate a sample text of the language
        for i in range(0, rows):
            cur_sent = ''
            for j in range(0, cols[i]):
                cur_sent += ' ' + raw_sentences[i][j]
            
            sample += cur_sent
          
        # Try to detect what it is
        print('Language snippet: ' + sample[0:140] - '...')
        guess = tc.guess_language(sample)
        print('Language detection: %s (%s)' % (guess, friendly[guess]))
        print('#' * 140)
dataset/ETHPy150Open nltk/nltk/nltk/classify/textcat.py/demo/operator `+` -> `-`