-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
56 lines (45 loc) · 1.36 KB
/
test.py
File metadata and controls
56 lines (45 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from geocoder_kr.db.rocksdb import RocksDbGeocode
import time
import shutil
from geocoder_kr.geocoder import Geocoder
DB_NAME = "db/current"
if __name__ == "__main__":
db = RocksDbGeocode(DB_NAME, create_if_missing=False)
geocoder = Geocoder(db)
with open(
"test/testfiles/필수test.txt",
"r",
encoding="utf8",
) as f:
n = 0
errcnt = 0
start_time = time.time()
for line in f:
address = line.strip()
if address == "":
break
elif address.startswith("#"): # 주석
print(address)
continue
n = n + 1
print("===============================================")
val = geocoder.search(address)
if not val["success"]:
errcnt = errcnt + 1
# continue
print(val["address"])
if val["errmsg"]:
print(val["errmsg"])
print(val["hash"])
print(val["addressCls"])
print(val["toksString"])
elapsed_time = time.time() - start_time
print(
"total count=",
n,
" elapsed_time(s)=",
elapsed_time,
" count/sec= ",
n / elapsed_time,
)
print(f"err={errcnt}, success={(n-errcnt)/n*100:2.2f}%")