根据控件项文本与一组关键词之间的相似性计算其得分。
返回 |
- –
表示控件文本与关键词之间相似性的得分 (0-1)。
|
源代码在 automator/ui_control/control_filter.py
197
198
199
200
201
202
203
204
205
206
207 | def control_filter_score(self, control_text, plans):
"""
Calculates the score for a control item based on the similarity between its text and a set of keywords.
:param control_text: The text of the control item.
:param plans: The plan to be used for calculating the similarity.
:return: The score (0-1) indicating the similarity between the control text and the keywords.
"""
plan_embedding = self.get_embedding(plans)
control_text_embedding = self.get_embedding(control_text)
return max(self.cos_sim(control_text_embedding, plan_embedding).tolist()[0])
|