Commit 824e334e by lichenggang

位号的正则

parent 94afe6d9
Showing with 6 additions and 32 deletions
......@@ -197,11 +197,15 @@ class BasePredictor(metaclass=ClassBasePredictorMeta):
位号列预测
"""
# pat = re.compile(r'[CJRULX][1-9]{1,3}')
pat = re.compile(r'(?<!.)[CJRULXKPD][1-9]{1,3}(?![^,,/  ])')
pat = re.compile(r'(?<!.)1?[0-9]?[CJRULXKPD][1-9]{1,3}(?![^,,/  ])')
count = 0
for i in data:
if pat.findall(str(i)):
# print(i, 'yes')
count += 1
else:
pass
# print(i,'no')
return round(count / len(data), 3) >= REF_LEVEL or False
@classmethod
......@@ -256,34 +260,4 @@ class BasePredictor(metaclass=ClassBasePredictorMeta):
if __name__ == "__main__":
print(BasePredictor.is_ref(
['?', '位号', 'C75,C149', 'C59 C252,C5302', 'C49,C50', 'C5323,C5324,C5337', 'C5261,C5262', 'C5312', 'C419',
'C7,C26,C27,C133', 'C37,C108,C109,C110,C111,C127,C194,C248,C123,C420', 'C5189,C5291,C5332',
'C255,C5190,C5292,C5333 C5267,C5272', 'C107,C116', 'C5309,C5340,C5343', 'C423,C426',
'C66,C76,C5265,C5266,C5270,C5271,C5326,C5253,C5254,C5255,C5256,C5257,C5258,C5259,C5260,C5263,C5264,C5306',
'C2,C3,C4,C10,C14,C15,C16,C35,C52,C54,C55,C56,C57,C72,C73,C77,C78,C83,C85,C86,C87,C88,C89,C91,C92,C93,C94,C95,C96,C97,C98,C99,C100,C101,C102,C103,C104,C105,C128,C154,C156,C159,C162,C163,C165,C166,C169,C170,C180,C189,C193,C197,C205,C235,C243,C244,C246,C251,C258,C262,C263,C264,C266,C271,C334,C335,C615,C5188,C5229,C5235,C5290,C5294,C5296,C5299,C5300,C5301,C5316,C5331,C5335,C5345,C18,C117,C353,C362,C363,C377,C378,C380,C424,C425,C5206,C5223,C5226,C5228,C5230,C5231,C5233,C5234,C5240,C5242,C5243,C5245,C5247,C5248,C5249,C5251,C5252,C5268,C5269,C5342,C5344,C5346,C421,C5303,C5305',
'C39,C68,C82,C84,C90,C142,C247,C250,C280,C435', 'C5338,C5339', 'C151 C427',
'C38,C40,C155,C157,C215,C254,C257,C260,C261,C270,C5314 C150 C181 C5224',
'C17,C29,C62,C63,C64,C65,C67,C106,C121,C122,C161,C164,C303,C422,C5244,C5298,C5341,C183,C5304',
'C1,C8,C9,C12,C19,C51,C53,C136,C168,C5193,C5207,C5208,C5293,C5315,C428,C5227,C5232,C5241,C5246,C5250,C5276,C5313,C5327,C5328,C5329,C5330',
'C13,C21,C69,C70,C81', 'C396', 'C364', 'CE5', 'CE3,CE4', 'CE1,CE2',
'R8,R9,R10,R56,R66,R84,R164,R226,R238,R240,R311,R312,R348,R5812,R5889,R5890 R5887',
'R5731,R5732,R5742,R5743,R5744,R5745,R5922,R5923', 'R58,R78,R172,R173',
'R143,R398,R399,R5801,R5802,R5862,R5863,R5864,R5865,R5866,R5867',
'R4,R5,R11,R25,R28,R67,R5750,R5751,R5752,R5753,R5787,R5810,R5822', 'R59', 'R36,R37', 'R5828', 'R239,R241',
'R38', 'R70,R71,R123', 'R1,R280,R5785,R5789,R5797,R5824,R5825,R5830,R5831,R5897', 'R405,R5768 R5888',
'R115 R400,R401,R5920', 'R5826,R5827,R5829,R5832', 'R151', 'R407', 'R5807',
'R101,R117,R144,R150,R153,R156,R157,R159,R161,R162,R307,R5704,R5706,R5748,R5749,R5869,R5874', 'R96,R137',
'R5723,R5857,R5916', 'R136', 'R5771 R5858',
'R12,R31,R32,R33,R34,R35,R42,R44,R61,R77,R80,R125,R132,R140,R141,R193,R212,R267,R419,R5144,R5765,R5766,R5767,R5786,R5800,R5808,R5809,R5815,R5816,R5817,R5894,R5892,R5895,R5896,R5907,R5908,R5910,R5911,R5913,R5914,R5921',
'R139 R5861', 'R92,R138', 'R5147,R5891', 'R45,R5903,R5905,R5906', 'R64', 'R21', 'R65,R5770,R5772',
'R5724,R5769', 'R5782',
'R23,R26,R30,R39,R126,R127,R5722,R5779,R5781,R5783,R5784,R5798,R5799,R5805,R5813,R5814,R5823,R5856,R5915,R5924 R5917',
'R20,R24,R27 R5859', 'R29', 'R43,R49', 'R5725', 'R128,R129', 'R5898 R5918', 'L6,L16 R13', 'R2,R3', 'R130,R131',
'L5103', 'RN2,RN3', 'RP1,RP2', 'FB9,FB10,FB12 L53,L5107,L5108', 'L22', 'L7', 'L24 L5101,L5106,L5109', 'L3,L4',
'L2,L5 L9', 'X6', 'Y1', 'Y2', 'Y3', 'Y5', 'F1', 'D7 D33,D34 D45', 'D40,D41', 'D4,D47', 'D1', 'D5', 'D46',
'Q1,Q3 Q11', 'Q23 1Q1', 'U5116', 'U1', 'U5119', 'U2', 'U5115', 'U5110,U5128,U5133', 'U9,U12', 'U8,U11', 'U13',
'U5120 U5124 ', 'U19 U5118,U5121,U5123', 'U10', 'U20', 'U31', 'U5113', 'U5122', 'U5130', 'U5132', 'U5134',
'U3', 'U5,U6', 'U5126', 'P11',
'ESD1,D13,D14,D15,D16,D17,D18,D19,ESD39,ESD40,ESD41,ESD42,ESD43,ESD44,ESD45,ESD46,ESD47,ESD48,D48,ESD49,ESD55,ESD56,ESD57,ESD61,ESD62,ESD63,ESD64,ESD65,ESD66,ESD67,ESD68,ESD69,ESD70',
'TVS2', ',P1,P2,P5,P10,P4617,P4618,P4620,P4621,P4625', 'P7', 'K1', 'J5', 'J33', 'ANT1', 'J4604,MIC1,MIC2',
'J2 CN2', 'J4601,J4602', 'CTP', 'J4605', 'SW1', 'BAT1', '?']))
['?', '位置', '?', '4C33', '3C5,11C8', '3C6,3C7,2C13,2C14,C283,C285,C286', '?', 'C287,C575,10C33,10C34,10C36,10C37', '4C6,4C26,4C49,4C65', '10C7,10C10,10C11,10C29', '8C4,8C5', '8C40,8C41', '1C7,5C2,5C3,10C2,1C25,1C41,2C11,2C21,2C25,2C37,2C40,4C62,8C29,8C30', '10C12', '10C26,10C35', '1C24,1C43', '10C16,10C20,10C22,10C23', '10C19,10C25', '1C1,1C6,2C1,2C3,2C4,2C6,2C7,3C1,3C2,3C4,3C8,4C2,6C6,6C8,6C9,7C6,7C9,8C7,8C8,8C9,10C4,10C5,10C6,10C9,1C10,1C13,11C4,1C15,1C16,11C6,11C7,1C19,1C22,1C28,1C37,1C44,1C57,1C59,1C63,2C15,2C17,2C29,2C33,2C36,2C38,2C39,3C13,4C12,4C13,4C14,4C15,4C16,4C18,4C19,4C20,4C22,4C23,4C24,4C25,4C28,4C30,4C32,4C34,4C41,4C44,4C45,4C46,4C48,4C51,4C54,4C55,4C57,4C58,4C59,4C60,4C61,6C14,6C16,7C13,8C11,8C17,8C21,10C14,10C17,10C18,10C21,10C28,10C30,10C32,10C42,4C111,4C118,4C121,4C122,C28,C97,C292,C293,C294,C296,C298,C299,C300,C301,C304,C571\n', '10C3,10C15', '2C2,2C9,3C3,4C4,5C6,5C7,5C8,5C9,6C7,7C3,7C7,8C3,2C16,2C18,2C22,2C23,2C26,2C27,2C31,4C17,4C47,4C56,4C63,4C93,5C10,6C46,8C10,8C16,8C18,8C23,8C25,8C31,8C32,8C47,9C21,9C28,4C100,C98,11C9,C290,C291,C295,C297,11C10', '10C8,10C24', '5C1,5C5,2C20,2C30,4C36,4C86,9C27,2C10', '2C12,8C53,9C22', '2C5,3C14,8C37,8C44,10C27', '1C9,4C1,4C7,10C1,1C11,1C14,1C17,1C18,1C20,1C21,1C53,1C58,1C60,1C62,1C64,2C34,2C35,3C15,4C11,4C29,4C31,4C42,4C64,4C82,4C83,8C15,8C42,10C31,4C157,C96,C288,C289,C302,C303,C574', '1C2,1C8,1C30,1C32,1C38,1C70', '1C4,1C5,2C8,4C3,7C4,1C12,1C23,1C26,1C29,1C31,1C34,1C42,1C48,2C32,7C11,7C14,C1,C570', '1C51,10C39,10C41', '1C66,1C71', '?', '?', '10R9,3R24,8R45,8R46', '3C10,7R6,R154,R155,2R21,3R25,7R25,9R32,9R33,9R34,9R35,9R36,9R37,9R38,9R39,9R40,9R41,9R42,9R43,9R44,9R45,9R46,9R47,9R48,9R49,9R50,9R51,9R52,9R53,10R18', 'R1,R2,R3,R4', '7R3,7R4,7R7,7R8,7R23,7R24,8R39,8R41,8R42,8R44', '1R1,1R2,1R16,1R19,1R26,1R49', '10R1,10R8,10R10,10R13', '2R7,2R8,3R3,3R4,3R5,3R6,3R7,2R10,3R20,3R33,3R34,3R35,3R36,3R37', '8R3,8R29,8R30', '6R3', '8R33,8R34,8R35,8R36', '?', '8R2,3R16', '8R37,8R38,8R40,8R43', '?', '2R4,2R5,10R2,10R3,3R17,5R29,5R30,5R32,5R33,5R38,9R13,9R14', '?', '3R15', '5R42', '4R10,4R11,4R12,4R28,4R35', '?', '10R4,10R14', '6R2', '9R5', '1R50,1R53,1R54,1R55,1R56,2R19,5R14,5R19,5R24,5R25,11R11,11R12', '5R40', '1R51', '8R1,4R15,4R16,4R23,4R24,4R33,4R34,10R22,10R30,10R40,10R41', '8R5,8R7', 'R156,R161,1R6,2R2,10R5,8R24,9R15,9R16,11R13,11R15,11R16', '5R28,5R41', '8R18', 'R158', '1R7', '8R16', '2R9', '7R1,8R4,8R6,9R1,10R6,1R21,1R42,1R57,1R58,R160,2R26,3R19,3R23,8R20,8R22,10R11,R167,9R54', '7R5,1R22,1R27,5R16', '1R43', '8R21,8R28', '10R17', '2R12', '1R31', '1R28,10R12', '1R3,5R4,5R37', '1R32', '1R5', '1R4,1R13,1R17,1R23,1R33', '1R14,1R39', '1R15', '5R2,1R12,1R20,1R44,5R11,5R12,5R13,5R17,5R18,5R35', '8R26,8R31', 'R164', '1R29', '2R3', '1R34', '5R3,1R10,1R41,1R60,5R36,11R14', 'R163', '1R18', 'R162,R165', 'R159', '5RN3,5RN4,5RN5,5RN6', '?', '?', '7FB5', '8FB1,10FB1,11FB1,FB4,FB6,FB8,8L2', '?', '10FB2,10FB3', '1L3,1L4', '?', '1L2', 'L2,3L1', 'L1', '1L5', '1L1', '1L6', '5L1,5L2', '10L1,10L2,10L3,10L4', '?', '?', 'D45', 'Q23', '1Q1,1Q8,3Q1,5Q3,5Q4,1Q5,1Q7', '1Q3', '?', '1Q6', '5Q2', '5Q5', '5D3,5D4,5D5,5D6', '5D7,5D8,5D9,7D1,7D2,7D3,7D4,7D5,8D3,8D4,11D1,11D2,5D10,5D11,5D12,5D20,5D22,5D23,5D24', '8D1', '8D2', 'T4', 'U1', 'U7,U18', '?', 'U9', 'U17', '1U2,1U3,1U10', '1U4,1U6,1U7', '2U1', '4U1,4U2,4U3,4U4', '?', '1U1,1U9', '1U5', '8U1', '2U2', '1U11', '3U2', '10U1', '3Y2', '?', '2Y1', 'Y1', '3J1', '8T1', '8JA5', 'CN13', 'J45', '?', '5JA2,5JA3', '1CN2', 'J2,J3', 'J53,J56,J58', '2CN1', 'J4', 'J1', 'J52', 'P2', 'J43']))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment