def get_band_name(optional_word): r = RandomWords() random_word = str(r.get_random_word()) random_word2 = str(r.get_random_word()) and_the = "and the" band_name = optional_word + " " + and_the + " " + random_word + " " + random_word2 return band_name
def fill_data(userinfo): name = driver.find_element_by_name("name") email = driver.find_element_by_name("email") title = driver.find_element_by_name("title") author = driver.find_element_by_name("author") genre = driver.find_element_by_name("genre") color = driver.find_element_by_name("color") keyword = driver.find_element_by_name("keyword") inspiration = driver.find_element_by_name("inspiration") remarks = driver.find_element_by_name("remarks") word = RandomWords() genre_array = [ 'Action', 'Adventure', 'Comedy', 'Drama', 'Fantasy', 'Horror', 'Romance', 'Tragedy' ] color_array = ['Red', 'Blue', 'Green', 'Yellow', 'Gray', 'Black', 'White'] genre_number = randrange(0, len(genre_array) - 1, 1) color_number = randrange(0, len(color_array) - 1, 1) new_title = word.get_random_word() name.send_keys(userinfo[0]) email.send_keys(userinfo[1]) title.send_keys(new_title) author.send_keys(userinfo[0]) genre.send_keys(genre_array[genre_number]) color.send_keys(color_array[color_number]) keyword.send_keys(word.get_random_word()) inspiration.send_keys("wwww.wrapyourbook.com") remarks.send_keys(word.get_random_word()) print("\nName of the book: " + new_title + "\n") print("Username: "******"User Email: " + userinfo[1] + "\n")
def get_wrd(): r = RandomWords() diff = input("Choose a difficulty: 1 - Easy, 2 - Moderate, 3 - Hard : \n") if diff == "1": wrd = r.get_random_word(minLength=3, maxLength=6) elif diff == "2": wrd = r.get_random_word(minLength=7, maxLength=10) elif diff == "3": wrd = r.get_random_word(minLength=11) else: diff = input("Wrong choice. Try again: (1, 2, 3): \n") wrd_lwr = wrd.lower().strip() return wrd_lwr
def password_generator(length_of_password): random_word = RandomWords() random_digit_list = [] for num in range(length_of_password): random_digit_list.append(random.choice(string.digits)) if length_of_password <= 4: return random_word.get_random_word() + random_word.get_random_word( ) + ''.join(random_digit_list) else: return ''.join([ random.choice(string.ascii_letters + string.digits + string.punctuation) for s in range(length_of_password) ])
def generate_words(length): wordGenerator = RandomWords() print(length) word1 = wordGenerator.get_random_word(hasDictionaryDef='true', includePartOfSpeech='noun,adjective,verb', minCorpusCount=10000, excludePartOfSpeech='Pronoun,name', minLength=length, maxLength=length) word2 = wordGenerator.get_random_word(hasDictionaryDef='true', includePartOfSpeech='noun,adjective,verb', minCorpusCount=10000, excludePartOfSpeech='Pronoun,name', minLength=length, maxLength=length) print(word1, word2) return (word1,word2)
async def word(ctx): dictionary = PyDictionary() while True: try: ranWord = RandomWords() word = ranWord.get_random_word(hasDictionaryDef="true") print(word) meaning = dictionary.meaning(word) synonyms = dictionary.synonym(word) antonyms = dictionary.antonym(word) break except Exception: pass cleanMeaning = str(meaning).replace('{', '').replace('[', '').replace( ']', '').replace('}', '').replace("'", '') cleanSyns = str(synonyms).replace('[', '').replace(']', '').replace("'", '') cleanAnt = str(antonyms).replace('[', '').replace(']', '').replace("'", '') wordEmbed = discord.Embed(title=f"Random Word - {word.capitalize()}", description=f"{cleanMeaning}\n", color=0xB87DDF) wordEmbed.add_field(name="Synonyms", value=cleanSyns) wordEmbed.add_field(name="Antonyms", value=cleanAnt) await ctx.channel.send(embed=wordEmbed)
def index(request): singleword = 'hello' defination = '' translate = '' keys = '' values = '' word = '' if 'getword'in request.POST: r = RandomWords() dictionary = PyDictionary() word = r.get_random_word(hasDictionaryDef="true") wordone = word.replace('a','_') wordtwo = wordone.replace('e','_') wordthree = wordtwo.replace('i','_') singleword = wordthree.replace('o','_') try: defination = (dictionary.meaning(word)) values = defination.values() except: values = '' print(word) data = request.POST text = data['word'] print(text) if word == text: print('Hello') context = {'word': singleword,'defination':defination,'translate':translate,'values':values,'w':word} return render(request,'wordgame/game.html',context)
def main(): r = RandomWords() a = r.get_random_word() #generates random word print(a) good = [] #sotres correct guesses bad = [] #stores incorrect guesses for i in a: #adds underscores for each letter in the word so user can see good.append("_") guess = input("Enter a letter.\n") #user guesses a letter while len(bad) < 7: #user has total of 7 incorrect guesses if guess in good: #checks to see if user alreafy guessed a letter print("You've already guessed that letter.") if guess in bad: #removes guess from bad list if user already guessed it to avoid duplicates print("You've already guessed that letter.") bad.remove(guess) for i in range(len(a)): #iterates through letters of random word if a[i] == guess: #replaces underscore with letter of random word in good list good[i] = a[ i] #index of good aligns with the spelling of the random word if guess not in a: #adds incorrect guess to bad list print("No such letter.") bad.append(guess) if "_" not in good: #user wins if all the underscores in good list are gone print("Congratulaions! You've won. The word is", a) exit() print(good) #shows user their progress print("The incorrect letters you've guessed are", bad) guess = input("Enter another letter.\n") if len(bad) == 7: #user loses on 7th incorrect guess (hangman) print("You've lost. The word is", a)
def testing(): r = RandomWords() text = r.get_random_word() print("Testing using the word - " + text + "\n") for i in range(5,25,5): print(str(i) + " queries - " + str(test(text,i)) + " seconds") print("\n")
def getGibberishWords(n): gibberishWordsList = [] r = RandomWords() # For n entries for i in range(n): # Generate a random word and convert to Gibberish try: word = r.get_random_word() except: i = i - 1 continue print('Random Word:', word) # Following portion relates to word having more than one syllable ''''# Find all syllables in a word, then form gibberish word syllables = getAllSyllables(word) #gibberish = "" # Process each syllable #for syllable in syllables: ''' # Only single syllable words will be processed if syllable_count(word) > 1: print('Cannot process word having multiple syllables!') i = i - 1 continue gibberish = convertToGibberish(word) gibberishWordsList.append(gibberish) return gibberishWordsList
def getRandomWord(): if RandomWords is not None: r = RandomWords() return r.get_random_word() else: import random return str(random.randint(1000, 9999))
def get_a_new_word(): length = 4 r = RandomWords() word = '' while(len(word) !=length or does_contain_repeated_words(word)): word = r.get_random_word(hasDictionaryDef="true", includePartOfSpeech="verb", minLength=length, maxLength=length) return word
def Add_New_Milestone(self): r=RandomWords() name=r.get_random_word() self.driver.find_element_by_xpath(self.Addnewmilestone_button_xpath).click() self.driver.find_element_by_xpath(self.Name_text_xpath).send_keys(name) self.driver.find_element_by_xpath(self.Probabliity_text_xpath).send_keys('5') self.driver.find_element_by_xpath(self.Save_button_xpath).click()
def generate_word(): rw = RandomWords() word = rw.get_random_word(hasDictionaryDef='true').upper() for i in word: if i == '-' or i == ' ': generate_word() return word
def update_songs(cur, conn): #get a random word from rand word generator r = RandomWords() rw = r.get_random_word() #plug word into spotify and get list of songs get_artists(rw, cur, conn) get_songs(rw, cur, conn)
def execute(self, context): from random_word import RandomWords r = RandomWords() word = r.get_random_word() bpy.ops.object.text_add() ob = bpy.context.object ob.data.body = word return {"FINISHED"}
def getWord(): try: rand = RandomWords() word = rand.get_random_word(hasDictionaryDef="true").lower() except: words = ["summer", "autumn", "winter", "spring"] word = words[random.randrange(0, words.__len__())] return word
def create_list(length): r = RandomWords() list = [] for i in range(int(length)): list.append(r.get_random_word()) print(list) return list
def update_songs(cur, conn): result = 1 while result == -1: #get a random word from rand word generator r = RandomWords() rw = r.get_random_word() #plug word into spotify and update tables result = get_songs(rw, cur, conn)
def concat(string): global RANDOM from random_word import RandomWords if RANDOM is None: RANDOM = RandomWords() r = RANDOM.get_random_word() return f'{r} {string}'
def __generate_word(self): r = RandomWords() return r.get_random_word(hasDictionaryDef="true", includePartOfSpeech="noun,verb", minCorpusCount=1, maxCorpusCount=10, minDictionaryCount=1, maxDictionaryCount=10, minLength=5)
def hangman(): r = RandomWords() wor = r.get_random_word() word = list(wor) word1 = wor guess = len(word) segment1 = list(len(word) * "_") length = len(word) while 0 <= guess <= len(word1) + 1: segment3 = [] print(f'You have {guess} chances left! ') ui = list( input( f'Guess the letter it is a {len(word)} letters word. Only {length} letters limited : ' )) if len(ui) <= length: for item in ui: if item in list(word): length -= 1 value = word.index(item) segment1[value] = item word.pop(value) word.insert(value, "_") else: print(f"Not allowed {len(ui)} letters!") if not 0 <= guess <= len(word1) + 1: break if length == 0: break for item in segment1: segment3.append(item) segment2 = '' for i in segment3: segment2 += i print(segment2) guess -= 1 if length == 0: print('You nailed it!') print(str(wor)) else: print("Sorry, you failed it!") print(str(wor))
def plot_image(ax, fontsize=12, nodec=False): global image_heap #im sure this means *something* ax.plot([1, 2]) #switches between processes to run on images switcher = { 1: skin.find_skin(image_path), 2: skin.show_skin(image_path), 3: faces.detect_faces(image_path), 4: autocanny.canny_op(image_path, 0), # 0 = wide_canny 5: autocanny.canny_op(image_path, 1), # 1 = tight_canny 6: autocanny.canny_op(image_path, 2), # 2 = auto_canny 7: cv2.cvtColor(original, cv2.COLOR_RGB2BGR), 8: sonic_fux, 9: happy_tree, #10: cv2.imread(image_path), #11: cv2.imread(image_path), #12: cv2.imread(image_path), #13: cv2.imread(image_path), #14: cv2.imread(image_path), #15: cv2.imread(image_path), #16: cv2.imread(image_path), } #assign new image based on an operation, see bove new_image = switcher.get(count, lambda: "invalid image processor") dr = RandomWords() #get random word for filenames rdmwd1 = dr.get_random_word() rdmwd2 = dr.get_random_word() indy_img_dir = "{}/{}.{}.{}.png".format( "processed_images/individual_images", filename, rdmwd1, rdmwd2) #add new_image to this #ax.imshow(new_image) #no idea what this does ax.locator_params(nbins=3) status = cv2.imwrite(indy_img_dir, new_image) print("Image written to file-system : ", status) #no idea what this does if not nodec: ax.set_xlabel('x-label', fontsize=fontsize) ax.set_ylabel('y-label', fontsize=fontsize) ax.set_title('Title', fontsize=fontsize) #not a f_cking clue. else: ax.set_xticklabels('') ax.set_yticklabels('')
def generator(request): r = RandomWords() if 'counter' not in request.session: request.session['counter'] = 0 request.session['counter'] += 1 try: request.session['word'] = r.get_random_word(minLength=13, maxLength=17) except: request.session['word'] = "whoopsiedoodle" return render(request, "index.html")
def startRound(): global totalScore r = RandomWords() nextR = RandomWords() randomWord = r.get_random_word(hasDictionaryDef="true") if verifyWordHasAntonym(randomWord): userGuess(getAntonymList(randomWord), randomWord) else: startRound()
def game(): os.system('cls') r = RandomWords() randword = str(r.get_random_word()) randword = randword + "\n\n" word = input(randword) game() if word == "exit": main()
class WordGame: def __init__(self): self.dic = PyDictionary() self.rw = RandomWords() self.playing = True self.compwords = [] self.playerwords = [] def play(self): gui.display("Wellcome to Word Game. Let's play") talk("Wellcome to Word Game. Let's play") while self.playing: compword = self.rw.get_random_word(hasDictionaryDef="true") self.compwords.append(compword) gui.display(compword) talk(compword) reply = command() if reply != 'none': if self.dic.meaning(reply) != None: if compword[-1] == reply[0]: if reply not in self.playerwords and reply not in self.compwords: self.playerwords.append(reply) else: gui.display("you used that word already") talk("you used that word already") gui.display("you loose") talk("you loose") self.playing = False else: gui.display("Against the rule, you loose") talk("Against the rule, you loose") self.playing = False else: gui.display("Not a Real Word, You loose") talk("Not a Real Word, You loose") self.playing = False else: gui.display('Too late!! You loose') talk("too late, you loose") self.playing = False
def get_random(): global randomWord global randomWord1 r = RandomWords() randomWord= r.get_random_word(hasDictionaryDef="true",includePartOfSpeech="noun,verb", minDictionaryCount=1, maxDictionaryCount=10, minLength=4, maxLength=4) randomWord = randomWord.lower() # print(randomWord) randomWord1 = randomWord randomWord = removeDupWithoutOrder(randomWord)
def generate_random_word() -> str: """ This function generates random english word using python package Random-Word Returns: str: generated word """ random_word_obj = RandomWords() new_random_word = random_word_obj.get_random_word(hasDictionaryDef="true", includePartOfSpeech="noun", minLength=5, maxLength=8) return new_random_word
def get_random_word(): r = RandomWords() n_attempts = 0 word = None while word is None: if n_attempts > 1000: raise Exception("this random word shit broke") try: word = r.get_random_word(includePartOfSpeech="noun") except: n_attempts += 1 pass return word