Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: UnboundLocalError: local variable 'most_important_property_df' referenced before assignment in context-match command #99

Open
binh-vu opened this issue Nov 13, 2021 · 0 comments

Comments

@binh-vu
Copy link

binh-vu commented Nov 13, 2021

context-match command relies on the function find_main_entity_column to get the subject column. However, when there are more than one candidate for the subject column, it returns the first column (hard coded - 0), which, in many tables, may not be the entity column. When it's not (in my example), it makes the filtered data frame empty, which leads to the above error:

Stack trace:

Command: context-match
Error Message:  Traceback (most recent call last):
  File "/data/binhvu/table-linker/tl/cli/context-match.py", line 69, in run
    obj = TableContextMatches(context_path=context_file_path, context_dict=None, input_path=input_file_path,
  File "/data/binhvu/table-linker/tl/features/cell_context_matches.py", line 196, in __init__
    self.initialize(input_df, context_dict, label_column)
  File "/data/binhvu/table-linker/tl/features/cell_context_matches.py", line 329, in initialize
    self.input_df = self.process(row_column_pairs, columns)
  File "/data/binhvu/table-linker/tl/features/cell_context_matches.py", line 332, in process
    context_scores, properties, similarities = self.compute_context_scores(n_context_columns, row_column_pairs)
  File "/data/binhvu/table-linker/tl/features/cell_context_matches.py", line 347, in compute_context_scores
    self.compute_property_scores(row_column_pairs, n_context_columns)
  File "/data/binhvu/table-linker/tl/features/cell_context_matches.py", line 413, in compute_property_scores
    self.write_relevant_properties(most_important_property_df)
UnboundLocalError: local variable 'most_important_property_df' referenced before assignment

Test file: test.csv & context.jl.txt
Command:

tl context-match --debug --context-file context.jl --ignore-column-name ignore_candidate -o context_score --similarity-string-threshold 0.85 --similarity-quantity-threshold 0.9 --save-relevant-properties --context-properties-path /data/binhvu/sm-dev/data/home/cache/t211112_entity_linking/table_linker/17th_saskatchewan_legislature/aux_files/context_property.tsv /tmp/test.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant