Namespaces

We couldn't find any namespaces in this artifact. Most often the reason for this is
that the analysis failed or that the artifact has been mispackaged and does not
contain any Clojure source files. The latter might be on purpose for uber-module
style artifacts. Please open
an issue and we'll be happy to look into it.

user> (require 'babel.english)
nil
;; generate a random expression in English
user> (babel.english/morph (babel.english/generate))
"your womens' new cities will lose me"
;; generate an infinite number of random expressions in English
user> (repeatedly #(println (babel.english/morph (babel.english/generate))))
Antonia and Luisa's first sigh
Gianluca's first pizza
you all turn a car down
Juan's short car was knowing the short bicycle
.. hit (control-c to stop) ..
;; generate the first 5 of all the expressions possible
user=> (map #(println (babel.english/morph %)) (take 5 (babel.english/generate-all)))
my first books
some first book
your first book
his first books
that first book
(nil nil nil nil nil)

The function babel.english/generate generates an English expression with no specified constraints: that is, the expression will only be constrained by the English grammar and lexicon defined by Babel.

The generated expression is a Clojure map representing the phrase structure of the expression. We pass this to the function babel.english/morph (short for "morphology") to convert this into a human readable string.

Above, we now provide some constraints to the generation process. Specifically, we require that the expression must be about eating, and that the subject of the eating must be a dog or dogs (the value :dog is the semantics for the English word "dog").