Update aho-corasick.py (#1457)

This commit is contained in:
Samarth Sehgal 2019-10-25 22:35:23 +05:30 committed by Christian Clauss
parent 182062d60b
commit 3ea0992dc7

View File

@ -54,7 +54,7 @@ class Automaton:
self.adlist[child]["fail_state"] = self.find_next_state(
state, self.adlist[child]["value"]
)
if self.adlist[child]["fail_state"] == None:
if self.adlist[child]["fail_state"] is None:
self.adlist[child]["fail_state"] = 0
self.adlist[child]["output"] = (
self.adlist[child]["output"]
@ -71,7 +71,7 @@ class Automaton:
current_state = 0
for i in range(len(string)):
while (
self.find_next_state(current_state, string[i]) == None
self.find_next_state(current_state, string[i]) is None
and current_state != 0
):
current_state = self.adlist[current_state]["fail_state"]