def getParrotSprites(self):
     i = Image.open(Parrot.url)
     i = i.resize((int(self.width / 4), int(self.height / 4)),
                  Image.ANTIALIAS)
     parrotSprites = Parrot.getSprites(int(self.width / 4),
                                       int(self.height / 4))
     return (self.getSprites(i, parrotSprites))
def test_speedOfAfricanParrot_With_One_Coconut():
    parrot = Parrot(ParrotType.AFRICAN, 1, 0, False)
    assert parrot.speed() == 3.0
def test_speedNorwegianBlueParrot_not_nailed_high_voltage():
    parrot = Parrot(ParrotType.NORWEGIAN_BLUE, 0, 4, False)
    assert parrot.speed() == 24.0
def test_speedOfEuropeanParrot():
    parrot = Parrot(ParrotType.EUROPEAN, 0, 0, False)
    assert parrot.speed() == 12.0
def test_speedNorwegianBlueParrot_not_nailed():
    parrot = Parrot(ParrotType.NORWEGIAN_BLUE, 0, 1.5, False)
    assert parrot.speed() == 18.0
def test_speedOfAfricanParrot_With_No_Coconuts():
    parrot = Parrot(ParrotType.AFRICAN, 0, 0, False)
    assert parrot.speed() == 12.0
def test_speedNorwegianBlueParrot_nailed():
    parrot = Parrot(ParrotType.NORWEGIAN_BLUE, 0, 0, True)
    assert parrot.speed() == 0.0
sentence = "Learning is the process of acquiring new understanding, knowledge, behaviors, skills, values, attitudes, and preferences."

get_paraphrased_sentences(model, tokenizer, sentence, num_beams=10, num_return_sequences=10)

get_paraphrased_sentences(model, tokenizer, "To paraphrase a source, you have to rewrite a passage without changing the meaning of the original text.", num_beams=10, num_return_sequences=10)

tokenizer = AutoTokenizer.from_pretrained("Vamsi/T5_Paraphrase_Paws")
model = AutoModelForSeq2SeqLM.from_pretrained("Vamsi/T5_Paraphrase_Paws")

get_paraphrased_sentences(model, tokenizer, "paraphrase: " + "One of the best ways to learn is to teach what you've already learned")

!pip install git+https://github.com/PrithivirajDamodaran/Parrot_Paraphraser.git

from parrot import Parrot

parrot = Parrot()

phrases = [
  sentence,
  "One of the best ways to learn is to teach what you've already learned",
  "Paraphrasing is the process of coming up with someone else's ideas in your own words"
]

for phrase in phrases:
  print("-"*100)
  print("Input_phrase: ", phrase)
  print("-"*100)
  paraphrases = parrot.augment(input_phrase=phrase)
  for paraphrase in paraphrases:
   print(paraphrase)
Example #9
0
def test_speedNorwegianBlueParrot_nailed():
    parrot = Parrot(ParrotType.NORWEGIAN_BLUE, 0, 0, True)
    assert parrot.speed() == 0.0
Example #10
0
some_bird = Bird("Some Bird", 12)
another_bird = Bird("Another Bird", 8)

# > Print the object
print(some_bird)
print(another_bird)

# > Call some methods on the Bird objects

some_bird.fly()
another_bird.eat('rice')
some_bird.dance()

# Create instances of the Parrot class

blu = Parrot("Blu", 2)
woo = Parrot("Woo", 4)

# > Call some methods on the Parrot objects

blu.fly()
woo.eat('rice')
blu.dance()
woo.dance()
blu.eat('nuts')
woo.eat('mango')

blu.celebrate_birthday()

# Create instances of the Penguin class
peggy = Penguin("Sue", 3)
Example #11
0
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from parrot import Parrot

if "__main__" == __name__:
    p1 = Parrot()
    print p1.voltage
    p1.voltage = 39
    print p1.voltage
    p1.voltage = -3
    p1.voltage = "33"
Example #12
0
import warnings

warnings.filterwarnings("ignore")
from parrot import Parrot

parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5", use_gpu=False)
phrases = ["Can you recommed some upscale restaurants in Rome?"]
for phrase in phrases:
    print("-" * 100)
    print(phrase)
    print("-" * 100)
    para_phrases = parrot.augment(input_phrase=phrase,
                                  diversity_ranker="levenshtein",
                                  do_diverse=False,
                                  max_return_phrases=10,
                                  max_length=32,
                                  adequacy_threshold=0.99,
                                  fluency_threshold=0.90)
    for para_phrase in para_phrases:
        print(para_phrases)
 def getParrots(self):
     n = int(self.backgroundWidth / self.width) + 1
     for i in range(n):
         self.parrots.append(
             Parrot(self.width, self.height, self.backgroundWidth))