The world’s leading publication for data science, AI, and ML professionals.

Artificial Intelligence Genesis: Literally.

Yep. Actual bible AI. Let's see what we can see with some Natural Language Processing (NLP), and an English language version of the book of…

Yep. Actual bible AI. Let’s see what we can see with some Natural Language Processing (NLP), and an English language version of the book of Genesis (included in nltk corpora). For a nice online version of the English and Hebrew text have a look at this website. This article is about getting a computer to understand names in Genesis, and NOT about bible codes or hidden messages.

I am a religious person, raised with a lot of bible study and analysis. The raw text of the bible is accompanied by the commentary of scholars such as Rashi, Onkelos, the Mishna, and the Gemara. Let’s restrict our text analysis to an English language version of Genesis without the commentary, as we seek to understand some meaning for a computer to glean from Patriarchal names.

Genesis: Literally.

_"Essentially, all models are wrong, but some are useful" – George E. P. Box_

With this humbling quote in mind, let’s have a look at Adam, Noah, Abraham, Isaac, and Jaacob. How are they related in the text? How can we extract data about their roles using NLP?

Remember that these people have more than one name in the bible. Adam, Noah, Abraham (Abram before his name change), Isaac, and Jacob (Israel after his name change). Let’s remember to keep both names in mind for Jacob and Abraham. Let’s also not ignore the fact that Israel is sometimes Jacob, sometimes the land of Israel, and sometimes the nation of Israel.

First we look at the context, number of mentions, and where they were mentioned. Next we can look at the meaning for the names in the text. We see in the figure below that Adam and Noah are mentioned quite a bit early in Genesis one after the other, and then they are no longer mentioned. Abram is renamed to Abraham around word #12,000 and then we stop hearing about Abram and only hear about Abraham. The bible often refers to "Abraham, Isaac, and Jacob" together as our forefathers, and so we see those 3 names showing up together in the text in the same spots. When Jacob is renamed to Israel we see both names together, unlike Abram/Abraham where we only see one and then the other.

The number of times each name was mentioned had a few surprises: (Adam 18, Noah 41, Abraham 129, Abram 58, Isaac 77, Jacob 179, Israel 40). Noah is mentioned more times than Adam! See the raw readout in the image below.

And Jacob’s 179+40=219 mentions are more than Abraham’s 129+58=187. Perhaps the many uses for the word Israel (person, place, tribe) give Jacob some extra mentions that we should not be counting.

Now, back on task. What words are these names similar to within this text?

Adam similar to:joseph jacob isaac abram shem they he i abraham noah him rachel thee god leah she cain sarah me us

Noah similar to:jacob him joseph pharaoh abraham he isaac them esau me thee god shem abram all th sodom arphaxad rachel heaven

Abraham similar to:jacob joseph they he isaac pharaoh him god esau abram laban she noah them me all thee israel lot i

Abram similar to: joseph jacob he abraham isaac him them pharaoh they god esau laban thee leah me rachel she lot us judah

Isaac similar to: jacob joseph he abraham they she abram god laban esau pharaoh leah thee rachel rebekah sarah judah noah i israel

Jacob similar to: he joseph abraham they isaac god pharaoh abram esau him rachel israel i noah me them thee laban leah judah

Israel similar to: jacob abraham joseph they he isaac god esau sarah abram pharaoh all lamech him rachel heaven famine rebekah egypt sarai

The first good sign in the results above is that these names are similar to other names, and not to random words. Another good sign is that Israel is most similar to Jacob, and Abraham and Abram are similar too. This lets us know that there is some relationship between these names. Another good sign is that all of these names were related to God, as in "God spoke to Abraham," indicating that these people are related to God in the text of Genesis.

Now let us understand a bit more about these names. So far they are simply text labels. What do these names mean to our AI? Well, using the Synset library, we can devise the following meaningful relationship between Isaac and Noah using their semantic similarity:

noah = wn.synset('noah.n.01')
isaac = wn.synset('isaac.n.01')
print(noah.lowest_common_hypernyms(isaac))

We get the answer [Synset(‘patriarch.n.03’)], which tells us the common relationship between these words is that they both refer to patriarchs. This is a pretty cool amount of data from simply ingesting bible text.

Conclusion

This was a demo of a super tiny amount of the power available using NLP. The system was able to identify relationships between patriarchal names and associate a common idea between these names. Add-on techniques from other areas of machine learning can make this approach even more powerful. Although I prefer "newer" neural approaches to word embedding than the one shown here, I continue to find value in these hand-crafted text analysis tools built over many years of text processing research.

Happy Coding!

-Daniel [email protected] ← Say hi. Lemay.ai 1(855)LEMAY-AI

Other articles you may enjoy:


Related Articles