하이쿠를 생성하는 프로그램을 어떻게 작성 하시겠습니까?
컴퓨터 하이쿠
당신
을 위해 프로그램 을 작성하는 방법
시도하지 마십시오
시는
금속 및 비트와 잘 섞이지 않습니다
더 진지하게, 좋은 하이쿠 (심지어 나쁜 하이쿠)는 음절을 세는 것보다 의미와 이미지를 압축하는 데 훨씬 더 가깝습니다. 일반적으로 자연에서 수집 한 주제를 기반으로합니다. 임의의 단어 생성과 음절 계산은 의미없는 의미를 측정하지만시는 아닙니다 ...
음절 측정
의미 흐름 이해
목표를 달성 할 수 있습니다.
먼저, Markov chains 를 살펴보고 , 두 번째로 Virtual Muse 라는 컴퓨터 생성시에 관한 책이 있습니다 .
- 음절을 세다
- 무작위로 단어 생성
- 현명하게 정리하다
Haikus는 쉽습니다.
솔루션이 잘 문서화되어 있고 기능
이 제대로 작동하지 않습니다.
너무나도 간단합니다. 코딩이 너무 쉽습니다.
나에게 라임 릭을 코딩 한 다음 투표하겠습니다.
// 실제로 하이쿠를 좋아합니다
모든 하이쿠의 음절 수가 같지는 않지만 시작하는 곳입니다.
실제로 단어를 고르는면에서는 말의 일부가 내가 시작할 곳이 아닐 것이라고 생각합니다. 대신 Markov 체인을 살펴보고 기존 하이쿠에 대한 어휘를 훈련합니다.
에 하이쿠 마을 , 우리는 쉽게 다양한 방법으로이 작업을 수행 할 수있는 기술을 가지고있다. 한 가지 아이디어는 단순히 글로벌 트위터 피드를 읽고 의도하지 않은 하이쿠를 감지하는 것입니다. 백엔드에도 사전이 있기 때문에 의심스러운 하이쿠를 만들 수는 있지만 품질이 부족할 것 같습니다.
별 등급 시스템이 있다면 기계 학습을 사용하여 '좋은 것'을 결정할 수 있다고 생각합니다.
for (i is 0
and i is less than thirteen)
print s i plus plus
"열일곱 음절로 자신의 기분을 전하는 것은 매우 다르다..." (위대한 John Cooper Clarke 내가 좋아하는 Beasley Street를 확인하십시오 )
컴퓨터에 대해 얼마나 차이가 있습니까? 논리는 기분을 모른다 :)
읽을 수 있도록 사전을 음절 개수와 함께 명사, 동사, 형용사로 분리하십시오.
양식의 몇 가지 템플릿을 생각해보십시오.
[명사] [동사] "s"
[동사] a (n) [형용사] [명사]
[형용사] [명사]
사전을 아름다운 단어로 다듬습니다.
음절 개수로 주석이 달린 사전에서 추출한 하이쿠를 생성하는 유전 알고리즘을 구현 한 다음 사람들에게 비용을 지불하고 피트니스 함수 [기계적 터크가 도움이 될 것임]로 평가합니다. 시간이 지남에 따라 프로그램은 몇 가지 좋은 프로그램을 발전시켜야합니다.
편집하다:
피트니스에주의를 기울이면 필요한 GA
는 CPU 속도로 진화
합니다.
당신의 프로그램은
은유와 이미지를
이해하고 창의적이어야합니다.
나는 구문 프로그래밍과 언어를 찾아보고 문법 구조에 대한 라이브러리를 찾으려고 노력할 것입니다. 거기에서 단어 개수와 음절 개수 제한을 추가하는 간단한 단계가 있어야합니다.
여기에서 어떤 사람들은 사전을 사용하고 Markov Chain을 사용하여 단어 시퀀스를 생성 할 것을 제안했습니다 . 이론적으로 실행 가능한 솔루션 인 것 같습니다. 특히 고차 Markov Chain (바이 또는 트라이 그램이 아님)을 사용하는 경우 더욱 그렇습니다.
하지만 실제로는 기존 하이쿠의 데이터베이스를 수집하고 그 안에있는 단일 단어 를 선택적으로 변경할 수 있다면 더 잘 작동 할 것이라고 생각 합니다 (예 : 주어진 단어를 의미 적으로 관련된 다른 단어로 변경). 기존 하이쿠는 어떤 종류의 구조와 응집력을 제공하며, 새로운 하이쿠 (이전 하이쿠의 변형)를 만들기 위해 그 안에있는 작은 부분 만 (교환) 변경하면됩니다.
물론이 방법으로 완전히 새로운 하이쿠는 아니지만 적어도 독자들에게는 다소 즐겁습니다.
Parse existing haikus in a relational order, like word xx used after yy n times. So when creating, possibility of xx coming after yy will be (n / sum of count of all words used after yy). This way it will be selectively randomized and can still be a valid haiku.
Write your program to generate Haiku's in Japanese. It will be far easier to measure your syllable count, pluse you are staying faithful to the original language of the poetry. If you have flexibility with the project, why not make the original Japanese - then show the English word by word literal translation by its side. It will look mysterious to say the least.
Anyways, just a different take on the problem.
Markov Sequences
A syllabic Database
Three lines of python
I'd start with some kind of dictionary file that contains a syllable count of each word in it. Then pick words from that add up to the required syllables/line
As to making it poetry, and not just random words, I have no idea.
You could, in addition to using Ian's idea of syllable counts, also categorize the words by part of speech and generate phrases.
From the semantic sude of the story use sampling and fourier transformation. Pick significant parts of some detailed description reduced in single words and leave to a reader to fill in gaps with her own imagination
The algorithm for having a computer output high quality haiku works something like this:
Setup Phase
loop:
find the email address of a world-renowned writer of haiku
confirm that this person is willing to generate haiku on demand
until sucker^H^H^H^H^H^Hwriter is found
Execution Phase
loop:
wait for a haiku request
when a haiku request is received, email the previously-stored master and ask for a haiku
wait for the haiku to return by reply
output haiku
There are, of course, various enhancements which can be made upon this fundamental architecture. For example the setup phase can be extended to set up a pool of haiku experts. The execution phase can be used to generate haiku during idle times and cache them against future demand. The specifics of such tweaking are left as an exercise for the student.
I love this question. It is very imaginative. Answer Below.
Many people have suggested Markov chains, but I really don't think it would be possible. You need to know intelligently whether the syllable is a PHONEMES then you have to know where the syllable ends.
If you ever did this I would be amazed.
참고URL : https://stackoverflow.com/questions/504428/how-would-you-write-a-program-to-generate-haiku
'Nice programing' 카테고리의 다른 글
Android에서 SVG 지원 (0) | 2020.10.12 |
---|---|
Google 프로토콜 버퍼-자바 스크립트 (0) | 2020.10.12 |
PowerShell에 권장되는 코딩 스타일은 무엇입니까? (0) | 2020.10.12 |
시퀀스 대 정체성 (0) | 2020.10.12 |
다른 저장소에서 Git 가져 오기 (0) | 2020.10.12 |