You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question on Entity Extraction from Raw Outputs of Agent #20
Hi, thanks for your excellent work! I encountered an issue described below.
LocAgent uses a function called get_module_from_line_number to extract function entities (ultimately added to found_entities in location/loc_outputs.jsonl), as shown below.
defget_module_from_line_number(line, file_path, searcher):
assertfile_pathinsearcher.G.nodesfile_node=searcher.get_node_data([file_path])[0]
print(f'file_path:line -> {file_path}:{line}')
print(f'file_node -> {file_node}')
cur_start_line=file_node['start_line']
cur_end_line=file_node['end_line']
cur_node=Nonefornidinsearcher.G.nodes():
# if not nid.startswith(file_path) or ':' not in nid:# continuenode=searcher.G.nodes[nid]
ifnode['type'] !=NODE_TYPE_FUNCTION: continue# to do: strict matching# if file_node['node_id'] not in nid: continueif'start_line'innodeand'end_line'innode:
ifnode['start_line'] <cur_start_lineornode['end_line'] >cur_end_line:
continueifline>=node['start_line'] andline<=node['end_line']:
cur_node=nodecur_node['name'] =nidcur_start_line=node['start_line']
cur_end_line=node['end_line']
ifcur_node:
print(f'cur_node -> {cur_node}')
return (cur_node, cur_end_line)
return (None, None)
From my understanding, it should extract the function at Line line of file file_path. If this is the case, the implementation is not entirely correct. Note that as found_entities is used for computing evaluation metrics, the calculated results may be inaccurate.
Using the print statement added by me (see the above code), I got some output in the figure below, where the file path of the found entity (cur_node) does not match the file_path.
Thanks for your time. If my analysis is correct, I am happy to submit a short PR (by adding a commented line in the above code) to address this issue.
Activity