Skip to content

Commit

Permalink
Fiddly
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Sep 26, 2024
1 parent c333863 commit b07734c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mini_transcript_search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,12 @@ def speech_from_id(
speech_id, para_id = id.split("#") if "#" in id else (id, None)
id_lookup = get_id_lookup(date, chamber, transcript_type)
final_part = speech_id.split("/")[-1]
prior_parts = "/".join(speech_id.split("/")[:-1])
final_part_dots = final_part.split(".")

# date, major, minor (and then the sentence we want to remove)
if len(final_part_dots) > 3:
speech_id = ".".join(final_part_dots[:3])
speech_id = prior_parts + "/" + ".".join(final_part_dots[:3])
result = id_lookup.get(speech_id)
if result is None:
raise ValueError(f"Speech with id {speech_id} not found")
Expand Down

0 comments on commit b07734c

Please sign in to comment.