MCPcopy Create free account
hub / github.com/AkaliKong/MiniOneRec / _convert_to_semantic_ids

Method _convert_to_semantic_ids

data.py:1538–1555  ·  view source on GitHub ↗

Convert item IDs to semantic ID format using index.json

(self, item_ids)

Source from the content-addressed store, hash-verified

1536 return matched_data
1537
1538 def _convert_to_semantic_ids(self, item_ids):
1539 """Convert item IDs to semantic ID format using index.json"""
1540 semantic_ids = []
1541
1542 for item_id in item_ids:
1543 item_id_str = str(item_id)
1544 if item_id_str in self.indices:
1545 sids = self.indices[item_id_str]
1546 if len(sids) >= 3:
1547 # Combine the three semantic IDs
1548 combined_sid = sids[0] + sids[1] + sids[2]
1549 semantic_ids.append(combined_sid)
1550 else:
1551 semantic_ids.append(item_id_str)
1552 else:
1553 semantic_ids.append(item_id_str)
1554
1555 return semantic_ids
1556
1557 def get_history(self, row_data):
1558 """Extract and format user history and preference"""

Callers 1

get_historyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected