Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-111

Coreference Chain Lengths

Problem

Return the length of every coreference chain in chains, preserving the input order.

An empty chain has length 0, and an empty list of chains yields an empty list.

Hint

A list comprehension over len of each chain is enough.

Test cases

case 1
in: [[["a","b"],["c"]]]
expected: [2,1]
case 2
in: [[[]]]
expected: [0]
case 3
in: [[]]
expected: []
case 4
in: [[["a","b","c","d"]]]
expected: [4]
Starter codePython
def coref_chain_lengths(chains):
    # Your code here
    pass

4 test cases · run your code against them in the editor