示例#1
0
from gram import Gram
gr1 = Gram()
gr1.font = 'helvetica'
gr1.baseName = 'gramInGram'
gr1.text("Embedding gram", 0,0)
gr2 = Gram()
g = gr2.text("Embedded gram",0,0)
gr2.gX = 0.3
gr2.gY = 0.5
gr1.grams.append(gr2)
gr1.pdf()
gr1.svg()
示例#2
0
from gram import TreeGram,TreeGramRadial,Gram
read("((A,B)ab,C,(D,E)de)m;")
t = var.trees[0]
t.node(1).br.uName = 'X'
t.node(5).br.uName = 'Y'
tg = TreeGram(t, scale=7.)
print "a", tg.internalNodeLabelSize
tg.baseName = 'twoTreesII'
t = t.dupe()
tgB = TreeGramRadial(t, scale=8.,
                     slopedBrLabels=True,
                     rotate=90)
print "b", tg.internalNodeLabelSize
tgB.tree.root.label.yShift = 0.1
tgB.gX = 4.8
tgB.gY = -1.5
gr = Gram()
g = gr.text(r'$\Longleftrightarrow$', 0, 0)  # LaTeX symbol
gr.text('equivalence', 0, 0.5)
gr.gX = 3.5
gr.gY = 1.0
tg.grams.append(tgB)
tg.grams.append(gr)
tg.png()
g.rawText = '⇔'       # unicode symbol
tg.svg()
示例#3
0
from gram import Gram
gr1 = Gram()
gr1.font = 'helvetica'
gr1.baseName = 'gramInGram'
gr1.text("Embedding gram", 0, 0)
gr2 = Gram()
g = gr2.text("Embedded gram", 0, 0)
gr2.gX = 0.3
gr2.gY = 0.5
gr1.grams.append(gr2)
gr1.pdf()
gr1.svg()