This commit is contained in:
Jianjie Liu (MAIDAP) 2021-01-26 15:54:17 -05:00
Родитель f4bd57686c
Коммит 1ea5dd4ffa
6 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -66,9 +66,9 @@ Example usage:
```python ```python
from genalog.ocr.grok import Grok from genalog.ocr.grok import Grok
from dotenv import load_dotenv from dotenv import load_dotenv
load_dotenv("tests/ocr/.env") load_dotenv("tests/unit/ocr/.env")
grok = Grok.create_from_env_var() 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")
``` ```

Просмотреть файл

@ -18,7 +18,7 @@ class TestBlobClient:
@pytest.mark.parametrize("use_async", [True, False]) @pytest.mark.parametrize("use_async", [True, False])
def test_upload_images(self, use_async): def test_upload_images(self, use_async):
blob_client = GrokBlobClient.create_from_env_var() blob_client = GrokBlobClient.create_from_env_var()
subfolder = "tests/ocr/data/img" subfolder = "tests/unit/ocr/data/img"
subfolder.replace("/", "_") subfolder.replace("/", "_")
dst_folder, _ = blob_client.upload_images_to_blob( dst_folder, _ = blob_client.upload_images_to_blob(
subfolder, use_async=use_async subfolder, use_async=use_async
@ -53,7 +53,7 @@ class TestGROKe2e:
@pytest.mark.parametrize("use_async", [False, True]) @pytest.mark.parametrize("use_async", [False, True])
def test_grok_e2e(self, tmpdir, use_async): def test_grok_e2e(self, tmpdir, use_async):
grok = Grok.create_from_env_var() grok = Grok.create_from_env_var()
src_folder = "tests/ocr/data/img" src_folder = "tests/unit/ocr/data/img"
grok.run_grok( grok.run_grok(
src_folder, src_folder,
tmpdir, tmpdir,

Просмотреть файл

@ -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 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 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/ocr/data/text/1.txt,tests/ocr/data/json/521c38122f783673598856cd81d91c21_1.png.json,1.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/ocr/data/text/11.txt,tests/ocr/data/json/521c38122f783673598856cd81d91c21_11.png.json,11.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

1 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 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/unit/ocr/data/text/0.txt tests/ocr/data/json/521c38122f783673598856cd81d91c21_0.png.json tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_0.png.json 0.txt
3 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/unit/ocr/data/text/1.txt tests/ocr/data/json/521c38122f783673598856cd81d91c21_1.png.json tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_1.png.json 1.txt
4 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/unit/ocr/data/text/11.txt tests/ocr/data/json/521c38122f783673598856cd81d91c21_11.png.json tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_11.png.json 11.txt

Просмотреть файл

@ -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 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 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/ocr/data/metrics/text/002.txt,tests/ocr/data/metrics/json/123_002.png.json,002.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/ocr/data/metrics/text/003.txt,tests/ocr/data/metrics/json/123_003.png.json,003.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

1 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 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/unit/ocr/data/metrics/text/001.txt tests/ocr/data/metrics/json/123_001.png.json tests/unit/ocr/data/metrics/json/123_001.png.json 001.txt
3 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/unit/ocr/data/metrics/text/002.txt tests/ocr/data/metrics/json/123_002.png.json tests/unit/ocr/data/metrics/json/123_002.png.json 002.txt
4 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/unit/ocr/data/metrics/text/003.txt tests/ocr/data/metrics/json/123_003.png.json tests/unit/ocr/data/metrics/json/123_003.png.json 003.txt

Просмотреть файл

@ -1 +1 @@
{"tests/ocr/data/text\\0.txt": {}, "tests/ocr/data/text\\1.txt": {}, "tests/ocr/data/text\\11.txt": {}} {"tests/unit/ocr/data/text\\0.txt": {}, "tests/unit/ocr/data/text\\1.txt": {}, "tests/unit/ocr/data/text\\11.txt": {}}

Просмотреть файл

@ -50,7 +50,7 @@ class MockedResponse:
"metadata_storage_name": "521c38122f783673598856cd81d91c21_0.png", "metadata_storage_name": "521c38122f783673598856cd81d91c21_0.png",
"layoutText": json.load( "layoutText": json.load(
open( open(
"tests/ocr/data/json/521c38122f783673598856cd81d91c21_0.png.json", "tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_0.png.json",
"r", "r",
) )
), ),
@ -59,7 +59,7 @@ class MockedResponse:
"metadata_storage_name": "521c38122f783673598856cd81d91c21_1.png", "metadata_storage_name": "521c38122f783673598856cd81d91c21_1.png",
"layoutText": json.load( "layoutText": json.load(
open( open(
"tests/ocr/data/json/521c38122f783673598856cd81d91c21_1.png.json", "tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_1.png.json",
"r", "r",
) )
), ),
@ -68,7 +68,7 @@ class MockedResponse:
"metadata_storage_name": "521c38122f783673598856cd81d91c21_11.png", "metadata_storage_name": "521c38122f783673598856cd81d91c21_11.png",
"layoutText": json.load( "layoutText": json.load(
open( open(
"tests/ocr/data/json/521c38122f783673598856cd81d91c21_11.png.json", "tests/unit/ocr/data/json/521c38122f783673598856cd81d91c21_11.png.json",
"r", "r",
) )
), ),