!752 !include #1002461 // Source static Relationship isA; p { load("isA"); } answer { L tok = nlTok(s); int i = findCodeTokens(tok, true, "is", "a"); if (i > 0) { } } // This is about (directed) pair relationships: A * A -> V // For example, "A is a B" with V being a value type static class Relationship { Map> forward = new TreeMap; Map> backward = new TreeMap; V get(A a, A b) { Map map = forward.get(a); ret map == null ? null : map.get(b); } void put(A a, A b, V v) { put1(forward, a, b, v); put1(backward, b, a, v); } void put1(Map> x, A a, A b, V v) { Map map = x.get(a); if (map == null) x.put(a, map = new TreeMap); map.put(b, v); } }