From 8157152d08b5846609df5cfd4b390b05b442d898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Chocholat=C3=BD?= Date: Wed, 20 Nov 2024 13:30:38 +0100 Subject: [PATCH] fix(bindings/python): Remove unsupported argument `minimize` from additional params --- bindings/python/libmata/nfa/nfa.pyx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/bindings/python/libmata/nfa/nfa.pyx b/bindings/python/libmata/nfa/nfa.pyx index ca550ba6..f117f071 100644 --- a/bindings/python/libmata/nfa/nfa.pyx +++ b/bindings/python/libmata/nfa/nfa.pyx @@ -923,21 +923,24 @@ def concatenate_with_result_state_maps(Nfa lhs, Nfa rhs, use_epsilon: bool = Fal return result, lhs_map, rhs_map -def complement(Nfa lhs, alph.Alphabet alphabet, params = None): - """Performs complement of lhs - - :param Nfa lhs: complemented automaton - :param OnTheFlyAlphabet alphabet: alphabet of the lhs - :param dict params: additional params - - "algorithm": "classical" (classical algorithm determinizes the automaton, makes it complete and swaps final and non-final states); - - "minimize": "true"/"false" (whether to compute minimal deterministic automaton for classical algorithm); - :return: complemented automaton +def complement(Nfa nfa, alph.Alphabet alphabet, params = None): + """Computes the complement of the nfa. + + :param Nfa nfa: The automaton to complement. + :param OnTheFlyAlphabet alphabet: The alphabet of the nfa. + :param dict params: Additional parameters. + - "algorithm": + - "classical": The classical algorithm determinizes the automaton, makes it complete and swaps final and + non-final states. + - "brzozowski": The Brzozowski algorithm determinizes the automaton using Brzozowski minimization, makes it + complete, and swaps final and non-final states. + :return: The complemented automaton. """ result = Nfa() - params = params or {'algorithm': 'classical', 'minimize': 'false'} + params = params or {'algorithm': 'classical'} mata_nfa.c_complement( result.thisptr.get(), - dereference(lhs.thisptr.get()), + dereference(nfa.thisptr.get()), dereference(alphabet.as_base()), { k.encode('utf-8'): v.encode('utf-8') if isinstance(v, str) else v