stanza icon indicating copy to clipboard operation
stanza copied to clipboard

Can't get a binary tree using stanza.pipeline

Open ZhichaoDuan opened this issue 3 years ago • 12 comments

Describe the bug Can't get a binary tree using stanza.pipeline

ZhichaoDuan avatar Apr 20 '22 02:04 ZhichaoDuan

Can't get a binary constituent tree using stanza.pipeline where constituency is already included.

ZhichaoDuan avatar Apr 20 '22 02:04 ZhichaoDuan

Right, we don't have a concept of headfinder, so we don't really have a good way to binarize the trees. What do you need this for?

AngledLuffa avatar Apr 20 '22 02:04 AngledLuffa

Actually I tried to use Tree-LSTM on my own data, but the number of child of each node is uncertain..

ZhichaoDuan avatar Apr 20 '22 02:04 ZhichaoDuan

You can try using a left binarization rule, or a right binarization rule, or switching the tree lstm mechanism to use the average or max of the inputs

AngledLuffa avatar Apr 20 '22 02:04 AngledLuffa

Or can I use the constituency parser in corenlp?

ZhichaoDuan avatar Apr 20 '22 02:04 ZhichaoDuan

I did it, using NLTK tree transform. Truely thanks for you quick reply

ZhichaoDuan avatar Apr 20 '22 03:04 ZhichaoDuan

now i'm wondering if maybe a "binarize" operation in the tsurgeon utility would make sense could have left & right & known headfinder algorithm as options.

or use a dependency treebank to learn how to make a headfinder over constituencies predicting which is the head might make parsing more accurate

AngledLuffa avatar Apr 20 '22 03:04 AngledLuffa

NLTK tree

can you tell me how to use NLTK tree transform in stanza?please

kkeleve avatar May 04 '22 15:05 kkeleve

Well, actually I first use stanza to parse the constituency, then I use nltk library to build up an instance of nltk.tree, then I use nltk transform tools to convert the tree into its "chomsky_normal_form", done.

ZhichaoDuan avatar May 05 '22 14:05 ZhichaoDuan

But still some of the nodes only has one children, since I am on a time sensitive project, I currently don’t have enough time to study it in detail.

ZhichaoDuan avatar May 05 '22 14:05 ZhichaoDuan

Sorry for such a late reply.

ZhichaoDuan avatar May 05 '22 14:05 ZhichaoDuan

unary transitions (nodes with one child) happen in certain structures where the sentence would look more complete if an implied word is added. S over VP with a missing NP, for example

On Thu, May 5, 2022, 7:07 AM Roman @.***> wrote:

Sorry for such a late reply.

— Reply to this email directly, view it on GitHub https://github.com/stanfordnlp/stanza/issues/1006#issuecomment-1118599572, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2AYWPWSNQB3Z6LYGWM4DLVIPIZRANCNFSM5T2TPQ7A . You are receiving this because you modified the open/close state.Message ID: @.***>

AngledLuffa avatar May 05 '22 16:05 AngledLuffa