Beispiel #1
0
 def unmatched(self, model) -> NExpr:
     name = tokibi.alt(model.names[self.name]) if self.name in model.names else self.name
     value = self.params[0].match(model)
     if tokibi.OPTION['MultipleSentence']:
         return tokibi.NPhrase((name, 'は'), (value, 'に'), tokibi.NPred('する', 'VS'))
     else:
         return tokibi.NPhrase((name, 'を'), (value, 'に'), tokibi.NPred('する', 'VS', mode=verb.THEN))
Beispiel #2
0
 def match(self, model) -> NExpr: #x=1 x を 1とする a[0]
     left = self.params[0].match(model)
     right = self.params[1].match(model)
     if isinstance(self.params[0], CVar):
         if tokibi.RandomIndex % 2 == 1:
             return tokibi.NPhrase((right, 'を', left, 'と'), tokibi.NPred('する', verb.VS))
         return tokibi.NPhrase((left, 'を', right, 'と'), tokibi.NPred('する', verb.VS))
     else:
         if tokibi.RandomIndex % 2 == 1:
             return tokibi.NPhrase((left, 'を', right, 'に'), tokibi.NPred('する', verb.VS))
         return tokibi.NPhrase((right, 'を'), (left, 'に'), tokibi.NPred('代入する|セットする', verb.VS))
Beispiel #3
0
 def match(self, model) -> NExpr:
     left = self.params[0].match(model)
     right = self.params[1].match(model)
     return tokibi.NPhrase(tokibi.NChunk(tokibi.NContext(left, verb.THEN), 'または、|あるいは、'), right)