hipom_data_mapping/data_preprocess/abbreviations/replacement_dict.py

210 lines
6.8 KiB
Python

# substitution mapping for descriptions
# Abbreviations and their replacements
desc_replacement_dict = {
r'\bLIST\b\b': 'LIST',
r'\bList\b\b': 'LIST',
r'\bEXH\.\b': 'EXHAUST',
r'\bEXH\b\b': 'EXHAUST',
r'\bEXHAUST\.\b': 'EXHAUST',
r'\bExhaust\b\b': 'EXHAUST',
r'\bEXHAUST\b\b': 'EXHAUST',
r'\bTEMP\.\b': 'TEMPERATURE',
r'\bTEMP\b\b': 'TEMPERATURE',
r'\bTEMPERATURE\.\b': 'TEMPERATURE',
r'\bTEMPERATURE\b\b': 'TEMPERATURE',
r'\bW\.\b': 'WATER',
r'\bWATER\b\b': 'WATER',
r'\bCW\b\b': 'COOLING WATER',
r'\bCYL\.\b': 'CYLINDER',
r'\bCyl\b\b': 'CYLINDER',
r'\bcyl\.\b': 'CYLINDER',
r'\bCYL\b\b': 'CYLINDER',
r'\bCYL(?=\d|\W|$)\b': 'CYLINDER',
r'\bcylinder\b\b': 'CYLINDER',
r'\bCYLINDER\b\b': 'CYLINDER',
r'\bCOOL\.\b': 'COOLING',
r'\bcool\.\b': 'COOLING',
r'\bcooling\b\b': 'COOLING',
r'\bCOOLING\b\b': 'COOLING',
r'\bcooler\b\b': 'COOLER',
r'\bCOOLER\b\b': 'COOLER',
r'\bScav\.\b': 'SCAVENGE',
r'\bSCAV\.\b': 'SCAVENGE',
r'\bINL\.\b': 'INLET',
r'\binlet\b\b': 'INLET',
r'\bINLET\b\b': 'INLET',
r'\bOUT\.\b': 'OUTLET',
r'\bOUTL\.\b': 'OUTLET',
r'\boutlet\b\b': 'OUTLET',
r'\bOUTLET\b\b': 'OUTLET',
# pressure
r'\bPRESS\b\b': 'PRESSURE',
r'\bPRESS\.\b': 'PRESSURE',
r'\bPress\.\b': 'PRESSURE',
r'\bpressure\b\b': 'PRESSURE',
r'\bPRESSURE\b\b': 'PRESSURE',
# this is a special replacement - it is safe to replace PRS w/o checks
r'PRS\b': 'PRESSURE',
r'\bCLR\b\b': 'CLEAR',
r'\bENG\.\b': 'ENGINE',
r'\bENG\b\b': 'ENGINE',
r'\bENGINE\b\b': 'ENGINE',
r'\bEngine speed\b\b': 'ENGINE SPEED',
r'\bEngine running\b\b': 'ENGINE RUNNING',
r'\bEngine RPM pickup\b\b': 'ENGINE RPM PICKUP',
r'\bEngine room\b\b': 'ENGINE ROOM',
# main engine
r'\bM/E\b': 'MAIN_ENGINE',
r'\bM_E\b': 'MAIN_ENGINE',
r'\bME(?=\d|\W|$)\b': 'MAIN_ENGINE',
r'\bMAIN ENGINE\b\b': 'MAIN_ENGINE',
r'\bGen\b\b': 'GENERATOR_ENGINE',
# ensure that we substitute only for terms where following GE is num or special
r'\bGE(?=\d|\W|$)\b': 'GENERATOR_ENGINE',
r'\bG/E\b': 'GENERATOR_ENGINE',
r'\bG_E\b': 'GENERATOR_ENGINE',
r'\bDG\b': 'GENERATOR_ENGINE',
r'\bD/G\b\b': 'GENERATOR_ENGINE',
r'\bGEN\.\b': 'GENERATOR_ENGINE',
r'\bGENERATOR ENGINE\B\b': 'GENERATOR_ENGINE',
r'\b(\d+)MGE\b\b': r'NO\1 GENERATOR_ENGINE',
r'\bGEN\.WIND\.TEMP\b\b': 'GENERATOR WINDING TEMPERATURE',
r'\bENGINE ROOM\b\b': 'ENGINE ROOM',
r'\bE/R\b\b': 'ENGINE ROOM',
r'\bFLTR\b\b': 'FILTER',
# marine gas oil
r'\bM\.G\.O\b\b': 'MARINE GAS OIL',
r'\bMGO\b\b': 'MARINE GAS OIL',
r'\bMDO\b\b': 'MARINE DIESEL OIL',
# light fuel oil
r'\bL\.F\.O\b\b': 'LIGHT FUEL OIL',
r'\bLFO\b\b': 'LIGHT FUEL OIL',
# heavy fuel oil
r'\bHFO\b\b': 'HEAVY FUEL OIL',
r'\bH\.F\.O\b\b': 'HEAVY FUEL OIL',
# for remaining fuel oil that couldn't be substituted
r'\bF\.O\b\b': 'FUEL OIL',
r'\bFO\b\b': 'FUEL OIL',
# lubricant
r'\bLUB\.\b': 'LUBRICANT',
# lubricating oil
r'\bL\.O\b\b': 'LUBRICATING OIL',
r'\bLO\b\b': 'LUBRICATING OIL',
# lubricating oil pressure
r'\bLO_PRESS\b\b': 'LUBRICATING OIL PRESSURE',
r'\bLO_PRESSURE\b\b': 'LUBRICATING OIL PRESSURE',
# temperature
r'\bL\.T\b\b': 'LOW TEMPERATURE',
r'\bLT\b\b': 'LOW TEMPERATURE',
r'\bH\.T\b\b': 'HIGH TEMPERATURE',
r'\bHT\b\b': 'HIGH TEMPERATURE',
# auxiliary boiler
# replace these first before replacing AUXILIARY only
r'\bAUX\.BOILER\b\b': 'AUXILIARY BOILER',
r'\bAUX\. BOILER\b\b': 'AUXILIARY BOILER',
r'\bAUX BLR\b\b': 'AUXILIARY BOILER',
r'\bAUX\.\b': 'AUXILIARY',
# composite boiler
r'\bCOMP\. BOILER\b\b': 'COMPOSITE BOILER',
r'\bCOMP BOILER\b\b': 'COMPOSITE BOILER',
r'\bWIND\.\b': 'WINDING',
r'\bWINDING\b\b': 'WINDING',
r'\bC\.S\.W\b\b': 'CSW',
r'\bCSW\b\b': 'CSW',
r'\bVLOT\.\b': 'VOLTAGE',
r'\bVOLTAGE\b\b': 'VOLTAGE',
r'\bVOLT\.\b': 'VOLTAGE',
r'\bFREQ\.\b': 'FREQUENCY',
r'\bFREQUENCY\b\b': 'FREQUENCY',
r'\bCURR\.\b': 'CURRENT',
r'\bCURRENT\b\b': 'CURRENT',
r'\bTCA\b\b': 'TURBOCHARGER',
r'\bTCB\b\b': 'TURBOCHARGER',
r'\bT/C\b': 'TURBOCHARGER',
r'\bT_C\b': 'TURBOCHARGER',
r'\bTC(?=\d|\W|$)\b': 'TURBOCHARGER',
r'\bTURBOCHAGER\b\b': 'TURBOCHARGER',
r'\bTURBOCHARGER\b\b': 'TURBOCHARGER',
# misc spelling errors
r'\bOPERATOIN\b': 'OPERATION',
# additional standardizing replacement
# replace # followed by a number with NO
r'#(?=\d)\b': 'NO',
r'\bNO\.(?=\d)\b': 'NO',
# yes, there was one with two dots - what the hell?
r'\bNO\.\.(?=\d)\b': 'NO',
r'\bNo\.(?=\d)\b': 'NO',
}
# substitution mapping for units
# Abbreviations and their replacements
unit_replacement_dict = {
r'\b%\b': 'PERCENT',
r'\b-\b': '',
r'\b- \b': '',
# ensure no character after A
r'\bA(?!\w|/)': 'CURRENT',
r'\bAmp(?!\w|/)': 'CURRENT',
r'\bHz\b': 'HERTZ',
r'\bKG/CM2\b': 'PRESSURE',
r'\bKG/H\b': 'KILOGRAM PER HOUR',
r'\bKNm\b': 'RPM',
r'\bKW\b': 'POWER',
r'\bKg(?!\w|/)': 'MASS',
r'\bKw\b': 'POWER',
r'\bL(?!\w|/)': 'VOLUME',
r'\bMT/h\b': 'METRIC TONNES PER HOUR',
r'\bMpa\b': 'PRESSURE',
r'\bPF\b': 'POWER FACTOR',
r'\bRPM\b': 'RPM',
r'\bV(?!\w|/)': 'VOLTAGE',
r'\bbar(?!\w|/)': 'PRESSURE',
r'\bbarA\b': 'SCAVENGE PRESSURE',
r'\bcST\b': 'VISCOSITY',
r'\bcSt\b': 'VISCOSITY',
r'\bcst\b': 'VISCOSITY',
r'\bdeg(?!\w|/|\.)': 'DEGREE',
r'\bdeg.C\b': 'TEMPERATURE',
r'\bdegC\b': 'TEMPERATURE',
r'\bdegree\b': 'DEGREE',
r'\bdegreeC\b': 'TEMPERATURE',
r'\bhPa\b': 'PRESSURE',
r'\bhours\b': 'HOURS',
r'\bkN\b': 'THRUST',
r'\bkNm\b': 'TORQUE',
r'\bkW\b': 'POWER',
# ensure that kg is not followed by anything
r'\bkg(?!\w|/)': 'FLOW', # somehow in the data its flow
r'\bkg/P\b': 'MASS FLOW',
r'\bkg/cm2\b': 'PRESSURE',
r'\bkg/cm²\b': 'PRESSURE',
r'\bkg/h\b': 'MASS FLOW',
r'\bkg/hr\b': 'MASS FLOW',
r'\bkg/pulse\b': '',
r'\bkgf/cm2\b': 'PRESSURE',
r'\bkgf/cm²\b': 'PRESSURE',
r'\bkgf/㎠\b': 'PRESSURE',
r'\bknots\b': 'SPEED',
r'\bkw\b': 'POWER',
r'\bl/Hr\b': 'VOLUME FLOW',
r'\bl/h\b': 'VOLUME FLOW',
r'\bl_Hr\b': 'VOLUME FLOW',
r'\bl_hr\b': 'VOLUME FLOW',
r'\bM\b': 'DRAFT', # for wind draft
r'm': 'm', # wind draft and trim - not useful
r'\bm/s\b': 'SPEED',
r'\bm3\b': 'VOLUME',
r'\bmH2O\b': 'DRAFT',
r'\bmWC\b': 'DRAFT',
r'\bmbar\b': 'PRESSURE',
r'\bmg\b': 'ACCELERATION',
r'\bmin-¹\b': '', # data too varied
r'\bmm\b': '', # data too varied
r'\bmmH2O\b': 'WATER DRUM LEVEL',
r'\brev\b': 'RPM',
r'\brpm\b': 'RPM',
r'\bx1000min-¹\b': '',
r'\b°C\b': 'TEMPERATURE',
r'\bºC\b': 'TEMPERATURE',
r'\b℃\b': 'TEMPERATURE'
}