# Path: props/dependency_tree/definitions.py
# REASON_LABEL = "reason"
# OUTCOME_LABEL = "outcome"
# EVENT_LABEL = "event"
# CONDITION_LABEL = "condition"
# FIRST_ENTITY_LABEL = "sameAs_arg"
# SECOND_ENTITY_LABEL = "sameAs_arg"
# POSSESSOR_LABEL = "possessor"
# POSSESSED_LABEL = "possessed"
# ARG_LABEL = "arg"
# POSS_LABEL = "poss"
# MARK_LABEL = "mark"
# EXPL_LABEL = 'expl'
# SOURCE_LABEL = 'source'
# MODIFIER_LABEL = "modifier"
# POSSESSIVE_LABEL = "possessive"
# SUBJ_LABEL  = "subj"
# OBJECT_LABEL = "obj"
# DIRECT_OBJECT_LABEL = "dobj"
# INDIRECT_OBJECT_LABEL = "iobj"
# VB = "VB"       #Verb, base form
# VBD = "VBD"     #Verb, past tense
# VBG = "VBG"     #Verb, gerund or present participle
# VBN = "VBN"     #Verb, past participle
# VBP = "VBP"     #Verb, non-3rd person singular present
# VBZ = "VBZ"     #Verb, 3rd person singular present
# VERB_POS = [VB,VBD,VBP,VBZ,VBN] # all types of verb pos
# TO = "TO"
# IN = "IN"
# MD = "MD"
# DOT = "."
# COMMA = ","
# TENSE_PAST = "past"
# TENSE_PRESENT = "present"
# TENSE_FUTURE = "future"
# TENSE_UNKNOWN = "unknown"
# WILL = "will"
# WONT = "wo"
# WOULD = "would"
# D = "'d"
# HAVE = "have"
# BE = "be"
# BEEN = "been"
# FUTURE_MODALS = [WILL, WONT, WOULD, ll, D, "may", "might"] # "wo" is the Modal part of "won't"
# AS = "as"
# COND_IF = "if"
# COND_AFTER = "after"
# def aux_children_with_pos(pos_tag):


from props.dependency_tree.definitions import subject_dependencies, ARG_LABEL,\
    object_dependencies, SOURCE_LABEL, domain_label, POSSESSED_LABEL,\
    POSSESSOR_LABEL

class Proposition:
    def __init__(self,pred,args,outputType):
        self.pred = pred
        self.args = args
        self.outputType = outputType
        for ent in self.args:
            (rel,arg) = ent
            if rel == POSSESSOR_LABEL:
                ent[1] = fixPossessor(arg)
    
    def find_ent(self,ent):
        ret = []
        for i,(rel,arg) in enumerate(self.args):
            if ent in arg:
                ret.append(i)
        return ret
                 
        
    def rel_order(self,rel):
        if rel in subject_dependencies+[domain_label,POSSESSED_LABEL,POSSESSOR_LABEL]:
            return 0

# Path: props/dependency_tree/definitions.py
# REASON_LABEL = "reason"
# OUTCOME_LABEL = "outcome"
# EVENT_LABEL = "event"
# CONDITION_LABEL = "condition"
# FIRST_ENTITY_LABEL = "sameAs_arg"
# SECOND_ENTITY_LABEL = "sameAs_arg"
# POSSESSOR_LABEL = "possessor"
# POSSESSED_LABEL = "possessed"
# ARG_LABEL = "arg"
# POSS_LABEL = "poss"
# MARK_LABEL = "mark"
# EXPL_LABEL = 'expl'
# SOURCE_LABEL = 'source'
# MODIFIER_LABEL = "modifier"
# POSSESSIVE_LABEL = "possessive"
# SUBJ_LABEL  = "subj"
# OBJECT_LABEL = "obj"
# DIRECT_OBJECT_LABEL = "dobj"
# INDIRECT_OBJECT_LABEL = "iobj"
# VB = "VB"       #Verb, base form
# VBD = "VBD"     #Verb, past tense
# VBG = "VBG"     #Verb, gerund or present participle
# VBN = "VBN"     #Verb, past participle
# VBP = "VBP"     #Verb, non-3rd person singular present
# VBZ = "VBZ"     #Verb, 3rd person singular present
# VERB_POS = [VB,VBD,VBP,VBZ,VBN] # all types of verb pos
# TO = "TO"
# IN = "IN"
# MD = "MD"
# DOT = "."
# COMMA = ","
# TENSE_PAST = "past"
# TENSE_PRESENT = "present"
# TENSE_FUTURE = "future"
# TENSE_UNKNOWN = "unknown"
# WILL = "will"
# WONT = "wo"
# WOULD = "would"
# D = "'d"
# HAVE = "have"
# BE = "be"
# BEEN = "been"
# FUTURE_MODALS = [WILL, WONT, WOULD, ll, D, "may", "might"] # "wo" is the Modal part of "won't"
# AS = "as"
# COND_IF = "if"
# COND_AFTER = "after"
# def aux_children_with_pos(pos_tag):


# Path: props/graph_representation/proposition.py
from props.dependency_tree.definitions import subject_dependencies, ARG_LABEL,\
    object_dependencies, SOURCE_LABEL, domain_label, POSSESSED_LABEL,\
    POSSESSOR_LABEL

class Proposition:
    def __init__(self,pred,args,outputType):
        self.pred = pred
        self.args = args
        self.outputType = outputType
        for ent in self.args:
            (rel,arg) = ent
            if rel == POSSESSOR_LABEL:
                ent[1] = fixPossessor(arg)
    
    def find_ent(self,ent):
        ret = []
        for i,(rel,arg) in enumerate(self.args):
            if ent in arg:
                ret.append(i)
        return ret
                 
        
    def rel_order(self,rel):
        if rel in subject_dependencies+[domain_label,POSSESSED_LABEL,POSSESSOR_LABEL]:
            return 0

        if rel == ARG_LABEL:
