hldp(zhuyuan): integrate fifth-domain world tree and TCS brain
This commit is contained in:
parent
9782d04246
commit
4496f75857
42 changed files with 1720 additions and 268 deletions
|
|
@ -15,9 +15,19 @@ def recall(query, map_path=DEFAULT_MAP):
|
|||
terms = [part for part in needle.replace("/", " ").split() if part]
|
||||
matches = []
|
||||
for item in data["contributions"]:
|
||||
identifiers = [item["id"], item["arrival_id"], *item.get("project_ids", [])]
|
||||
keywords = item.get("keywords", [])
|
||||
haystack = " ".join([*identifiers, item["arrival_name"], item["title"], *keywords]).casefold()
|
||||
identifiers = [
|
||||
value
|
||||
for value in [item.get("id"), item.get("arrival_id"), *item.get("project_ids", [])]
|
||||
if isinstance(value, str) and value
|
||||
]
|
||||
keywords = [value for value in item.get("keywords", []) if isinstance(value, str) and value]
|
||||
searchable = [
|
||||
*identifiers,
|
||||
item.get("arrival_name"),
|
||||
item.get("title"),
|
||||
*keywords,
|
||||
]
|
||||
haystack = " ".join(value for value in searchable if isinstance(value, str) and value).casefold()
|
||||
score = 0
|
||||
reasons = []
|
||||
for identifier in identifiers:
|
||||
|
|
|
|||
Loading…
Reference in a new issue