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

python3 issues in normalization/simstring code #1393

Open
william-dowling opened this issue Apr 28, 2022 · 0 comments
Open

python3 issues in normalization/simstring code #1393

william-dowling opened this issue Apr 28, 2022 · 0 comments

Comments

@william-dowling
Copy link

william-dowling commented Apr 28, 2022

I have installed simstring successfully. Then from a fresh checkout from the master branch, I ran the command python tools/norm_db_init.py example-data/normalisation/Wiki.txt as per the instruction
here.
This results in

 python tools/norm_db_init.py example-data/normalisation/Wiki.txt
Error building simstring DB
Traceback (most recent call last):
  File "/var/www/fork-brat/brat/tools/norm_db_init.py", line 430, in <module>
    sys.exit(main(sys.argv))
  File "/var/www/fork-brat/brat/tools/norm_db_init.py", line 399, in main
    with Simstring(ssdbfn,
  File "/var/www/fork-brat/brat/tools/../server/src/simstringlib.py", line 35, in __init__
    self.db.measure = SIMILARITY_MEASURES[similarity_measure]
NameError: name 'SIMILARITY_MEASURES' is not defined

If I change SIMILARITY_MEASURES to self.SIMILARITY_MEASURES the program runs successfully.

Now when I select a span in the UI and do New Annotation > Normalization > Quick Add > Search I get no result and see this in /var/log/apache2/error.log:

Traceback (most recent call last):
  File "/var/www/brat/server/src/server.py", line 338, in serve
    return _safe_serve(params, client_ip, client_hostname, cookie_data)
  File "/var/www/brat/server/src/server.py", line 206, in _safe_serve
    json_dic = dispatch(http_args, client_ip, client_hostname)
  File "/var/www/brat/server/src/dispatch.py", line 315, in dispatch
    json_dic = action_function(*action_args)
  File "/var/www/brat/server/src/norm.py", line 446, in norm_search
    return _norm_search_impl(database, name, collection, exactmatch)
  File "/var/www/brat/server/src/norm.py", line 377, in _norm_search_impl
    best_score = _norm_search_name_attr(ss, name, None,
  File "/var/www/brat/server/src/norm.py", line 304, in _norm_search_name_attr
    str_scores = ss.supstring_lookup(normname, True)
  File "/var/www/brat/server/src/simstringbase.py", line 87, in supstring_lookup
    result = self.lookup(s)
  File "/var/www/brat/server/src/simstringlib.py", line 47, in lookup
    assert not self.build, "Error: lookup on build simstring"
AssertionError: Error: lookup on build simstring

I guess this is caused by using self.build in the assert statement, which should have been self.is_build.

william-dowling added a commit to william-dowling/brat that referenced this issue Apr 28, 2022
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