Skip to content

ckmarkoh/AcrosticPoemJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

簡介

本程式可以自動產生藏頭詩。

本程式以Ngram為語言模型,先從兩萬首全唐詩中算出Ngram的統計數值,再用Viterbi演算法拼湊出藏頭詩中的每個字, 得出的藏頭詩,看起來很像詩詞但語意未必通順。

##用法:

var m = new PoemGen();

m.setting({
    position:position,
    length:length,
    input_str:input_str,
});

m.run(function(result){
    console.log(result);
});

setting(arg) :設定參數

arg.input_str : 想要藏頭的字
arg.length : {5,7}, 每句幾個字(五言或七言)
arg.position : {1,2,3,4,5,6,lr,rl}, 藏字的位置(第幾個字,或左右斜下)

run(callback) :開始執行

callback: 回傳結果的函式

About

藏頭詩自動產生器javascript版

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages