Skip to content

Commit

Permalink
added more chesterton
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Morris committed Jul 5, 2024
1 parent 4f4439c commit de4ea3d
Show file tree
Hide file tree
Showing 5 changed files with 1,827 additions and 413 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
poems
-----

All of the poems in here are good, or interesting. There are currently 8,161 poems by 545 poets.
All of the poems in here are good, or interesting. There are currently 8,173 poems by 546 poets.
2 changes: 1 addition & 1 deletion poems/curator.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_poem(
self.catalog.df["probability"] = self.catalog.df.likelihood / self.catalog.df.likelihood.sum()

if very_verbose:
catalog_summary = self.catalog.df.sort_values("probability", ascending=False)[["author", "title", "context", "probability"]]
catalog_summary = self.catalog.df.sort_values(["probability", "author"], ascending=[False, False])[["author", "title", "context", "probability"]]
print(f"choosing from {len(self.catalog.df)} poems; the most likely are:")
print(catalog_summary.iloc[:20].to_string())
chosen_loc = np.random.choice(self.catalog.df.index, p=self.catalog.df.probability)
Expand Down
3 changes: 3 additions & 0 deletions poems/poem.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def pretty_date(self):
if year:
x += f"{year}"

if "approximate" in self.metadata["date"]:
x = f"circa {x}"

return x.strip()

@property
Expand Down
Loading

0 comments on commit de4ea3d

Please sign in to comment.