diff --git a/genalog/ocr/README.md b/genalog/ocr/README.md index 09ad837..fe91fb3 100644 --- a/genalog/ocr/README.md +++ b/genalog/ocr/README.md @@ -66,9 +66,9 @@ Example usage: ```python from genalog.ocr.grok import Grok from dotenv import load_dotenv - load_dotenv("tests/ocr/.env") + load_dotenv("tests/unit/ocr/.env") grok = Grok.create_from_env_var() - grok.run_grok(src_folder_path = "tests/ocr/data/img", dest_folder_path = "tests/ocr/data/json") + grok.run_grok(src_folder_path = "tests/unit/ocr/data/img", dest_folder_path = "tests/unit/ocr/data/json") ``` diff --git a/tests/e2e/test_ocr_e2e.py b/tests/e2e/test_ocr_e2e.py index 895ee23..b93c3ff 100644 --- a/tests/e2e/test_ocr_e2e.py +++ b/tests/e2e/test_ocr_e2e.py @@ -18,7 +18,7 @@ class TestBlobClient: @pytest.mark.parametrize("use_async", [True, False]) def test_upload_images(self, use_async): blob_client = GrokBlobClient.create_from_env_var() - subfolder = "tests/ocr/data/img" + subfolder = "tests/unit/ocr/data/img" subfolder.replace("/", "_") dst_folder, _ = blob_client.upload_images_to_blob( subfolder, use_async=use_async @@ -53,7 +53,7 @@ class TestGROKe2e: @pytest.mark.parametrize("use_async", [False, True]) def test_grok_e2e(self, tmpdir, use_async): grok = Grok.create_from_env_var() - src_folder = "tests/ocr/data/img" + src_folder = "tests/unit/ocr/data/img" grok.run_grok( src_folder, tmpdir, diff --git a/tests/unit/ocr/data/metrics.csv b/tests/unit/ocr/data/metrics.csv index 096164d..125a52e 100644 --- a/tests/unit/ocr/data/metrics.csv +++ b/tests/unit/ocr/data/metrics.csv @@ -1,4 +1,4 @@ edit_insert,edit_delete,edit_replace,edit_insert_spacing,edit_delete_spacing,insert,delete,replace,spacing,total_chars,total_words,total_alnum_words,matching_chars,matching_alnum_words,matching_words,alnum_word_accuracy,word_accuracy,char_accuracy,txt_path,ocr_json_path,filename -1,0,0,1,13,1,0,0,14,1027,166,159,1025,144,150,0.9056603773584906,0.9036144578313253,0.9980525803310614,tests/ocr/data/text/0.txt,tests/ocr/data/json/521c38122f783673598856cd81d91c21_0.png.json,0.txt -3,0,0,0,5,3,0,0,5,958,182,176,955,165,171,0.9375,0.9395604395604396,0.9968684759916493,tests/ocr/data/text/1.txt,tests/ocr/data/json/521c38122f783673598856cd81d91c21_1.png.json,1.txt -2,0,0,0,9,2,0,0,9,1022,188,183,1020,170,175,0.9289617486338798,0.9308510638297872,0.9980430528375733,tests/ocr/data/text/11.txt,tests/ocr/data/json/521c38122f783673598856cd81d91c21_11.png.json,11.txt +1,0,0,1,13,1,0,0,14,1027,166,159,1025,144,150,0.9056603773584906,0.9036144578313253,0.9980525803310614,tests/unit/ocr/data/text/0.txt,tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_0.png.json,0.txt +3,0,0,0,5,3,0,0,5,958,182,176,955,165,171,0.9375,0.9395604395604396,0.9968684759916493,tests/unit/ocr/data/text/1.txt,tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_1.png.json,1.txt +2,0,0,0,9,2,0,0,9,1022,188,183,1020,170,175,0.9289617486338798,0.9308510638297872,0.9980430528375733,tests/unit/ocr/data/text/11.txt,tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_11.png.json,11.txt diff --git a/tests/unit/ocr/data/metrics/metrics.csv b/tests/unit/ocr/data/metrics/metrics.csv index 083c08b..6ab4f4c 100644 --- a/tests/unit/ocr/data/metrics/metrics.csv +++ b/tests/unit/ocr/data/metrics/metrics.csv @@ -1,4 +1,4 @@ edit_insert,edit_delete,edit_replace,edit_insert_spacing,edit_delete_spacing,insert,delete,replace,spacing,total_chars,total_words,total_alnum_words,matching_chars,matching_alnum_words,matching_words,alnum_word_accuracy,word_accuracy,char_accuracy,txt_path,ocr_json_path,filename -2,5,5,0,2,1,1,5,2,1068,176,176,1061,169,169,0.9602272727272727,0.9602272727272727,0.9934456928838952,tests/ocr/data/metrics/text/001.txt,tests/ocr/data/metrics/json/123_001.png.json,001.txt -0,5,17,0,11,0,2,8,11,1789,301,301,1772,283,283,0.9401993355481728,0.9401993355481728,0.9904974846282839,tests/ocr/data/metrics/text/002.txt,tests/ocr/data/metrics/json/123_002.png.json,002.txt -0,1,6,0,17,0,0,5,17,2659,460,459,2653,436,437,0.9498910675381264,0.95,0.9977435125987213,tests/ocr/data/metrics/text/003.txt,tests/ocr/data/metrics/json/123_003.png.json,003.txt +2,5,5,0,2,1,1,5,2,1068,176,176,1061,169,169,0.9602272727272727,0.9602272727272727,0.9934456928838952,tests/unit/ocr/data/metrics/text/001.txt,tests/unit/ocr/data/metrics/json/123_001.png.json,001.txt +0,5,17,0,11,0,2,8,11,1789,301,301,1772,283,283,0.9401993355481728,0.9401993355481728,0.9904974846282839,tests/unit/ocr/data/metrics/text/002.txt,tests/unit/ocr/data/metrics/json/123_002.png.json,002.txt +0,1,6,0,17,0,0,5,17,2659,460,459,2653,436,437,0.9498910675381264,0.95,0.9977435125987213,tests/unit/ocr/data/metrics/text/003.txt,tests/unit/ocr/data/metrics/json/123_003.png.json,003.txt diff --git a/tests/unit/ocr/data/substitution.json b/tests/unit/ocr/data/substitution.json index 016b97a..5cd7a75 100644 --- a/tests/unit/ocr/data/substitution.json +++ b/tests/unit/ocr/data/substitution.json @@ -1 +1 @@ -{"tests/ocr/data/text\\0.txt": {}, "tests/ocr/data/text\\1.txt": {}, "tests/ocr/data/text\\11.txt": {}} \ No newline at end of file +{"tests/unit/ocr/data/text\\0.txt": {}, "tests/unit/ocr/data/text\\1.txt": {}, "tests/unit/ocr/data/text\\11.txt": {}} \ No newline at end of file diff --git a/tests/unit/ocr/test_ocr.py b/tests/unit/ocr/test_ocr.py index 5bbae15..9ba84fa 100644 --- a/tests/unit/ocr/test_ocr.py +++ b/tests/unit/ocr/test_ocr.py @@ -50,7 +50,7 @@ class MockedResponse: "metadata_storage_name": "521c38122f783673598856cd81d91c21_0.png", "layoutText": json.load( open( - "tests/ocr/data/json/521c38122f783673598856cd81d91c21_0.png.json", + "tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_0.png.json", "r", ) ), @@ -59,7 +59,7 @@ class MockedResponse: "metadata_storage_name": "521c38122f783673598856cd81d91c21_1.png", "layoutText": json.load( open( - "tests/ocr/data/json/521c38122f783673598856cd81d91c21_1.png.json", + "tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_1.png.json", "r", ) ), @@ -68,7 +68,7 @@ class MockedResponse: "metadata_storage_name": "521c38122f783673598856cd81d91c21_11.png", "layoutText": json.load( open( - "tests/ocr/data/json/521c38122f783673598856cd81d91c21_11.png.json", + "tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_11.png.json", "r", ) ),