Machine learning the Bible. 聖書を機械学習してキリストを召喚する in English

Python製の深層学習ライブラリ「Keras」をつかって聖書の続編を自動生成するプロジェクト。

聖書をディープニューラルネットワークで学習、その後、ディープニューラルネットワークに数文字の文字列を与え、その文字列に続く文章を自動生成させる。

日本語版では、サンプル元の2バイト文字処理が上手くいかなかったので、諦めて1バイト文字のサンプルを使うことにする。

ksd6700.hatenablog.jp

 

まずは、キングジェームス版の旧約聖書をサンプルに下ごしらえ、

www.gutenberg.org

「Plain Text UTF-8(4.2MB)」をダウンロード

ファイルの頭とお尻についてるテキストを削除

各行の頭についてる数字を置換削除「[0-9]?[0-9]*:[0-9]?[0-9]」→「」

lstm_text_generation.pyから読み込む

 

1回目

----- diversity: 0.2
----- Generating with seed: "nd in gold.

and he went on his journey"
nd in gold.

and he went on his journey, and the lord shall be do the sons of israel and sons of many sons of all the children of israel the lord that were the thirst of the lord of the lord, and said unto him, and the lord said unto him, and said unto him, and the lord said unto him, and the country of the lord of the lord, and the lord said unto him, and the sons of israel and the lord of the lord, and the lord said unto him, and the

----- diversity: 0.5
----- Generating with seed: "nd in gold.

and he went on his journey"
nd in gold.

and he went on his journey.

and he said, i have soul the mighty heart of the name.

and i will be the lord, be cause and camest the days of the lord.

and the sons of is the righteousness of the land of banad, and spake, and said, that he hath die them that were men of israel and time that were the house of the god, which they shall be seed upwith and places, and the land of the fathers, and said unto him, which is sub

----- diversity: 1.0
----- Generating with seed: "nd in gold.

and he went on his journey"
nd in gold.

and he went on his journey.

and the sons of is come and very tedy before israel myns, all the king of us called the son of man hars through.

ye shall doether decoingit ough, the
people unto thee; for, and he would hims
mouthfind to heer; for that take descroy the doeth burnt against the intiblater.

for the lowfing is the gible of all the will against the somecan;
and i come in in a
coars of the trues, and go down for

----- diversity: 1.2
----- Generating with seed: "nd in gold.

and he went on his journey"
nd in gold.

and he went on his journey against tion.

hmel slinced he
hath
selaw, and fou wind o,
strea i
.

that will give them thus, i
will make gera, and fertywed unto pharaeing, the oricrig and his sing offorions
of
sheching: and sanctan thinea
ear of
came
upon a dayonsok congide
a gomeral oned: and after he created salkings.

whererevalsioes came to persenuted bethjoms borination.

that there or hous in hiighth reasure
sav

「and」の「a」がかけてしまっているので、結果が怪しい.....。 

Google翻訳にかけてみる

-----多様性:0.2

種と一緒に生み出す: "金の中にnd。

彼は旅に出た "
金でnd。

彼は旅に行き、主はイスラエルの息子、イスラエルのすべての子孫の多くの息子、主人の渇きたる主人となり、主に言われた。主人は彼に言った、そして主人の主の国、および主は彼に言った、イスラエルの息子および主の主、および主は彼に言った、 そしてその

-----多様性:0.5
種と一緒に生み出す: "金の中にnd。

彼は旅に出た "
金でnd。

彼は旅に出た。

と彼は言った、私は魂の名の強大な心を持っています。

そして私は主人になり、主人の時代を引き起こしているでしょう。

の子孫はバナデの地の正義であり、語り、言った、「イスラエルの人たちである者と、神の家であった時に、彼らが死ぬと、彼らは死ぬことになる。父祖の地、そして彼に言った。

-----多様性:1.0
種と一緒に生み出す: "金の中にnd。

彼は旅に出た "
金でnd。

彼は旅に出た。

息子たちはイスラエル人の前に来て、非常に悲しんでいます。私たちのすべての王は、人の子と呼ばれています。

あなたがたはそれを解き放つであろう。
あなたへの人々。のために、彼は彼になります
口笛を吹く。その奪い取る者のために誓いを立てる者のために燃え上がる。

貧乏人はsomecanに対するすべての意志の可愛らしさです。
私は
真実の剣、そして

-----多様性:1.2
種と一緒に生み出す: "金の中にnd。

彼は旅に出た "
金でnd。

そして、彼は法律に反して旅を続けました。

hmelは彼を襲った
hath
selaw、fou風o、
ストリート

それは私にそう与える、私
ゲラを作るでしょう、そしてファラオに、オリーブと彼の歌の罪

シェリング:とsanctan thinea
耳の
来た
昼間のコンジドで
ゴメラがoned:と彼はsalkingsを作成した後。

回復がベシェムズボリネーションを鎮圧するようになった。

それがそこにあるか、または、
セーブ

1日まわした結果は後ほど