Package: ipsum
ipsumIpsum is a Python library for the generation of international placeholder text.Unlike most other generators which work by scrambling a
particular text (e.g. Lorem Ipsum generators with Cicero's "De Finibus Bonorum
et Malorum"), it instead uses Markov models to generate
a vocabulary of meaningless new words that resemble the language it was trained
on. This allows for the generation of text that is typographically similar to a
specified language (i.e. uses the same alphabet and punctuation, in the same manner
and at the same frequency), but is semantically meaningless.You can read more about how Ipsum workshere.You can use Ipsum directly from your browser by accessing the web app atipsum.trifunovski.me.It currently supports the following languages:EnglishGermanAlbanianBulgarianDutchEnglishFrenchGermanGreekItalianMacedonianSerbianSpanishSwedishInstallingNote thatipsumrequires Python >= 3.8.1.Runpip install ipsumto install the latest published version of the library, or clone the repo and
usepoetrygit clone git@github.com:dtrifuno/ipsum
cd ipsum/ipsum
poetry installto install a development copy.Usageimportipsum# Load the English language modelmodel=ipsum.load_model("en")# Returns a list of 3 strings, each resembling a paragraph of Englishparagraphs=model.generate_paragraphs(3)# Returns a list of 10 strings, each resembling a full sentence of Englishsentences=model.generate_sentences(10)# Returns a list of 50 words (does not include any punctuation)words=model.generate_words(50)DevelopmentTypechecking, linting and testingYou can runpoetry run mypy /src /teststo typecheck,poetry run flake8to lint, orpoetry run pytest --covto test the code.Additional scriptsThis repository contains several scripts that are useful in development, but are
not included with the PyPI package. If you want to make a change to this library,
please clone the repository instead. You can check out these scripts and what
they do by runningpoetry run dev.Adding a languageFind out the two-letterISO 639-1code of
the language you want to add (xxfor the rest of this subsection). Add the
full English name and ISO 639-1 code of the language tosupported_languages.py.Prepare a corpus of texts in the language. The corpus should be packaged as a
zip archive of.txtfiles.Write a parser for the language (look atsrc/ipsum/parse/en_parser.pyfor
an example). Name theParserinstancexx_parserand save it assrc/ipsum/parse/language/xx.py. Add the parser instance toload_parserinsrc/ipsum/parse/__init__.py.Runpoetry run dev parser-diagnostics xx. Ideally, the parser should
detect around 100,000 sentences and be able to parse into skeletons more
than 50–60% of them.Runpoetry run dev build_model xx && poetry run model_diagnostics xx.Inspectdiagnostics/xx.png. If it looks good, congrats, you are done!
Otherwise, return to Step 2 and try to figure out what went wrong.CorporaThe models were trained on the following corpora:Albanian:Leipzig Corpora Collection - 2020 Albanian News 100k SentencesBulgarian:Bulgarian National Corpus - Diachronic corpus for the period of 1951–2021Dutch:Leipzig Corpora Collection - 2020 Dutch News 100k SentencesEnglish: Selections fromComputational Stylistics Group - 100 English Novels ver. 1.4French:Leipzig Corpora Collection - 2018 French News 100k SentencesGerman:Computational Stylistics Group - 68 German NovelsGreek:Monolingual Greek corpus in the culture domainItalian:Leipzig Corpora Collection - 2019 Italian News 100k SentencesMacedonian: Selections fromElectronic Corpus of Macedonian Literary Texts - 135 Тома Македонска КнижевностSerbian:Leipzig Corpora Collection - 2016 Serbian Wikipedia 100k SentencesSpanish:Leipzig Corpora Collection - 2016 Spanish News 100k SentencesSwedish:Leipzig Corpora Collection - 2019 Swedish News 100k SentencesLicenseMIT