ใช้การรวมกันของโซ่มาร์คอฟและไวยากรณ์ที่ปราศจากบริบทเพื่อสร้างประโยคสุ่มด้วยคุณสมบัติของทั้งสองรุ่นภาษา
สร้างโดย William Gilpin, 2014-2019
การติดตั้งอัตโนมัติ
ดาวน์โหลดและแยกที่เก็บแล้วเรียกใช้
$ python setup.py install
บ่อยครั้งที่ตัวแยกวิเคราะห์จะล้มเหลวในการติดตั้ง ดังนั้นแทนที่จะเรียกใช้
$ pip install git+git://github.com/emilmont/pyStatParser
การติดตั้งด้วยตนเอง
ความต้องการ
การติดตั้งเสริม (เพื่อใช้เครื่องมือทั้งหมด)
ติดตั้งรหัสและการพึ่งพาพื้นฐานด้วยตนเองโดยเรียกใช้คำสั่งเหล่านี้
$ git clone https://github.com/williamgilpin/cfgen
$ conda install nltk
$ pip install git+git://github.com/emilmont/pyStatParser
สำหรับการให้คะแนนไวยากรณ์หรือแก้ไขประโยคที่เกิดขึ้นโดยอัตโนมัติให้ติดตั้งการตรวจสอบภาษาแพ็คเกจ Python
$ pip install language-check
ชี้เครื่องมือไปยังคลังข้อมูลของคุณและตั้งค่าแบบจำลองภาษา ที่นี่เราจะใช้ Frankenstein ของ Mary Shelley 2 กรัม
my_model = GrammarModel('cfgen/full_books/frankenstein.txt', 2)
ตอนนี้สร้างตัวอย่างประโยค
example_sentence = my_model.make_sentence()
corrected_example_sentence = clean_output_text(example_sentence, use_language_tool=True)
print(corrected_example_sentence)
เวิร์กโฟลว์เต็มรูปแบบจะได้รับในไฟล์ demos.ipynb
จากนางแบบที่ได้รับการฝึกฝนเกี่ยวกับ Frankenstein ของ Mary Shelley:
these conversation possessed to his time
those sense all fulfillment, me of affairs a soul been of I.
The next kindness her black, light of it I wished as our perish certainty.
horrible wretch that memory, their lake I to me, which the glad unhappiness
of the paroxysm of a several engagement of Clerval in her apartment and all
mainland, and on a progress, me surprised so divine me.
จากนางแบบที่ได้รับการฝึกฝนในหนังสือการเปิดเผย:
Who said ever to no crown to was the listener and SECOND:
my man, and to the wheat,
and had eat in this angel.
Their pieces kill the sort the angel come up
to another translucent and weep any stone.
Her timeless will measure them to the day,
hold created with earth noises and hurled every nation.
There shown out upon the voice
It be in seventh which is to trample, I.
This tampering opened not for its time.
The land to their moment Who threw their glory to cherish that art.
The glory to the speaking, and at that white appearance, and say given
the thousand for the sake. And said show in myself. And it of no sweet victory
whose gateways enemies was loathe to the bowl
and it for them and worked out as my hast to every vision.
Their noise erase me.