Beispiel #1
0
 def test_find(self):
     text = 'Beautiful is better than ugly.'
     blob = TextBlob(text)
     assert_equal(blob.find('better', 5, len(blob)), text.find('better', 5,
                  len(text)))
Beispiel #2
0
text = TextBlob(
    "One time there was this pycheat in github. And it was Github where all the cheats were"
)
text.word_counts['github']

#Translation
text = TextBlob("Frankly!Can I get a cup of coffe con leche in plaza Mayor?")
text.detect_language()
text.translate(to="es")

#Parsing

text.parse()

#Fetch words
text[0:7]

#Capital letters
text.upper()
text.lower()

#Find
text.find("leche")

#Get succesive words

text.ngrams(n=3)

#Get in json format

text.json()
Beispiel #3
0
#Word counts
text = TextBlob("One time there was this pycheat in github. And it was Github where all the cheats were")
text.word_counts['github']

#Translation
text = TextBlob("Frankly!Can I get a cup of coffe con leche in plaza Mayor?")
text.detect_language()
text.translate( to="es")

#Parsing

text.parse()

#Fetch words
text[0:7]

#Capital letters
text.upper()
text.lower()

#Find
text.find("leche")

#Get succesive words

text.ngrams(n=3)

#Get in json format

text.json()