Add title-turn uniqueness check

This commit is contained in:
Tim Van Baak 2019-04-23 23:56:59 -07:00
parent 18eba7c035
commit 8773f6b58f
1 changed files with 7 additions and 0 deletions

View File

@ -172,6 +172,13 @@ class LexiconArticle:
Fills out fields on articles that require other articles for context.
Creates phantom articles.
"""
# Preliminary assertion that title/turn is unique
keys = set()
for article in lexicon_articles:
if (article.title, article.turn) in keys:
raise ValueError("Found two articles with title '{}' and turn '{}'".format(
article.title, article.turn))
keys.add((article.title, article.turn))
# Sort out which articles are addendums and which titles are phantoms
written_titles = set()
cited_titles = set()