import json
import jellyfish
class table_object(object):
def __init__(self, table, column_text):
self.table = table
self.column_text = column_text
table_objects = []
table = u"TPN_57M"
column_text = u"PN_YY#C_ORG#C_ERP#C_SHP#Q_PN01#Q_PN02#Q_PN03#Q_PN04#Q_PN05#Q_PN06#Q_PN07#Q_PN08#Q_PN09#Q_PN10#Q_PN11#Q_PN12#Q_PN13#Q_PN14#Q_PN15#Q_PN16#Q_PRD01#Q_ETC01#Q_PRD02#Q_ETC02#Q_PRD03#Q_ETC03#Q_PRD04#Q_ETC04#Q_PRD05#Q_ETC05#Q_PRD06#Q_ETC06#Q_PRD07#Q_ETC07#Q_PRD08#Q_ETC08#Q_PRD09#Q_ETC09#Q_PRD10#Q_ETC10#Q_PRD11#Q_ETC11#Q_PRD12#Q_ETC12#Q_PRD13#Q_ETC13#Q_PRD14#Q_ETC14#Q_PRD15#Q_ETC15#Q_PRD16#Q_ETC16"
table_objects.append(table_object(table, column_text))
table = u"TPN_56M"
column_text = u"PN_YY#C_ORG#C_ERP#C_SHP#Q_PN01#Q_PN02#Q_PN03#Q_PN04#Q_PN05#Q_PN06#Q_PN07#Q_PN08#Q_PN09#Q_PN10#Q_PN11#Q_PN12#Q_PN13#Q_PN14#Q_PN15#Q_PN16#Q_PRD01#Q_ETC01#Q_PRD02#Q_ETC02#Q_PRD03#Q_ETC03#Q_PRD04#Q_ETC04#Q_PRD05#Q_ETC05#Q_PRD06#Q_ETC06#Q_PRD07#Q_ETC07#Q_PRD08#Q_ETC08#Q_PRD09#Q_ETC09#Q_PRD10#Q_ETC10#Q_PRD11#Q_ETC11#Q_PRD12#Q_ETC12"
table_objects.append(table_object(table, column_text))
similarity = jellyfish.jaro_distance(table_objects[0].column_text,table_objects[1].column_text)
print("similarity : ",similarity)
python 버전 3.6 기준입니다.
example : https://pyfiddle.io/fiddle/47ac3027-dc8c-42e8-9eed-361edef0f763/?i=true
'Web_Application > python' 카테고리의 다른 글
[python] sp 명으로 sp create 구문 가져오기 (0) | 2019.04.08 |
---|---|
[python][jellyfish] 문자열 유사도 (jaro distance) (0) | 2019.03.26 |
[python] excel to json (0) | 2019.02.08 |
[python] 배열간 빼기 연산 (0) | 2019.01.22 |
[python][pyinstaller] lib not found api-ms-crt-* (0) | 2019.01.02 |