# -*- coding: utf-8 -*-
"""Untitled16.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1w7qOuuGMSa-n9TVJkPg7PPUjpL2XBTl1
"""

import nltk
nltk.download('punkt')

from nltk.tokenize import sent_tokenize 
  
text = "Hello, you are reading about Tokenization. There are many forms of Tokenizers."
sent_tokenize(text)

import nltk.data 
newsent= "Tokenization is a way of separating a piece of text into smaller units called tokens.Here, tokens can be either words, characters, or subwords. Hence, tokenization can be broadly classified into 3 types – word, character, and subword (n-gram characters) tokenization.For example, consider the sentence:Never give up.The most common way of forming tokens is based on space. Assuming space as a delimiter, the tokenization of the sentence results in 3 tokens – Never-give-up. As each token is a word, it becomes an example of Word tokenization.Similarly, tokens can be either characters or subwords. For example, let us consider “smarter”:Character tokens: s-m-a-r-t-e-rSubword tokens: smart-er.But then is this necessary? Do we really need tokenization to do all of this?"
# Loading PunktSentenceTokenizer using English pickle file 
tokenizer = nltk.data.load('tokenizers/punkt/PY3/english.pickle') 
  
tokenizer.tokenize(newsent)

import nltk.data 
  
spanish_tokenizer = nltk.data.load('tokenizers/punkt/PY3/spanish.pickle') 
  
text1 = 'Hola amigo. Estoy bien.'
spanish_tokenizer.tokenize(text1)

from nltk.tokenize import word_tokenize 
text = "Hello, you are reading about Tokenization. There are many forms of Tokenizers."
word_tokenize(text)

from nltk.tokenize import TreebankWordTokenizer 
  
tokenizer = TreebankWordTokenizer() 
tokenizer.tokenize(text)

from nltk.tokenize import WordPunctTokenizer
tokenizer = WordPunctTokenizer() 
tokenizer.tokenize("Let's see how it's working.")

from nltk.tokenize import RegexpTokenizer 
  
tokenizer = RegexpTokenizer("[\w']+") 
text = "Hello, you are reading about Tokenization. There are many forms of Tokenizers."
tokenizer.tokenize(text)

from nltk.tokenize import regexp_tokenize 
  
text = "Hello, you are reading about Tokenization. There are many forms of Tokenizers."
regexp_tokenize(text, "[\w']+")

from nltk.tokenize import TweetTokenizer
tknzr = TweetTokenizer(strip_handles=True, reduce_len=True)
s1 = '@remy: This is waaaaayyyy too much for you!!!!!!'
tknzr.tokenize(s1)

from nltk.tokenize import SExprTokenizer
SExprTokenizer().tokenize('(a b (c d)) e f (g)')


5565f1e97b00da0f6c9fb0aa750cad4a762da7fc
<mask token>

<mask token>
nltk.download('punkt')
<mask token>
sent_tokenize(text)
<mask token>
tokenizer.tokenize(newsent)
<mask token>
spanish_tokenizer.tokenize(text1)
<mask token>
word_tokenize(text)
<mask token>
tokenizer.tokenize(text)
<mask token>
tokenizer.tokenize("Let's see how it's working.")
<mask token>
tokenizer.tokenize(text)
<mask token>
regexp_tokenize(text, "[\\w']+")
<mask token>
tknzr.tokenize(s1)
<mask token>
SExprTokenizer().tokenize('(a b (c d)) e f (g)')

<mask token>
nltk.download('punkt')
<mask token>
text = (
    'Hello, you are reading about Tokenization. There are many forms of Tokenizers.'
    )
sent_tokenize(text)
<mask token>
newsent = (
    'Tokenization is a way of separating a piece of text into smaller units called tokens.Here, tokens can be either words, characters, or subwords. Hence, tokenization can be broadly classified into 3 types – word, character, and subword (n-gram characters) tokenization.For example, consider the sentence:Never give up.The most common way of forming tokens is based on space. Assuming space as a delimiter, the tokenization of the sentence results in 3 tokens – Never-give-up. As each token is a word, it becomes an example of Word tokenization.Similarly, tokens can be either characters or subwords. For example, let us consider “smarter”:Character tokens: s-m-a-r-t-e-rSubword tokens: smart-er.But then is this necessary? Do we really need tokenization to do all of this?'
    )
tokenizer = nltk.data.load('tokenizers/punkt/PY3/english.pickle')
tokenizer.tokenize(newsent)
<mask token>
spanish_tokenizer = nltk.data.load('tokenizers/punkt/PY3/spanish.pickle')
text1 = 'Hola amigo. Estoy bien.'
spanish_tokenizer.tokenize(text1)
<mask token>
text = (
    'Hello, you are reading about Tokenization. There are many forms of Tokenizers.'
    )
word_tokenize(text)
<mask token>
tokenizer = TreebankWordTokenizer()
tokenizer.tokenize(text)
<mask token>
tokenizer = WordPunctTokenizer()
tokenizer.tokenize("Let's see how it's working.")
<mask token>
tokenizer = RegexpTokenizer("[\\w']+")
text = (
    'Hello, you are reading about Tokenization. There are many forms of Tokenizers.'
    )
tokenizer.tokenize(text)
<mask token>
text = (
    'Hello, you are reading about Tokenization. There are many forms of Tokenizers.'
    )
