def animacy(mention): if is_pronoun(mention): if string.lower(mention[0]) in inanimate_set: return 1 else: return 0 else: if mention[2] == 'B-ORGANIZATION' or mention[2] == 'I-ORGANIZATION' or mention[2] == 'B-GPE' or mention[2] == 'I-GPE': return 1 else: return 0
def number(mention): if is_pronoun(mention): if string.lower(mention[0]) in singular_set: return 1 elif string.lower(mention[0]) in plural_set: return 2 else: return 0 else: if mention[1] == 'NN' or mention[1] == 'NNP': return 1 elif mention[1] == 'NNS' or mention[1] == 'NNPS': return 2 else: return 0
def gender(mention): if is_pronoun(mention): if string.lower(mention[0]) in male_set: return 3 elif string.lower(mention[0]) in female_set: return 2 elif string.lower(mention[0]) in inanimate_set: return 1 else: return 0 else: if mention[2] == 'O': return 0 elif not mention[2] == 'B-PERSON' and not mention[2] == 'I-PERSON': return 1 else: return 0