Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/platform/extraction/deterministic.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/platform/extraction/deterministic.go |
| Original SHA-256 | 14fc5074e3495c7a68642f371b06c985fe64d03917c37c966a4c0e37ec1ed6a5 |
| Git blob SHA | b0c91eea823289c592b5af95a3564d995a86cc5f |
| Reading-copy SHA-256 | 14fc5074e3495c7a68642f371b06c985fe64d03917c37c966a4c0e37ec1ed6a5 |
Every recorded occurrence
These 35 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | per-tenant-routing | 9bde0f9a74b89d01980fa658e5253acda7528d0c | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ws6-retrieval | 6c56e29231ec05735927fa265c97d517499dfeaf | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | workstream-a-shared-core | e0de03ac3a1ec826bd15d0e048e3b02baa23eeff | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | workstream-c-slatematch | 5cd60c918301b46ecd6ed3e03e20c395da0062e2 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ws1-ontology-sync | b596f449a32a1016fbd403c36505cc00a1ac9ee6 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ws8-teaching-loop | c823f0fb6bb2aba0f39001eb6de96f4000d9321f | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | w3-ai-staffing-recommendations | 43d56387270ef4da4cabd794d97ca6a49909bc7d | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ws3-clearance | 4b8e7ce594c068621867f9c9deed0ec64ae6c553 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | workstream-d-command-center | 255e7d1d420abf5e277d0cd8c9b14f6f72b6acb9 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | phase2-eval-fairness | d361af254701975fe239927656ababb56374655e | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | workstream-e-dataflow-deploy | 433815a042f9741411e60fa553fe72143e9b10db | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ruthless-debug-sweep | b7d742f8f032984be3817efffa3eb8b13b651c1f | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ai-intelligence-layer | 5d5ddff70393a197c5f54a45280bb5dd42b24755 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | workstream-a-opportunity-intelligence | 1675031db74316e100782d063e9eda1a597fe3a1 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | deploy-and-ops | bdacd9d0b4d5998d25fc74bf4007f4c3ec538c7a | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ws9-bench-ingestion | f585a9ef32fa554663ce1fba9a414a54b6e49cf0 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ws2-alias-relationship | e4dada4601c6eb101830f9d223a9655dfa120616 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | workstream-b-screenmatch | 09015496d565a172bcaa15cfe9a8e4b072b13df0 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ws7-federal-signal | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | workstream-e-commercial-stubs | 4437da660539284a400ee380b9b427a300c369ee | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | ai-brain-live | aac32fc49c878cc5bca099459307611562d0bac1 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | workstream-d-missionmatch | 3be46ba89edb737182075a2b320509b42dc916f8 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | workstream-b-sam-contract-awards | d5101cceb98e70000cebb31d3e7ac73d747d3a6d | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/platform/extraction/deterministic.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓354 lines · 13.2 KB
package extraction
import (
"context"
"regexp"
"sort"
"strconv"
"strings"
)
// deterministic is the offline rules plus gazetteer extractor. It is fully deterministic and needs no
// model, key, or network, so it is the production default for the closed vocabulary fields and is the
// only extractor in this build. Every value it emits is a self reported mention, never a verified fact.
type deterministic struct{}
// NewDeterministic builds the offline extractor.
func NewDeterministic() Extractor { return deterministic{} }
// ExtractResume parses a resume into proposed candidate fields.
func (deterministic) ExtractResume(_ context.Context, text string) (RawExtraction, error) {
lower := strings.ToLower(text)
level := detectClearanceLevel(lower)
rx := RawExtraction{
FullName: detectName(text),
ClearanceLevel: level,
ClearancePoly: detectPoly(lower),
ClearanceActive: level != "" && !reNegativeClearance.MatchString(lower),
Skills: detectFromGazetteer(lower, skillMatchers),
Certifications: detectFromGazetteer(lower, certMatchers),
Agencies: detectFromGazetteer(lower, agencyMatchers),
YearsExperience: detectYears(lower),
Location: detectLocation(text),
}
return rx, nil
}
// ExtractRequirement parses a pasted job description into proposed requirement fields. The clearance is
// the requirement's STATED required clearance (active is not meaningful for a requirement), and the
// skills, certifications, and agency become the required set the candidate is scored against.
func (deterministic) ExtractRequirement(_ context.Context, text string) (RawExtraction, error) {
lower := strings.ToLower(text)
rx := RawExtraction{
ClearanceLevel: detectClearanceLevel(lower),
ClearancePoly: detectPoly(lower),
Skills: detectFromGazetteer(lower, skillMatchers),
Certifications: detectFromGazetteer(lower, certMatchers),
Agencies: detectFromGazetteer(lower, agencyMatchers),
YearsExperience: detectYears(lower),
Location: detectLocation(text),
}
return rx, nil
}
// ---------- clearance ----------
var (
// TS/SCI in its common written forms. "sci" alone, or any of the ts sci spellings, implies TS/SCI.
reTSSCI = regexp.MustCompile(`(?i)\b(ts\s*/?\s*sci|tssci|sci)\b`)
reTopSecret = regexp.MustCompile(`(?i)\btop\s+secret\b`)
reSecret = regexp.MustCompile(`(?i)\bsecret\b`)
reConfid = regexp.MustCompile(`(?i)\bconfidential\b`)
reFullScope = regexp.MustCompile(`(?i)\b(full[\s-]*scope|fs\s*poly|lifestyle\s*poly)\b`)
reCIPoly = regexp.MustCompile(`(?i)\b(ci\s*poly|counter\s*intelligence\s*poly|counterintelligence)\b`)
reNegativeCle = regexp.MustCompile(`(?i)\b(expired|inactive|lapsed|former\s+clearance|no\s+longer)\b`)
reYears = regexp.MustCompile(`(?i)(\d{1,2})\s*\+?\s*years?`)
reCityState = regexp.MustCompile(`\b([A-Z][a-zA-Z]+(?: [A-Z][a-zA-Z]+){0,2}),\s*([A-Z]{2})\b`)
)
// reNegativeClearance is aliased so ExtractResume reads clearly.
var reNegativeClearance = reNegativeCle
// detectClearanceLevel returns the highest specificity clearance code found, empty when none. Order is
// load bearing: top secret is checked before secret (secret is a substring of top secret), and TS/SCI
// before top secret, so a resume that says "TS/SCI" is never downgraded to Secret.
func detectClearanceLevel(lower string) string {
switch {
case reTSSCI.MatchString(lower) && (reTopSecret.MatchString(lower) || strings.Contains(lower, "sci")):
return "ts_sci"
case reTopSecret.MatchString(lower):
return "top_secret"
case reSecret.MatchString(lower):
return "secret"
case reConfid.MatchString(lower):
return "confidential"
default:
return ""
}
}
func detectPoly(lower string) string {
switch {
case reFullScope.MatchString(lower):
return "full_scope"
case reCIPoly.MatchString(lower):
return "ci"
default:
return ""
}
}
func detectYears(lower string) int {
best := 0
for _, m := range reYears.FindAllStringSubmatch(lower, -1) {
n, err := strconv.Atoi(m[1])
if err != nil {
continue
}
if n > 50 { // implausible for a single career; treat as noise
continue
}
if n > best {
best = n
}
}
return best
}
// detectLocation returns the first "City, ST" mention whose two letter code is a real USPS state or
// territory, from the original (cased) text. Validating the code rejects job title and org fragments
// like "Manager, HR" or "Director, VP" that share the City, ST shape, while keeping HI, NM, VA, DC.
func detectLocation(text string) string {
for _, m := range reCityState.FindAllStringSubmatch(text, -1) {
if usStates[m[2]] {
return strings.TrimSpace(m[1]) + ", " + m[2]
}
}
return ""
}
// usStates is the set of USPS state, district, and territory codes used to validate a detected location.
var usStates = map[string]bool{
"AL": true, "AK": true, "AZ": true, "AR": true, "CA": true, "CO": true, "CT": true, "DE": true,
"FL": true, "GA": true, "HI": true, "ID": true, "IL": true, "IN": true, "IA": true, "KS": true,
"KY": true, "LA": true, "ME": true, "MD": true, "MA": true, "MI": true, "MN": true, "MS": true,
"MO": true, "MT": true, "NE": true, "NV": true, "NH": true, "NJ": true, "NM": true, "NY": true,
"NC": true, "ND": true, "OH": true, "OK": true, "OR": true, "PA": true, "RI": true, "SC": true,
"SD": true, "TN": true, "TX": true, "UT": true, "VT": true, "VA": true, "WA": true, "WV": true,
"WI": true, "WY": true, "DC": true, "PR": true, "GU": true, "VI": true, "AS": true, "MP": true,
}
// ---------- name (resume only, best effort, used solely for the Save Candidate prefill) ----------
var headerWords = map[string]bool{
"resume": true, "curriculum": true, "vitae": true, "profile": true, "summary": true,
"objective": true, "experience": true, "education": true, "skills": true, "contact": true,
}
// detectName returns the first line that looks like a person name: two to four capitalized alphabetic
// tokens, no digits, not a section header. Empty when nothing qualifies (the form then asks for it).
func detectName(text string) string {
for _, line := range strings.Split(text, "\n") {
line = strings.TrimSpace(line)
if line == "" || strings.ContainsAny(line, "0123456789@") {
continue
}
fields := strings.Fields(line)
if len(fields) < 2 || len(fields) > 4 {
continue
}
ok := true
for _, f := range fields {
if headerWords[strings.ToLower(strings.Trim(f, ".,"))] {
ok = false
break
}
r := []rune(f)
if len(r) == 0 || r[0] < 'A' || r[0] > 'Z' {
ok = false
break
}
for _, c := range r {
if !(c >= 'A' && c <= 'Z') && !(c >= 'a' && c <= 'z') && c != '.' && c != '-' && c != '\'' {
ok = false
break
}
}
if !ok {
break
}
}
if ok {
return line
}
}
return ""
}
// ---------- gazetteers (canonical label plus the lowercased mentions that resolve to it) ----------
type gazEntry struct {
canonical string
mentions []string
}
// mentionMatcher matches one gazetteer mention. A wordlike mention (letters, digits, spaces) is matched
// on a word boundary so a short token like "java" or "ato" matches "Java," or "ATO" but NOT the inside
// of "javascript" or "potato". A mention carrying a regex special character (for example "c++",
// "security+") falls back to a plain substring match, which is safe because those are distinctive.
type mentionMatcher struct {
re *regexp.Regexp // nil means use the substring path
contains string
}
func (m mentionMatcher) match(lower string) bool {
if m.re != nil {
return m.re.MatchString(lower)
}
return strings.Contains(lower, m.contains)
}
// compiledGaz is a gazetteer entry with its mentions compiled to matchers, built once in init.
type compiledGaz struct {
canonical string
matchers []mentionMatcher
}
var reWordlike = regexp.MustCompile(`^[a-z0-9][a-z0-9 ]*$`)
func compileMentions(mentions []string) []mentionMatcher {
out := make([]mentionMatcher, 0, len(mentions))
for _, m := range mentions {
m = strings.TrimSpace(m)
if m == "" {
continue
}
if reWordlike.MatchString(m) {
out = append(out, mentionMatcher{re: regexp.MustCompile(`(?i)\b` + regexp.QuoteMeta(m) + `\b`)})
} else {
out = append(out, mentionMatcher{contains: m})
}
}
return out
}
func compileGaz(g []gazEntry) []compiledGaz {
out := make([]compiledGaz, len(g))
for i, e := range g {
out[i] = compiledGaz{canonical: e.canonical, matchers: compileMentions(e.mentions)}
}
return out
}
var (
skillMatchers []compiledGaz
certMatchers []compiledGaz
agencyMatchers []compiledGaz
)
func init() {
skillMatchers = compileGaz(skillGazetteer)
certMatchers = compileGaz(certGazetteer)
agencyMatchers = compileGaz(agencyGazetteer)
}
// detectFromGazetteer returns the canonical labels whose mentions appear in the lowercased text,
// deduped and sorted so the output is deterministic regardless of order of appearance.
func detectFromGazetteer(lower string, g []compiledGaz) []string {
var out []string
seen := map[string]bool{}
for _, e := range g {
for _, m := range e.matchers {
if m.match(lower) {
if !seen[e.canonical] {
seen[e.canonical] = true
out = append(out, e.canonical)
}
break
}
}
}
sort.Strings(out)
return out
}
// skillGazetteer maps common cleared IT and cyber skills to their mentions. Canonical labels are chosen
// to match the requirement skill ontology by name (the engine matches skills case insensitively by
// name), so an extracted skill scores against a requirement that lists the same skill.
var skillGazetteer = []gazEntry{
{"Python", []string{"python"}},
{"Java", []string{"java"}},
{"JavaScript", []string{"javascript", "typescript"}},
{"Go", []string{"golang"}},
{"C++", []string{"c++"}},
{"SQL", []string{"sql", "postgresql", "postgres", "mysql"}},
{"Linux", []string{"linux", "rhel", "red hat enterprise"}},
{"AWS", []string{"aws", "amazon web services"}},
{"Azure", []string{"azure"}},
{"Kubernetes", []string{"kubernetes", "k8s"}},
{"Docker", []string{"docker", "containerization"}},
{"Terraform", []string{"terraform"}},
{"Ansible", []string{"ansible"}},
{"Splunk", []string{"splunk"}},
{"SIEM", []string{"siem", "security information and event"}},
{"Incident Response", []string{"incident response", "incident handling"}},
{"Penetration Testing", []string{"penetration testing", "pen testing", "pentest"}},
{"Vulnerability Management", []string{"vulnerability management", "vulnerability assessment"}},
{"Network Security", []string{"network security", "firewall", "intrusion detection"}},
{"Cloud Security", []string{"cloud security"}},
{"DevSecOps", []string{"devsecops", "devops"}},
{"RMF", []string{"rmf", "risk management framework"}},
{"ATO", []string{"authority to operate", "ato"}},
{"NIST", []string{"nist 800", "nist sp 800"}},
{"Threat Intelligence", []string{"threat intelligence", "threat intel"}},
{"Active Directory", []string{"active directory"}},
{"VMware", []string{"vmware"}},
{"Machine Learning", []string{"machine learning", "deep learning"}},
{"Data Analysis", []string{"data analysis", "data analytics"}},
{"Cryptography", []string{"cryptography", "encryption"}},
{"Cybersecurity", []string{"cybersecurity", "cyber security"}},
{"Systems Engineering", []string{"systems engineering", "system engineering"}},
{"Software Engineering", []string{"software engineering", "software development"}},
{"Intelligence Analysis", []string{"intelligence analysis", "all source", "sigint", "geoint"}},
}
// certGazetteer maps common GovCon IT and cyber certifications to their mentions.
var certGazetteer = []gazEntry{
{"CISSP", []string{"cissp"}},
{"CISM", []string{"cism"}},
{"CISA", []string{"cisa"}},
{"CompTIA Security+", []string{"security+", "security plus", "comptia security"}},
{"CompTIA Network+", []string{"network+", "network plus"}},
{"CASP+", []string{"casp+", "comptia advanced security"}},
{"CEH", []string{"certified ethical hacker", "ceh certification"}},
{"CCNA", []string{"ccna"}},
{"CCNP", []string{"ccnp"}},
{"PMP", []string{"pmp", "project management professional"}},
{"ITIL", []string{"itil"}},
{"GSEC", []string{"gsec"}},
{"GCIH", []string{"gcih"}},
{"OSCP", []string{"oscp", "offensive security certified"}},
{"AWS Certified Solutions Architect", []string{"aws certified solutions architect", "aws solutions architect"}},
}
// agencyGazetteer maps federal customers to their mentions, weighted toward the cleared defense space.
var agencyGazetteer = []gazEntry{
{"Air Force", []string{"air force", "usaf"}},
{"Space Force", []string{"space force", "ussf"}},
{"Army", []string{"u.s. army", "united states army", "department of the army"}},
{"Navy", []string{"u.s. navy", "united states navy", "department of the navy"}},
{"Marine Corps", []string{"marine corps", "usmc"}},
{"DoD", []string{"department of defense", "dod", "d.o.d"}},
{"DISA", []string{"disa", "defense information systems agency"}},
{"NSA", []string{"national security agency", "nsa"}},
{"CIA", []string{"central intelligence agency"}},
{"DIA", []string{"defense intelligence agency"}},
{"NGA", []string{"national geospatial"}},
{"DHS", []string{"homeland security", "dhs"}},
{"FBI", []string{"federal bureau of investigation", "fbi"}},
{"DARPA", []string{"darpa"}},
{"CENTCOM", []string{"centcom", "central command"}},
{"SOCOM", []string{"socom", "special operations command"}},
{"INDOPACOM", []string{"indopacom", "pacom", "indo-pacific command"}},
}