汉语句子语法图
python代码
import graphviz
import os
#os.environ["PATH"] += os.pathsep + r"D:\Software_install\graphviz-2.46.1\Graphviz\bin"
os.environ["Path"] += os.pathsep + r"D:\Software_install\graphviz-2.46.1\Graphviz\bin"
text4cn='''
digraph graph4cn {
graph [label="汉语句子语法图" fontname="SimSun" charset="utf-8"
compound=true fontsize=11 bgcolor="black" rankdir=TB]
node [fontname="SimSun" shape=box fontcolor="white" color="white"]
edge [fontname="SimSun" fontcolor="white" color="white"]
"语义类型" [label="" image="image\\semantic_type_4cn.png" style="dashed"]
"谓词性词语" [label="" image="image\\verbal_words_4cn.png" style="dashed"]
"体词性词语(名词性词语)" [label="" image="image\\nominal_words_4cn.png" style="dashed"]
"从句" [label="" image="image\\clauses_4cn.png" style="dashed"]
"多层结构" [label="" image="image\\multilayer_structure_4cn.png" style="dashed"]
"汉语句子成分" -> "主语"
"主语" -> "主语的构成"
"主语的构成" -> "体词性词语(名词性词语)"
"主语的构成" -> "谓词性词语"
"主语的构成" -> "从句"
"主语" -> "语义类型"
"汉语句子成分" -> "谓语"
"谓语" -> "谓语的构成"
"谓语的构成" -> "谓词性词语"
"谓语的构成" -> "体词性词语(名词性词语)"
"谓语" -> "语义类型"
"汉语句子成分" -> "述语"
"述语的构成" [label="" image="image\\descriptive_4cn.png" style="dashed"]
"述语" -> "述语的构成"
"汉语句子成分" -> "宾语"
"宾语" -> "宾语的构成"
"宾语的构成" -> "从句"
"宾语" -> "语义类型"
"注意" [label="" image="image\\attention_4cn.png" style="dashed"]
"汉语句子成分" -> "定语"
"定语的构成" [label="" image="image\\attribute_4cn.png" style="dashed"]
"定语" -> "定语的构成"
"定语" -> "语义类型"
"定语" -> "多层结构"
"汉语句子成分" -> "状语"
"状语的构成" [label="" image="image\\adverbial_modifier_4cn.png" style="dashed"]
"状语" -> "状语的构成"
"状语" -> "语义类型"
"状语" -> "多层结构"
"状语" -> "从句"
"定语与状语的区别" [label="" image="image\\difference_of_attribute_n_adverbial_modifier_4cn.png" style="dashed"]
"定语" -> "定语与状语的区别"
"状语" -> "定语与状语的区别"
"汉语句子成分" -> "补语"
"补语的构成" [label="" image="image\\complement_4cn.png" style="dashed"]
"补语" -> "补语的构成"
"补语" -> "语义类型"
"补语与宾语的区别" [label="" image="image\\difference_of_complement_n_object_4cn.png" style="dashed"]
"补语" -> "补语与宾语的区别"
"宾语" -> "补语与宾语的区别"
"汉语句子成分" -> "中心语"
"center_4cn" [label="" image="image\\center_4cn.png" style="dashed"]
"中心语" -> "center_4cn"
"汉语句子成分" -> "独立语"
"longly_4cn" [label="" image="image\\longly_4cn.png" style="dashed"]
"独立语" -> "longly_4cn"
}
'''
dot = graphviz.Source(text4cn, format="svg")
dot.render(outfile="graph4cn.png")
#dot
结果
图片超过5M无法上传
参考文献
百度百科
https://fanyi.baidu.com/#zh/en/