Package: nabg
nabg (New-Age Bullshit Generator)What is it?nabglets you generate randomized sentences using pre-defined sentence patterns and a vocabulary. The default vocabulary and sentences are based onSeb Pearce's "New Age Bullshit Generator". You can also provide your own sentence patterns and word lists to generate customized bullshit.Installing nabgnabgis available onPyPI:pipinstallnabgUsageGenerating New-Age Bullshitnabgcomes with Seb Pearce's "New-Age Bullshit Generator". To generate new-age bullshit, in python you can do:importnabg# Generate new-age bullshitnabg.ionize()# List the available topicsnabg.list_topics()# Generate 5 bullshit sentences with topic historynabg.ionize(5,"history")Or, you can use the CLI:# Generate new-age bullshit$nabg# List the available topics$nabg--list-topics# Generate 5 bullshit sentences with topic history$nabg-n5-thistoryGenerating Custom Bullshitnabgalso lets you use your own sentence patterns and vocabulary to generate sentences.fromnabgimportBullshitGenerator# ---------------------------------------------------------------------------- ## Custom sentence patterns. A dictionary with a list of patterns for each      ## topic. All instances of ${vocabType} will be replaced with a randomly picked ## word of type "vocabType" from the vocabulary.                                ## ---------------------------------------------------------------------------- #patterns={"topic1":["This is a ${adj}sentence.","This is a ${adjPrefix}${adj}sentence."],"topic2":["We can no longer afford to live with ${nMassBad}.","Without ${nMass}, one cannot ${viPerson}.",],}# ---------------------------------------------------------------------------- ## Custom vocabulary. A dictionary with a list of buzzwords for each type.      ## Each type used in a sentence pattern must have at least one word in the      ## vocabulary.                                                                  ## ---------------------------------------------------------------------------- #vocabulary={"adj":["fantastic","stupid","amazing",],"adjPrefix":["ultra-","semi-",],"nMass":["knowledge","truth",],"nMassBad":["pain","suffering",],"viPerson":["exist","believe",],}# Create a bullshit generator objectbullshit_generator=BullshitGenerator(patterns,vocabulary)# Generate custom bullshitbullshit_generator.ionize(5,"topic1")BullshitGeneratorensures that sentence patterns aren't repeated on multiple calls toBullshitGenerator.ionize(). If there are no unused sentence patterns remaining in the pool for the requested topic, another topic is chosen at random. This behavior can be customised by calling any of the three methods below:# The three methods below can be used to set BullshitGenerator's behavior# when no more unused patterns are available for the requested topic.# Pick a different topic at random. This is the default behavior.bullshit_generator.use_random_topic_when_out_of_patterns()# Reset the pool. This would cause previously used patterns to repeat.bullshit_generator.reset_pool_when_out_of_patterns()# Raise a NoPatternsAvailableError.bullshit_generator.raise_error_when_out_of_patterns()When all sentence patterns across all topics have been used up, the pool is reset. This behavior can be customised by calling any of the two methods below:# The two methods below can be used to set BullshitGenerator's behavior# when all patterns across topics have been used up.# Automatically reset the pool. This is the default behavior.bullshit_generator.enable_auto_reset()# Raise a NoPatternsAvailableError.bullshit_generator.disable_auto_reset()You can reset the pool manually at any time by calling:bullshit_generator.reset_sentence_patterns()Note: Successive calls tonabg.ionize()are not guaranteed to have distinct sentence patterns across calls (or in other words, the pool is reset after each call tonabg.ionize()). However, the sentence patterns and vocabulary for the default new-age bullshit generator can be used to create your own instance ofBullshitGeneratorto customize this behaviour:fromnabgimportBullshitGenerator,patterns,vocabulary# Create a BullshitGenerator object using Seb Pearce's pattern and vocabulary setbullshit_generator=BullshitGenerator(patterns,vocabulary)# The calls below are guaranteed to use different sentence patternsprint(bullshit_generator.ionize(3))print(bullshit_generator.ionize(5))print(bullshit_generator.ionize(2))# Reset the poolbullshit_generator.reset_sentence_patterns()# The below call might use the same sentence pattern as one of the above calls as the pool has been resetprint(bullshit_generator.ionize())Developing nabgClonethe repository.gitclonehttps://github.com/naveen-u/nabg.gitCreate and activate a virtual environment:virtualenvvenvsourcevenv/bin/activateTo installnabg, along with along with the tools you need to develop and run tests, run the following in your virtualenv:
:pip3install-e.[dev]ReferencesThe original New-Age Bullshit Generator by Seb Pearce -sebpearce.The Python2 CLI -mcquiggi.AuthorsNaveen Unnikrishnan-Initial work-naveen-uLicenseThis project is licensed under theMIT License- see theLICENSE.mdfile for details.