If we have a dependency parse tree from q1a and if idx = 2 (for rode) and n = 2 are given as arguments, will get_n_leftmost_deps and get_n_rightmost_deps return [1 (idx for Nadia), 5 (idx for donkey] and [6 (idx for with), 5 (idx for donkey)] respectively?
Yes, that’s correct.
Why does get_n_leftmost_deps() return idx 5 for donkey. Isn’t it to the right of rode? Or am I missing something?
The function is to return the leftmost dependants, not dependants only on the left. In other words, the function should return all of the dependants, sorted so that the leftmost one is at index 0, the one immediately right of the leftmost one at index 1, etc.; and the total list of dependants is capped at a size of n.