Skip to content
This repository
Browse code

Added more salutations. Added base tests file.

  • Loading branch information...
commit 46e7a92ae95744152bfd1a44b2f38ebff339d099 1 parent b01c134
James Polera authored March 03, 2012

Showing 2 changed files with 23 additions and 5 deletions. Show diff stats Hide diff stats

  1. 1  name_tests.py
  2. 27  separate.py
1  name_tests.py
... ...
@@ -0,0 +1 @@
  1
+__author__ = 'james'
27  separate.py
... ...
@@ -1,15 +1,23 @@
  1
+# -*- coding: utf-8 -*-
  2
+
1 3
 class Name:
2 4
    
3 5
   SALUTATIONS = ['MR','MS','MRS','DR','MISS','DOCTOR','CORP','SGT','PVT','JUDGE',
4  
-                 'CAPT','HON','OFFICER','REV']
5  
-  GENERATIONS = ['JR','SR','I','II','III','IV','V','VI','VII','VIII','IX','X']
  6
+                 'CAPT','COL','MAJ','LT','LIEUTENANT','PRM','PATROLMAN','HON',
  7
+                 'OFFICER','REV','PRES','PRESIDENT',
  8
+                 'GOV','GOVERNOR','VICE PRESIDENT','VP','MAYOR']
  9
+  GENERATIONS = ['JR','SR','I','II','III','IV','V','VI','VII','VIII','IX','X',
  10
+                 '1ST','2ND','3RD','4TH','5TH','6TH','7TH','8TH','9TH','10TH',
  11
+                 'FIRST','SECOND','THIRD','FOURTH','FIFTH','SIXTH','SEVENTH',
  12
+                 'EIGHTH','NINTH','TENTH']
6 13
   SUFFIXES    = ['ESQ','PHD','MD']
7 14
   LNPREFIXES  = ['DE', 'DA', 'DI','LA', 'DU', 'DEL', 'DEI', 'VDA', 'DELLO', 'DELLA', 
8 15
                  'DEGLI', 'DELLE', 'VAN', 'VON', 'DER', 'DEN', 'HEER', 'TEN', 'TER', 
9 16
                  'VANDE', 'VANDEN', 'VANDER', 'VOOR', 'VER', 'AAN', 'MC', 'BEN','SAN',
10 17
                  'SAINZ']
11 18
   NON_NAME    = ['A.K.A.','AKA','A/K/A','F.K.A','FKA','F/K/A','N/K/A','FICTITIOUS']
12  
-  CORP_ENTITY = ['NA','CORP','CO','INC','ASSOCIATES','SERVICE','LLC','LLP','PARTNERS','R/A','C/O', 'COUNTY','STATE',
  19
+  CORP_ENTITY = ['NA','CORP','CO','INC','ASSOCIATES','SERVICE','LLC','LLP','PARTNERS',
  20
+                 'R/A','C/O', 'COUNTY','STATE',
13 21
                  'BANK','GROUP','MUTUAL','FARGO']
14 22
   SUPPLEMENTAL_INFO = ['WIFE OF','HUSBAND OF','SON OF','DAUGHTER OF']
15 23
 
@@ -81,7 +89,9 @@ def __clean(self):
81 89
       supplemental_index = self.__full_name.upper().find(supplemental_text)
82 90
       if supplemental_index > -1:
83 91
         self.__full_name = self.__full_name[0:supplemental_index].strip()
84  
-    unwanted = ['.',',','/']
  92
+
  93
+    unwanted = ['.',',','/','the']
  94
+
85 95
     for char in unwanted:
86 96
       self.__full_name = self.__full_name.replace(char,'')
87 97
     self.__split_name = self.__full_name.split(" ")
@@ -112,7 +122,7 @@ def __clean(self):
112 122
       
113 123
       
114 124
   def __repr__(self):
115  
-    return unicode("<separate.Name: '%s'>" % self.__full_name)
  125
+    return unicode("<Name: '%s'>" % self.__full_name)
116 126
       
117 127
   def process_name(self):  
118 128
     if self.__processed or self.looks_corporate or self.has_non_name_values:
@@ -234,3 +244,10 @@ def get_name_as_dict(self):
234 244
   print n.as_dict
235 245
   n = Name("Otto von Bismark")
236 246
   print n.as_dict
  247
+
  248
+
  249
+  #TODO: Get these working
  250
+  n = Name("Thurston Howell the 3rd")
  251
+  print n.as_dict
  252
+  n = Name("Bruce Wayne a/k/a Batman")
  253
+  print n.as_dict

0 notes on commit 46e7a92

Please sign in to comment.
Something went wrong with that request. Please try again.