-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
358 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
import unittest | ||
import pytest | ||
|
||
from analyzer_engine.csv_analyzer_engine import CSVAnalyzerEngine | ||
from config.nlp_engine_config import FlairNLPEngine | ||
|
||
|
||
class CSVAnalayzerEngineTest(unittest.TestCase): | ||
def setUp(self) -> None: | ||
nlp_engine = FlairNLPEngine("flair/ner-english-large") | ||
self.csv_analyser = CSVAnalyzerEngine(nlp_engine) | ||
|
||
def test_csv_analyzer_engine_anonymizer(self): | ||
|
||
from presidio_anonymizer import BatchAnonymizerEngine | ||
analyzer_results = self.csv_analyser.analyze_csv('./data/sample_data.csv', language="en") | ||
|
||
anonymizer = BatchAnonymizerEngine() | ||
anonymized_results = anonymizer.anonymize_dict(analyzer_results) | ||
self.assertIsNotNone(anonymized_results) | ||
def test_csv_analyzer_engine_anonymizer(): | ||
nlp_engine = FlairNLPEngine("flair/ner-english-large") | ||
csv_analyzer = CSVAnalyzerEngine(nlp_engine) | ||
from presidio_anonymizer import BatchAnonymizerEngine | ||
analyzer_results = csv_analyzer.analyze_csv('./data/sample_data.csv', language="en") | ||
anonymizer = BatchAnonymizerEngine() | ||
anonymized_results = anonymizer.anonymize_dict(analyzer_results) | ||
assert anonymized_results |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
import unittest | ||
import pytest | ||
|
||
from recognizer.flair_recognizer import FlairRecognizer | ||
|
||
|
||
class TestFlairRecognizer(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.recognizer = FlairRecognizer(model_path="flair/ner-english-large") | ||
|
||
def test_flair_recognizer_analyse(self): | ||
test_data = "Sowmya is working in Berkley bank as an accountant since 2021" | ||
result = self.recognizer.analyze(test_data) | ||
self.assertGreater(len(result), 0) | ||
|
||
def test_flair_recognizes_persons_correctly(self): | ||
test_data = "Sowmya is a person name" | ||
self.assertGreater(len(self.recognizer.analyze(test_data)), 0) | ||
test_data = "XXXXXX is a valid name?" | ||
self.assertEquals(len(self.recognizer.analyze(test_data)), 0) | ||
def test_flair_recognizer_analyze(): | ||
recognizer = FlairRecognizer(model_path="flair/ner-english-large") | ||
test_data = "Sowmya is working in Berkley bank as an accountant since 2021" | ||
result = recognizer.analyze(test_data) | ||
assert len(result) > 0 | ||
|
||
def test_flair_recognizes_persons_correctly(): | ||
recognizer = FlairRecognizer(model_path="flair/ner-english-large") | ||
test_data = "Sowmya is a person name" | ||
assert len(recognizer.analyze(test_data)) > 0 | ||
test_data = "XXXXXX is a valid name?" | ||
assert len(recognizer.analyze(test_data)) == 0 |