MCPcopy
hub / github.com/nltk/nltk / handle

Method handle

nltk/sem/drt.py:83–106  ·  view source on GitHub ↗

This method is intended to be overridden for logics that use different operators or expressions

(self, tok, context)

Source from the content-addressed store, hash-verified

81 return tok not in DrtTokens.TOKENS
82
83 def handle(self, tok, context):
84 """This method is intended to be overridden for logics that
85 use different operators or expressions"""
86 if tok in DrtTokens.NOT_LIST:
87 return self.handle_negation(tok, context)
88
89 elif tok in DrtTokens.LAMBDA_LIST:
90 return self.handle_lambda(tok, context)
91
92 elif tok == DrtTokens.OPEN:
93 if self.inRange(0) and self.token(0) == DrtTokens.OPEN_BRACKET:
94 return self.handle_DRS(tok, context)
95 else:
96 return self.handle_open(tok, context)
97
98 elif tok.upper() == DrtTokens.DRS:
99 self.assertNextToken(DrtTokens.OPEN)
100 return self.handle_DRS(tok, context)
101
102 elif self.isvariable(tok):
103 if self.inRange(0) and self.token(0) == DrtTokens.COLON:
104 return self.handle_prop(tok, context)
105 else:
106 return self.handle_variable(tok, context)
107
108 def make_NegatedExpression(self, expression):
109 return DrtNegatedExpression(expression)

Callers

nothing calls this directly

Calls 10

handle_DRSMethod · 0.95
isvariableMethod · 0.95
handle_propMethod · 0.95
handle_negationMethod · 0.80
handle_lambdaMethod · 0.80
inRangeMethod · 0.80
handle_openMethod · 0.80
assertNextTokenMethod · 0.80
handle_variableMethod · 0.80
tokenMethod · 0.45

Tested by

no test coverage detected