|
|
|
@@ -53,28 +53,75 @@ class AnchoredMarket(BaseMarket): |
|
|
|
|
|
|
|
def __init__(self): |
|
|
|
super(AnchoredMarket, self).__init__() |
|
|
|
self.anchor_learnware_list = {} # anchor_id: anchor learnware |
|
|
|
|
|
|
|
def get_anchor_learnware(self, user_info: AnchoredUserInfo) -> Tuple[Any, Dict[str, List[Any]]]: |
|
|
|
"""Get anchor Learnware based on user_info |
|
|
|
def _update_anchor_learnware(self, anchor_id: str, anchor_learnware: Learnware): |
|
|
|
"""Update anchor_learnware_list |
|
|
|
|
|
|
|
Parameters |
|
|
|
---------- |
|
|
|
anchor_id : str |
|
|
|
Id of anchor learnware |
|
|
|
anchor_learnware : Learnware |
|
|
|
Anchor learnware |
|
|
|
""" |
|
|
|
self.anchor_learnware_list[anchor_id] = anchor_learnware |
|
|
|
|
|
|
|
def _delete_anchor_learnware(self, anchor_id: str) -> bool: |
|
|
|
"""Delete anchor learnware in anchor_learnware_list |
|
|
|
|
|
|
|
Parameters |
|
|
|
---------- |
|
|
|
anchor_id : str |
|
|
|
Id of anchor learnware |
|
|
|
|
|
|
|
Returns |
|
|
|
------- |
|
|
|
bool |
|
|
|
True if the target anchor learnware is deleted successfully. |
|
|
|
|
|
|
|
Raises |
|
|
|
------ |
|
|
|
Exception |
|
|
|
Raise an excpetion when given anchor_id is NOT found in anchor_learnware_list |
|
|
|
""" |
|
|
|
if not anchor_id in self.anchor_learnware_list: |
|
|
|
raise Exception("Anchor learnware id:{} NOT Found!".format(anchor_id)) |
|
|
|
|
|
|
|
self.anchor_learnware_list.pop(anchor_id) |
|
|
|
return True |
|
|
|
|
|
|
|
def update_anchor_learnware_list(self, learnware_list: Dict[str, Learnware]): |
|
|
|
"""Update anchor_learnware_list |
|
|
|
|
|
|
|
Parameters |
|
|
|
---------- |
|
|
|
learnware_list : Dict[str, Learnware] |
|
|
|
Learnwares for updating anchor_learnware_list |
|
|
|
""" |
|
|
|
pass |
|
|
|
|
|
|
|
def search_anchor_learnware(self, user_info: AnchoredUserInfo) -> Tuple[Any, List[Learnware]]: |
|
|
|
"""Search anchor Learnwares from anchor_learnware_list based on user_info |
|
|
|
|
|
|
|
Parameters |
|
|
|
---------- |
|
|
|
user_info : AnchoredUserInfo |
|
|
|
- user_info with properties and statistical information |
|
|
|
- some statistical information calculated on anchor learnwares |
|
|
|
- some statistical information calculated on previous anchor learnwares |
|
|
|
|
|
|
|
Returns |
|
|
|
------- |
|
|
|
Tuple[Any, Dict[str, List[Any]]] |
|
|
|
Tuple[Any, List[Learnware]]: |
|
|
|
return two items: |
|
|
|
|
|
|
|
- first is recommended combination, None when no recommended combination is calculated or statistical specification is not provided. |
|
|
|
- second is a list of matched learnwares |
|
|
|
- first is the usage of anchor learnwares, e.g., how to use anchors to calculate some statistical information |
|
|
|
- second is a list of anchor learnwares |
|
|
|
""" |
|
|
|
pass |
|
|
|
|
|
|
|
def search_learnware(self, user_info: AnchoredUserInfo) -> Tuple[Any, Dict[str, List[Any]]]: |
|
|
|
"""Search learnware based on user_info |
|
|
|
def search_learnware(self, user_info: AnchoredUserInfo) -> Tuple[Any, List[Learnware]]: |
|
|
|
"""Find helpful learnwares from learnware_list based on user_info |
|
|
|
|
|
|
|
Parameters |
|
|
|
---------- |
|
|
|
@@ -84,7 +131,7 @@ class AnchoredMarket(BaseMarket): |
|
|
|
|
|
|
|
Returns |
|
|
|
------- |
|
|
|
Tuple[Any, Dict[str, List[Any]]] |
|
|
|
Tuple[Any, List[Any]] |
|
|
|
return two items: |
|
|
|
|
|
|
|
- first is recommended combination, None when no recommended combination is calculated or statistical specification is not provided. |
|
|
|
|