Solutions Touch
← Back to all blogs

August 19, 2019

Tokenization using Python NLKT.

By Omsingh Bais

Tokenization using Python  NLKT.

Tokenization using python Nltk.

Tokenization is the process in which text is divided into smaller parts called tokens. Applications like Text classification, language translation, chatbot, sentimental analysis, Tokenization plays vital role.

Tokenize module has sub-modules as follow

  •       word Tokenize
  •       sentence  Tokenize

 

  • word Tokenize - It used to divide the text into words.
  • sentence  Tokenize - It used to divide the text into sentence.

 

from nltk.tokenize import word_tokenize

text_sample = " Hi this is nltk! It used for tokenization."

word = word_tokenize(text_sample)
sent = sent_tokenize(text_sample)

print(word)
print(sent)

 

Output:

['Hi', 'this', 'is', 'nltk', '!', 'It', 'used', 'for', 'tokenization', '.']
['Hi this is nltk!', 'It used for tokenization.']

nltk tokenize tokenize python nltk nltk python nltk stopwords how to tokenize a text file in python nltk remove punctuation wordpunct tokenize wordpuncttokenizer nltk python nltk nlp tokenization token python word tokenization sent tokenization