NaNoGenMo / 2021

National Novel Generation Month, 2021 edition.
45 stars 8 forks source link

人工知能句集 - Collection of Artificial Intelligence Haiku #71

Open HylisWilk opened 2 years ago

HylisWilk commented 2 years ago

This will be my first NaNoGenMo submission. It's a rule-based system for generating Haiku in Japanese. A lot of the metrics for evaluating individual verses and entire haiku have to do with Japanese word embeddings and cosine similarity.

I'll be posting the code and final pdf on the https://github.com/HylisWilk/HaikuAI repository within the next few days. (The repo is empty right now, but I'm already doing the finishing touches on everything).

Here's a teaser of a few of the haiku generated, along some (bad) free hand translation by myself:

弱い山
枯木を捨てる
空の海

Yowai yama
Kareki wo suteru
Sora no umi

(Weak mountain, discarding dead trees, the sea of heaven)

長い今朝
焚火を上る
暇の国

Nagai kesa
Takibi wo agaru
Hima no kuni

(Long morning, Climbing the open fire, In the land of leisure)

In total there'll be between 3 and 4 thousand haiku, most of which probably nonsensical, and I'll be updating this issue and the repo as I improve the results.

enkiv2 commented 2 years ago

This is really cool! Did you bias the vocabulary? The examples you gave all have a lot of nature imagery reminiscent of classic haiku.

On Sun, Nov 21, 2021 at 11:51 AM HylisWilk @.***> wrote:

This will be my first NaNoGenMo submission. It's a rule-based system for generating Haiku in Japanese. A lot of the metrics for evaluating individual verses and entire haiku have to do with Japanese word embeddings and cosine similarity.

I'll be posting the code and final pdf on the https://github.com/HylisWilk/HaikuAI repository within the next few days. (The repo is empty right now, but I'm already doing the finishing touches on everything).

Here's a teaser of a few of the haiku generated, along some (bad) free hand translation by myself:

弱い山

枯木を捨てる

空の海

Yowai yama

Kareki wo suteru

Sora no umi

(Weak mountain, discarding dead trees, the sea of heaven)

長い今朝

焚火を上る

暇の国

Nagai kesa

Takibi wo agaru

Hima no kuni

(Long morning, Climbing the open fire, In the land of leisure)

In total there'll be between 3 and 4 thousand haiku, most of which probably nonsensical, and I'll be updating this issue and the repo as I improve the results.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NaNoGenMo/2021/issues/71, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADXUGNKSZPLF3TRQMB2EJDUNEPSLANCNFSM5IPK5N4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

HylisWilk commented 2 years ago

Thanks! For each haiku there's a seasonal word that kinda gives the haiku its tone, and I grab a few words with similar word embeddings (cosine similarity) to generate the rest of the poem. Sometimes it goes a little weird, but often it generates these nature-ish sentences.

HylisWilk commented 2 years ago

So, the submission is ready on my repository now. The full book can be found here. The automatic translation (Google Translate/DeepL) is pretty wild most of the times, but they make the haiku sound kinda funny.

There's some patterns I need to work on for next time, because they appear repeated many times. Something about word embeddings falling too close to each other most likely.

I'll try to make a selection of the nicest haiku in it, or the funniest ones, and post here over time. Feel free to tell me if you found any you liked as well. Any feedback is appreciated.