first commit
This commit is contained in:
commit
8c4dcae475
89 changed files with 24623 additions and 0 deletions
60
agencies.go
Normal file
60
agencies.go
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
// agencies.go - display names for the acronyms used as document creators
|
||||
|
||||
package main
|
||||
|
||||
import "strings"
|
||||
|
||||
var agencyNames = map[string]string{
|
||||
"CSE": "Communications Security Establishment (Canada)",
|
||||
"DFS": "Directorate for Signals Intelligence (Japan)",
|
||||
"DNI": "Director of National Intelligence (US)",
|
||||
"DOD": "Department of Defense (US)",
|
||||
"DOJ": "Department of Justice (US)",
|
||||
"DOS": "Department of State (US)",
|
||||
"DSD": "Defence Signals Directorate (Australia; now ASD)",
|
||||
"FISC": "Foreign Intelligence Surveillance Court (US)",
|
||||
"FVEY": "Five Eyes (US, UK, Canada, Australia, New Zealand)",
|
||||
"GCHQ": "Government Communications Headquarters (UK)",
|
||||
"GCSB": "Government Communications Security Bureau (New Zealand)",
|
||||
"MI5": "Security Service (UK)",
|
||||
"NATO": "North Atlantic Treaty Organization",
|
||||
"NCTC": "National Counterterrorism Center (US)",
|
||||
"NSA": "National Security Agency (US)",
|
||||
"ODNI": "Office of the Director of National Intelligence (US)",
|
||||
"SIS": "Secret Intelligence Service (UK)",
|
||||
"SWAC": "Southwest Analysis Center",
|
||||
"USG": "United States Government",
|
||||
}
|
||||
|
||||
func agencyName(creator string) string {
|
||||
var out strings.Builder
|
||||
known := false
|
||||
start := 0
|
||||
flush := func(end int) {
|
||||
part := creator[start:end]
|
||||
key := strings.ToUpper(strings.TrimSpace(part))
|
||||
if name, ok := agencyNames[key]; ok {
|
||||
known = true
|
||||
out.WriteString(name)
|
||||
} else {
|
||||
out.WriteString(strings.TrimSpace(part))
|
||||
}
|
||||
}
|
||||
for i := 0; i < len(creator); i++ {
|
||||
switch creator[i] {
|
||||
case '/':
|
||||
flush(i)
|
||||
out.WriteString(" / ")
|
||||
start = i + 1
|
||||
case ',':
|
||||
flush(i)
|
||||
out.WriteString(", ")
|
||||
start = i + 1
|
||||
}
|
||||
}
|
||||
flush(len(creator))
|
||||
if !known {
|
||||
return ""
|
||||
}
|
||||
return out.String()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue