Permalink
Browse files

Enhance parsing of the class of a record.

  • Loading branch information...
1 parent 7528ddd commit f8f32547683e122d0b3d3c71bb286263d6d2be69 Julosaure committed Apr 1, 2013
Showing with 8 additions and 3 deletions.
  1. +8 −3 lcFormat.py
View
@@ -1,5 +1,5 @@
-import sys, string
+import sys, string, re
# nb of columns/features per record
NB_COL=42
@@ -32,7 +32,7 @@ def __str__(self):
class lcRow2Rec():
def __init__(self):
- pass
+ self.patPolicy = re.compile("^does not meet the current credit policy status: ")
def row2Rec(self, row):
assert len(row)==NB_COL, "len(row)="+str(len(row))+" / NB_COL="+str(NB_COL)
@@ -43,7 +43,12 @@ def row2Rec(self, row):
# assign class to record
i = f2id["status"]
- lcRec.target = lcRec[i] #targets.index(lcRec[i])
+ v = lcRec[i]
+ match = self.patPolicy.match(v)
+ if match:
+ lcRec.oldPolicy = True
+ v = v[match.end():]
+ lcRec.target = v #targets.index(v)
del lcRec[i]

0 comments on commit f8f3254

Please sign in to comment.