Random word generator in Russian

I need a word generator in python, I know that there is a Random-Words package for this. Are there any alternatives for other languages? Italian, Spanish, Portuguese are a priority.

I know this method

import requests

Word_site = "http://svnweb.freebsd.org/csrg/share/dict/words?view=co&content-type=text/plain"

response = requests.get(Word_site)
WORDS = response.content.splitlines()

But again, here is the import of the English dictionary

1 answers

I suggest storing the words locally, in a txt file (in this form, they are the easiest to get) Accordingly, the code:

with open('dict.txt', 'r') as file:
    words = file.readlines().
    words = [s.strip("\n") for s in words]

Writing a random word generator

import random
def random_word(words):
   return random.choice (words)

The list of words can be easily downloaded from the Internet. For example https://github.com/dwyl/english-words/blob/master/words.txt http://blog.harrix.org/article/3334

Translate this request into the language you need using Google Translator and in the output one of the first sites will contain the one you need information enter a description of the image here Also, if you can't find a list of words in the public domain, or you can't use it for corporate reasons, you can easily parse the list of words from Wikipedia, for example, or another website. In the desired language, 1000-3000 pages are opened and all words that are not yet in the dictionary are added. All this procedure will take a couple of hours, but you will have at least an incomplete, but sufficient dictionary for random word generation.

 1
Author: BlueScreen, 2020-05-08 20:08:00