A Python project that takes a verb and a subject word from the user, and generates a grammatically structured English sentence using simple grammar rules and random elements.
一个 Python 项目,用户输入一个动词和一个主语,程序会根据语法规则随机生成一个英文句子。
python main.py
Please input a simple verb, like "walk" "talk" "do" "fly"... The code will find the matched object.
请输入简单的动词,程序会根据此动词找到合适的宾语
If the verb is too hard for the code, the code will continuously print sentences structures.
如果此动词过于复杂,程序会持续输出句子模板,因为它找不到合适的宾语
It could be a name or anything. This word will be the subject of the sentence. 此词将成为句子的主语
Then the code will randomly generate a sentence. 随机的句子将会生成并输出
pronoun verb Noun (preposition Noun)*n
句子模板为:主语 + 谓语 + (宾语)+ (介词短语)*n
input: eat, Hank
output: Hank eat an apple in the yard
Thanks for the Department of Linguistics and the Institute for Advanced Computational Science (IACS) at Stony Brook University
Thanks for my mentor Logan
感谢石溪大学语言学系和高级计算科学研究所 (IACS)
感谢我的导师 Logan