Closed kmkurn closed 4 years ago
Good question. Please keep asking and treat the code like it is your own.
Currently that algorithm is multi-root. If you want single root, then we have to update the dynamic program slightly. In particular at the bottom of the function https://github.com/harvardnlp/pytorch-struct/blob/master/torch_struct/deptree.py#L100 you should call semiring.zero_(alpha[A][C][R].data[:, b, 0, k])
for any value k < lengths[b]. This is a bit hacky, but I think it will work. For the test you can just use the existing function here to confirm it https://github.com/harvardnlp/pytorch-struct/blob/master/torch_struct/deptree.py#L183
Checked in now.
Hi, it's me again. Quick question, does
DependencyCRF
support single-root trees? That is, the root symbol has exactly one dependent.NonProjectiveDependencyCRF
does support it, butDependencyCRF
seems to support only the multi-root case.