question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running a slightly modified version of the demo code results in an error

See original GitHub issue

Describe the bug Running into an AttributeError in what appears to be a trivial case. Perhaps I’m doing something wrong?

To Reproduce

This colab reproduces the issue if the error below isn’t enough.

Code:

text="My phone number is 212-555-5555 and the IBAN is IL150120690000003111111 "
results = analyzer.analyze(text=text, language='en')
anonymized_text = anonymizer.anonymize(text=text, analyzer_results=results)

Output:

AttributeError                            Traceback (most recent call last)
<ipython-input-4-834d0ad09e29> in <module>()
      1 text="My phone number is 212-555-5555 and the IBAN is IL150120690000003111111 "
      2 results = analyzer.analyze(text=text, language='en')
----> 3 anonymized_text = anonymizer.anonymize(text=text, analyzer_results=results)

3 frames
/usr/local/lib/python3.7/dist-packages/presidio_anonymizer/entities/analyzer_results.py in <listcomp>(.0)
     61         for result_a in self:
     62             other_elements.remove(result_a)
---> 63             if not any([result_a.has_conflict(other_element) for other_element in
     64                         other_elements]):
     65                 other_elements.append(result_a)

AttributeError: 'RecognizerResult' object has no attribute 'has_conflict'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
omri374commented, Mar 3, 2021

Hi, we are working on a fix. A workaround:

from presidio_analyzer import AnalyzerEngine
from presidio_anonymizer import AnonymizerEngine
from presidio_anonymizer.entities import AnalyzerResult

analyzer = AnalyzerEngine()
anonymizer = AnonymizerEngine()


text="My phone number is 212-555-5555 and the IBAN is IL150120690000003111111 "
results = analyzer.analyze(text=text, language='en')

# translate results to fit the anonymizer (this will be unecessary on the next version)
new_results = [AnalyzerResult(start=r.start, end=r.end, entity_type=r.entity_type, score=r.score) for r in results]

anonymized_text = anonymizer.anonymize(text=text, analyzer_results=new_results)

This is just a workaround until we fix the issue.

1reaction
jhorowitzcommented, Mar 4, 2021

That was so fast! Thank you very much

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: could not find function "mxThreshold" | OpenMx
I'm running a slightly modified version of the one factor ordinal model where I constrain the ith residual variance to equal 1 -...
Read more >
Memory Access Error in OMRDetectMarks - GdPicture.NET
The project I am running is the OMR demo project, slightly modified by me to handle my specific form for input.
Read more >
r - Running code with reprex() and from console produces ...
Example 3 shows with a slight modification of the function that !! sym() appears to be creating some sort of time series object....
Read more >
How to Fix the HTTP 304 Not Modified Status Code - Kinsta®
The HTTP 304 not modified status code indicates a communication problem between a user's browser and a website's server.
Read more >
1.1 Your First Java Program: Hello World
Compile-time errors. These errors are caught by the system when we compile the program, because they prevent the compiler from doing the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found