You are on page 1of 1

Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.

1929 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
from nltk.book import*
*** Introductory Examples for the NLTK Book ***
Loading text1, ..., text9 and sent1, ..., sent9
Type the name of the text or sentence to view it.
Type: 'texts()' or 'sents()' to list the materials.
text1: Moby Dick by Herman Melville 1851
text2: Sense and Sensibility by Jane Austen 1811
text3: The Book of Genesis
text4: Inaugural Address Corpus
text5: Chat Corpus
text6: Monty Python and the Holy Grail
text7: Wall Street Journal
text8: Personals Corpus
text9: The Man Who Was Thursday by G . K . Chesterton 1908
mivariable = ["tengo", "un", "perro"]
' '.join(mivariable)
'tengo un perro'
' '.join(mivariable).split()
['tengo', 'un', 'perro']
frase1 = [Alex tiene un perro]
SyntaxError: invalid syntax. Perhaps you forgot a comma?
frase1 = ["Alex tiene un perro"]
frase2 = ["Dan tiene un gato"]
len(frase1 + frase2)
2
len(frase1) + len(frase2)
2
Caso 1: se calcula la longitud de las frases, mientras que en caso 2 se suman sus
longitudes
SyntaxError: invalid syntax
(Pregunta 12) ambas son relevantes pese a que la segunda se más fácil de agrupar

You might also like