Spaces:
Sleeping
Sleeping
Create ingest/linking.py
Browse files- ingest/linking.py +12 -0
ingest/linking.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def link_clusters_to_timeline(results, clusters):
|
| 2 |
+
"""
|
| 3 |
+
Build index maps so timeline & clusters can cross-highlight
|
| 4 |
+
"""
|
| 5 |
+
doc_index = {}
|
| 6 |
+
for idx, r in enumerate(results):
|
| 7 |
+
doc_index[r["id"]] = {
|
| 8 |
+
"index": idx,
|
| 9 |
+
"date": r.get("date"),
|
| 10 |
+
"cluster": r.get("cluster"),
|
| 11 |
+
}
|
| 12 |
+
return doc_index
|