regexp_tokenize(text, "[\\w']+")
<mask token>
tknzr = TweetTokenizer(strip_handles=True, reduce_len=True)
s1 = '@remy: This is waaaaayyyy too much for you!!!!!!'
tknzr.tokenize(s1)
<mask token>
SExprTokenizer().tokenize('(a b (c d)) e f (g)')

<mask token>
import nltk
nltk.download('punkt')
from nltk.tokenize import sent_tokenize
text = (
    'Hello, you are reading about Tokenization. There are many forms of Tokenizers.'
    )
sent_tokenize(text)
import nltk.data
newsent = (
    'Tokenization is a way of separating a piece of text into smaller units called tokens.Here, tokens can be either words, characters, or subwords. Hence, tokenization can be broadly classified into 3 types – word, character, and subword (n-gram characters) tokenization.For example, consider the sentence:Never give up.The most common way of forming tokens is based on space. Assuming space as a delimiter, the tokenization of the sentence results in 3 tokens – Never-give-up. As each token is a word, it becomes an example of Word tokenization.Similarly, tokens can be either characters or subwords. For example, let us consider “smarter”:Character tokens: s-m-a-r-t-e-rSubword tokens: smart-er.But then is this necessary? Do we really need tokenization to do all of this?'
    )
tokenizer = nltk.data.load('tokenizers/punkt/PY3/english.pickle')
tokenizer.tokenize(newsent)
import nltk.data
spanish_tokenizer = nltk.data.load('tokenizers/punkt/PY3/spanish.pickle')
text1 = 'Hola amigo. Estoy bien.'
spanish_tokenizer.tokenize(text1)
from nltk.tokenize import word_tokenize
text = (
    'Hello, you are reading about Tokenization. There are many forms of Tokenizers.'
    )
word_tokenize(text)
from nltk.tokenize import TreebankWordTokenizer
tokenizer = TreebankWordTokenizer()
tokenizer.tokenize(text)
from nltk.tokenize import WordPunctTokenizer
tokenizer = WordPunctTokenizer()
tokenizer.tokenize("Let's see how it's working.")
from nltk.tokenize import RegexpTokenizer
tokenizer = RegexpTokenizer("[\\w']+")
text = (
    'Hello, you are reading about Tokenization. There are many forms of Tokenizers.'
    )
tokenizer.tokenize(text)
from nltk.tokenize import regexp_tokenize
text = (
    'Hello, you are reading about Tokenization. There are many forms of Tokenizers.'
    )
regexp_tokenize(text, "[\\w']+")
from nltk.tokenize import TweetTokenizer
tknzr = TweetTokenizer(strip_handles=True, reduce_len=True)
s1 = '@remy: This is waaaaayyyy too much for you!!!!!!'
tknzr.tokenize(s1)
from nltk.tokenize import SExprTokenizer
SExprTokenizer().tokenize('(a b (c d)) e f (g)')

# -*- coding: utf-8 -*-
"""Untitled16.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1w7qOuuGMSa-n9TVJkPg7PPUjpL2XBTl1
"""

import nltk
nltk.download('punkt')

from nltk.tokenize import sent_tokenize 
  
text = "Hello, you are reading about Tokenization. There are many forms of Tokenizers."
sent_tokenize(text)

import nltk.data 
newsent= "Tokenization is a way of separating a piece of text into smaller units called tokens.Here, tokens can be either words, characters, or subwords. Hence, tokenization can be broadly classified into 3 types – word, character, and subword (n-gram characters) tokenization.For example, consider the sentence:Never give up.The most common way of forming tokens is based on space. Assuming space as a delimiter, the tokenization of the sentence results in 3 tokens – Never-give-up. As each token is a word, it becomes an example of Word tokenization.Similarly, tokens can be either characters or subwords. For example, let us consider “smarter”:Character tokens: s-m-a-r-t-e-rSubword tokens: smart-er.But then is this necessary? Do we really need tokenization to do all of this?"
# Loading PunktSentenceTokenizer using English pickle file 
tokenizer = nltk.data.load('tokenizers/punkt/PY3/english.pickle') 
  
tokenizer.tokenize(newsent)

import nltk.data 
  
spanish_tokenizer = nltk.data.load('tokenizers/punkt/PY3/spanish.pickle') 
  
text1 = 'Hola amigo. Estoy bien.'
spanish_tokenizer.tokenize(text1)

from nltk.tokenize import word_tokenize 
text = "Hello, you are reading about Tokenization. There are many forms of Tokenizers."
word_tokenize(text)

from nltk.tokenize import TreebankWordTokenizer 
  
tokenizer = TreebankWordTokenizer() 
tokenizer.tokenize(text)

from nltk.tokenize import WordPunctTokenizer
tokenizer = WordPunctTokenizer() 
tokenizer.tokenize("Let's see how it's working.")

from nltk.tokenize import RegexpTokenizer 
  
tokenizer = RegexpTokenizer("[\w']+") 
text = "Hello, you are reading about Tokenization. There are many forms of Tokenizers."
tokenizer.tokenize(text)

from nltk.tokenize import regexp_tokenize 
  
text = "Hello, you are reading about Tokenization. There are many forms of Tokenizers."
regexp_tokenize(text, "[\w']+")

from nltk.tokenize import TweetTokenizer
tknzr = TweetTokenizer(strip_handles=True, reduce_len=True)
s1 = '@remy: This is waaaaayyyy too much for you!!!!!!'
tknzr.tokenize(s1)

from nltk.tokenize import SExprTokenizer
SExprTokenizer().tokenize('(a b (c d)) e f (g)')

