One predicate.
| 47 | |
| 48 | |
| 49 | class Construction: |
| 50 | """One predicate.""" |
| 51 | |
| 52 | @classmethod |
| 53 | def from_txt(cls, data: str) -> Construction: |
| 54 | data = data.split(' ') |
| 55 | return Construction(data[0], data[1:]) |
| 56 | |
| 57 | def __init__(self, name: str, args: list[str]): |
| 58 | self.name = name |
| 59 | self.args = args |
| 60 | |
| 61 | def translate(self, mapping: dict[str, str]) -> Construction: |
| 62 | args = [a if isint(a) else mapping[a] for a in self.args] |
| 63 | return Construction(self.name, args) |
| 64 | |
| 65 | def txt(self) -> str: |
| 66 | return ' '.join([self.name] + list(self.args)) |
| 67 | |
| 68 | |
| 69 | class Clause: |