import cPickle from FSA import compileOP from evitaUncompiledPatterns import patternsGroups """ Taking each list of patterns (from uncompiledPatterns.patternsGroups) as input, compiling the patterns into FSA, and converting the list into a pickle object to be stored into ./Patterns/. """ DIR_PATTERNS = "Patterns/" if __name__ == "__main__": for (listName, patternsList) in patternsGroups: pickleFile = open(DIR_PATTERNS + listName + ".pickle", 'w') toPickle = [] for pattern in patternsList: toPickle.append(compileOP(pattern)) cPickle.dump(toPickle, pickleFile)
')', ] # ======================== # FSA from Object Patterns: # ======================== # FORWARD PATTERNS: # ================= # ================= # THAT clauses # ;;;;;;;;;;;;;; #THAT_clause = compileOP(thatClause, name='thatClause') THAT_clause_that = compileOP(thatClause_that, name='thatClause_that') #THAT_clause_that_BE = compileOP(thatClause_that_BE, name='thatClause_that_BE') THAT_clause_NOT_that = compileOP(thatClause_NOT_that, name='thatClause_NOT_that') THAT_clausePAST_that = compileOP(thatClausePAST_that, name='thatClausePAST_that') THAT_clausePERFECTIVE_NEG_that = compileOP( thatClausePERFECTIVE_NEG_that, name='thatClausePERFECTIVE_NEG_that') THAT_clausePAST_NOT_that = compileOP(thatClausePAST_NOT_that, name='thatClausePAST_NOT_that') THAT_clausePERFECTIVE_NEG_NOT_that = compileOP( thatClausePERFECTIVE_NEG_NOT_that, name='thatClausePERFECTIVE_NEG_NOT_that') THAT_clause_that_QUOTES = compileOP(thatClause_that_QUOTES, name='thatClause_that_QUOTES')
import cPickle from FSA import compileOP from evitaUncompiledPatterns import patternsGroups """ Taking each list of patterns (from uncompiledPatterns.patternsGroups) as input, compiling the patterns into FSA, and converting the list into a pickle object to be stored into ./Patterns/. """ DIR_PATTERNS = "Patterns/" if __name__ == "__main__": for (listName,patternsList) in patternsGroups: pickleFile = open(DIR_PATTERNS+listName+".pickle", 'w') toPickle = [] for pattern in patternsList: toPickle.append(compileOP(pattern)) cPickle.dump(toPickle,pickleFile)
# ======================== # FSA from Object Patterns: # ======================== # FORWARD PATTERNS: # ================= # ================= # THAT clauses # ;;;;;;;;;;;;;; #THAT_clause = compileOP(thatClause, name='thatClause') THAT_clause_that = compileOP(thatClause_that, name='thatClause_that') #THAT_clause_that_BE = compileOP(thatClause_that_BE, name='thatClause_that_BE') THAT_clause_NOT_that = compileOP(thatClause_NOT_that, name='thatClause_NOT_that') THAT_clausePAST_that = compileOP(thatClausePAST_that, name='thatClausePAST_that') THAT_clausePERFECTIVE_NEG_that = compileOP(thatClausePERFECTIVE_NEG_that, name='thatClausePERFECTIVE_NEG_that') THAT_clausePAST_NOT_that = compileOP(thatClausePAST_NOT_that, name='thatClausePAST_NOT_that') THAT_clausePERFECTIVE_NEG_NOT_that = compileOP(thatClausePERFECTIVE_NEG_NOT_that, name='thatClausePERFECTIVE_NEG_NOT_that') THAT_clause_that_QUOTES = compileOP(thatClause_that_QUOTES, name='thatClause_that_QUOTES') THAT_clause_NOT_that_QUOTES = compileOP(thatClause_NOT_that_QUOTES, name='thatClause_NOT_that_QUOTES') THAT_clause_that_NOT_report = compileOP(thatClause_that_NOT_report, name='thatClause_that_NOT_report') THAT_clause_N_that_N_report = compileOP(thatClause_NOT_that_NOT_report, name='thatClause_NOT_that_NOT_report') THAT_clause_SIMPLE = compileOP(thatClause_SIMPLE, name='thatClause_SIMPLE') THAT_clause_NOT_tensed = compileOP(thatClause_NOT_tensed, name='thatClause_NOT_tensed') THAT_clause_if = compileOP(thatClause_if, name='thatClause_if')