From 17e5510fd2a64a8ae42cac82eb3ad4d44da58059 Mon Sep 17 00:00:00 2001 From: Masahiro Sakai Date: Tue, 9 Jul 2024 23:53:15 +0900 Subject: [PATCH 1/2] fix comment in python/sequitur.py --- python/sequitur.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/python/sequitur.py b/python/sequitur.py index 6104258..d69613f 100755 --- a/python/sequitur.py +++ b/python/sequitur.py @@ -3,17 +3,17 @@ # Ported by Ravi Annaswamy 2 hours on May 8, 2013 # Not fully tested yet :) -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. class Rule: From 1a1beeb6eabd5d095a3ad7ea2930ab37dae22b9d Mon Sep 17 00:00:00 2001 From: Masahiro Sakai Date: Wed, 10 Jul 2024 00:01:51 +0900 Subject: [PATCH 2/2] update python/sequitur.py from Python2 to Python3 --- python/sequitur.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/sequitur.py b/python/sequitur.py index d69613f..103dbf5 100755 --- a/python/sequitur.py +++ b/python/sequitur.py @@ -84,13 +84,13 @@ def clone(self): return sym def join(self, left, right): - if left.n <> None: + if left.n != None: left.delete_digram() - if (right.p <> None and right.n <> None and + if (right.p != None and right.n != None and right.value == right.p.value and right.value == right.n.value): digrams[str(right.value) + str(right.n.value)] = right - if (left.p <> None and left.n <> None and + if (left.p != None and left.n != None and left.value == left.p.value and left.value == left.n.value): digrams[str(left.p.value) + str(left.value)] = left.p @@ -127,7 +127,7 @@ def check(self): return False found = digrams[self.digram()] - if found.n <> self: + if found.n != self: self.match(self, found) return True