Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mary is really very happy --> is Mary really very happy?
0.50 S --> NP VP [(0, 1)]
0.50 S --> VP_2 NP [(0, 1, 0)]
1.00 VP --> V VP|<ADV> [(0, 1)]
1.00 VP_2 --> V VP|<ADV> [(0,), (1,)]
0.50 VP|<ADV> --> ADV VP|<ADV> [(0, 1)]
0.50 VP|<ADV> --> ADV ADJ [(0, 1)]
0.50 ADJ --> Epsilon ['happy']
0.50 ADJ --> Epsilon ['sad']
0.50 ADV --> Epsilon ['really']
0.50 ADV --> Epsilon ['very']
1.00 NP --> Epsilon ['Mary']
1.00 V --> Epsilon ['is']
Mary is really happy -/-> is Mary really happy?
left:
1.00 S --> S|<VP> [(0,)]
1.00 S|<NP> --> NP [(0,)]
0.50 S|<VP> --> S|<NP> VP [(0, 1)]
0.50 S|<VP> --> VP_2 S|<NP> [(0, 1, 0)]
1.00 VP --> VP|<ADJ> [(0,)]
1.00 VP_2 --> VP|<ADJ>_2 [(0,), (0,)]
1.00 VP|<ADJ> --> VP|<ADV> ADJ [(0, 1)]
1.00 VP|<ADJ>_2 --> VP|<V> ADJ [(0,), (1,)] <--
1.00 VP|<ADV> --> VP|<V> ADV [(0, 1)]
1.00 VP|<V> --> V [(0,)]
0.50 ADJ --> Epsilon ['happy']
0.50 ADJ --> Epsilon ['sad']
1.00 ADV --> Epsilon ['really']
1.00 NP --> Epsilon ['Mary']
1.00 V --> Epsilon ['is']
right:
1.00 S --> S|<NP> [(0,)]
0.50 S|<NP> --> NP S|<VP> [(0, 1)]
0.50 S|<NP> --> S|<VP>_2 NP [(0, 1, 0)]
1.00 S|<VP> --> VP [(0,)]
1.00 S|<VP>_2 --> VP_2 [(0,), (0,)]
1.00 VP --> VP|<V> [(0,)]
1.00 VP_2 --> VP|<V>_2 [(0,), (0,)]
1.00 VP|<ADJ> --> ADJ [(0,)]
1.00 VP|<ADV> --> ADV VP|<ADJ> [(0, 1)]
1.00 VP|<V> --> V VP|<ADV> [(0, 1)]
1.00 VP|<V>_2 --> V VP|<ADJ> [(0,), (1,)] <---
0.50 ADJ --> Epsilon ['happy']
0.50 ADJ --> Epsilon ['sad']
1.00 ADV --> Epsilon ['really']
1.00 NP --> Epsilon ['Mary']
1.00 V --> Epsilon ['is']
sent = "das muss man jetzt machen".split()
tree = Tree("(S (VP (PDS 0) (ADV 3) (VVINF 4)) (PIS 2) (VMFIN 1))")
collinize(tree, horzMarkov=1, tailMarker=''); print tree
(S
(S|<VP>
(VP (VP|<PDS> (PDS 0) (VP|<ADV> (ADV 3) (VP|<VVINF> (VVINF 4)))))
(S|<PIS> (PIS 2) (S|<VMFIN> (VMFIN 1)))))
collinize(tree, horzMarkov=2, tailMarker=''); print tree
(S
(S|<VP>
(VP
(VP|<PDS>
(PDS 0)
(VP|<PDS-ADV> (ADV 3) (VP|<ADV-VVINF> (VVINF 4)))))
(S|<VP-PIS> (PIS 2) (S|<PIS-VMFIN> (VMFIN 1)))))
collinize(tree, factor="left", horzMarkov=2, tailMarker=''); print tree
(S
(S|<VMFIN>
(S|<PIS-VMFIN>
(S|<VP-PIS>
(VP
(VP|<VVINF>
(VP|<ADV-VVINF> (VP|<PDS-ADV> (PDS 0)) (ADV 3))
(VVINF 4))))
(PIS 2))
(VMFIN 1)))
tree = Tree("(S (NN 2) (VP (PDS 0) (ADV 3) (VAINF 4)) (VMFIN 1))")
collinize(tree, horzMarkov=2, tailMarker=''); print tree
(S
(S|<NN>
(NN 2)
(S|<NN-VP>
(VP
(VP|<PDS>
(PDS 0)
(VP|<PDS-ADV> (ADV 3) (VP|<ADV-VAINF> (VAINF 4)))))
(S|<VP-VMFIN> (VMFIN 1)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment