The second task in Rumelhart, Hinton and Williams (1986) is to store the facts in two family trees, one English and one Italian, as triples of the form (person 1)(relationship)(person 2) such as "Colin's aunt is Jennifer". The network is given person 1 and the relationship and must turn on the output unit of every correct person 2. Build that data set from a description of a family.
Implement family_triples(people, couples, parents).
Inputs
people: dict mapping each name to "m" or "f".couples: list of (husband, wife) pairs.parents: dict mapping a child's name to (father, mother). People missing from it have no parents in the data.Relationships. For person , the relationship lists every person who is 's :
"father", "mother": 's parents."husband", "wife": 's spouse."son", "daughter": children of ."brother", "sister": other people with exactly the same father and mother as ."uncle": a brother of one of 's parents, or the husband of a sister of one of 's parents."aunt": a sister of one of 's parents, or the wife of a brother of one of 's parents."nephew", "niece": the people whose uncle or aunt is (male: nephew, female: niece).Gendered relationships use the gender of , the person who fills the relationship.
Output: a dict mapping (p, r) to the sorted list of every such . Include a key only when the list is not empty. Each key is one triple of the task: when a list has two names (such as a child with two aunts), the network must turn on two output units for that one triple.