-
Notifications
You must be signed in to change notification settings - Fork 85
/
pipeline_company_name_cleanup.go
48 lines (40 loc) · 1.09 KB
/
pipeline_company_name_cleanup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2019 The Moov Authors
// Use of this source code is governed by an Apache License
// license that can be found in the LICENSE file.
package main
import (
"strings"
)
type companyNameCleanupStep struct {
}
func (s *companyNameCleanupStep) apply(in *Name) error {
switch {
case in.sdn != nil && in.sdn.SDNType == "":
in.Processed = removeCompanyTitles(in.Processed)
case in.ssi != nil && in.ssi.Type == "":
in.Processed = removeCompanyTitles(in.Processed)
}
return nil
}
// original list: inc, incorporated, llc, llp, co, ltd, limited, sa de cv, corporation, corp, ltda,
// open joint stock company, pty ltd, public limited company, ag, cjsc, plc, as, aps,
// oy, sa, gmbh, se, pvt ltd, sp zoo, ooo, sl, pjsc, jsc, bv, pt, tbk
var (
companySuffixReplacer = strings.NewReplacer(
" CO.", "",
" D.O.O.", "",
" INC.", "",
" GMBH", "",
" LLC", "",
" L.L.C.", "",
" LLP", "",
" LTD.", "",
" LTD ", " ",
", LTD", "",
" LTDA.", "",
" SA DE CV", "",
)
)
func removeCompanyTitles(in string) string {
return companySuffixReplacer.Replace(in)
}