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

Circular origin reference #20

alxwrd opened this Issue Jun 10, 2018 · 3 comments


None yet
2 participants
Copy link

alxwrd commented Jun 10, 2018

There's currently at least one circular reference in etymwn-relety.json."software", recursive=True)

will eventually fail with a recursion error because software -> soft, -ware and -ware -> software.


This comment has been minimized.

Copy link
Collaborator Author

alxwrd commented Jun 12, 2018

I'm going to run a job to try and discover all these problems with the data.

Hidden as no longer relevant

import sys
import ety


total = len(

def find():
    results = []
    errors = []
    for count, word in enumerate(
            _ = ety.Word(word["a_word"], word["a_lang"]).origins()
            print("{}/{}".format(count, total), end="\r")
        except RecursionError:
        except Exception as e:
                "error": e,
                "word": _

    return results, errors
>>> import find_circulars
>>> results, errors = find_circulars.find()

I'll update here once it's done.


This comment has been minimized.

Copy link
Collaborator Author

alxwrd commented Jun 12, 2018

I've just realised this isn't actually recursion because it's the child's .origins() that's being called.

The issue is because the results are appended to the result list, and the chain "software" -> "-ware" -> "software" will just keep growing the result list.

I have a fix in mind, I'll submit a PR later.


This comment has been minimized.

Copy link

jmsv commented Jun 12, 2018

Hmm, could the solution be as simple as only adding a Word to a branch if it hasn't already appeared in that branch?

@jmsv jmsv closed this in #28 Jun 12, 2018

jmsv added a commit that referenced this issue Jun 12, 2018

@jmsv jmsv reopened this Jun 12, 2018

@jmsv jmsv closed this in fef1573 Jun 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment