def initialize(): anotacoes = parser.parseAnnotation() dominios = parser.parseMapas() participantes = anotacoes[1] targets = {"1":["rest3"],"2":["cafe1"],"3":["drug3"],"4":["chur3"],"5":["pub1"],"6":["chur2","chur3"],"7":["rest1","rest2"],"8":["drug2","drug3"],"9":["drug3","drug4"],"10":["rest4","rest5"],"11":["rest3"],"12":["cafe1"],"13":["rest4","rest5"],"14":["chur3"],"15":["pub1"],"16":["chur2","chur3"],"17":["rest1","rest2"],"18":["drug2","drug3"],"19":["drug3","drug4"],"20":["rest4","rest5"]} atributos = ["type","in","name","next-to","in-front-of","other","right-to","left-to","behind"] return dominios, targets, anotacoes[0], atributos, participantes
''' Created on 06/01/2014 @author: thiagocastroferreira ''' import Parser as parser import itertools as iter targets = {"1":["rest3"],"2":["cafe1"],"3":["drug3"],"4":["chur3"],"5":["pub1"],"6":["chur2","chur3"],"7":["rest1","rest2"],"8":["drug2","drug3"],"9":["drug3","drug4"],"10":["rest4","rest5"],"11":["rest3"],"12":["cafe1"],"13":["rest4","rest5"],"14":["chur3"],"15":["pub1"],"16":["chur2","chur3"],"17":["rest1","rest2"],"18":["drug2","drug3"],"19":["drug3","drug4"],"20":["rest4","rest5"]} dominios = parser.parseMapas() def isUnderspecified(expressao): for anotacao in expressao["anotacoes"]: for target in expressao["anotacoes"].keys(): for objeto in expressao["anotacoes"][target]: if objeto == "tg": properties = expressao["anotacoes"][target][objeto] dominio = dominios[expressao["caracteristicas"]["context"]] distractors = {} for property in properties.keys(): distractors = {} for element in properties[property]: for object in dominio.keys(): if element in dominio[object][property]: distractors[object] = dominio[object] dominio = distractors if len(distractors.keys()) > 1: return True