Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

endless processing when the length of single string sample > 5 #2

Closed
cctianyong opened this issue Dec 10, 2019 · 2 comments
Closed

Comments

@cctianyong
Copy link

For the sample below :
%22+
Math
.ran
dom(
)+%2
233e
call: python /usr/local/bin/inferrer/cli.py /tmp/params/rnd /tmp/no rpni
Gives the result of:
(t|r|o|n|m|h|e|d|a|M|3|2|.|+|)|(|%)*

While for the sample below, only extends the last item:
%22+
Math
.ran
dom(
)+%2
233eab
call: python /usr/local/bin/inferrer/cli.py /tmp/params/rnd /tmp/no rpni
---->go into endless processing

From top, the process of "python" takes 100% cpu.

@cctianyong
Copy link
Author

It can be fixed like this:
def _generate_set(s: Set[str], alphabet: Set[str], func: Callable) -> Generator:
for si in s :
slen = len( si )
for k in range(1,slen+1) :
substr = si[0:k]
yield substr

 #if alphabet is None:
 #    alphabet = determine_alphabet(s)

 #longest = len(max(s, key=len))
 #for comb in _get_all_combinations(alphabet, longest):
 #    if any([func(i, comb) for i in s]):
 #        yield comb

@steynvl
Copy link
Owner

steynvl commented Feb 26, 2020

Hi, thanks for letting me know. This issue has been fixed in the latest commit - your solution made the existing test cases fail, since it caused the prefix and suffix sets to generate incorrectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants