ATS SPACY
unknown
plain_text
2 years ago
3.4 kB
3
Indexable
Never
// ============ START OF SpaCy NER ============ /* var spacy = new Spacy(); var nlp = spacy.Load("en_core_web_lg"); var doc = nlp.GetDocument(pageFinalString); CandidateModel candidateModel = new CandidateModel(); ParsedResumeDeserializeModel model = new ParsedResumeDeserializeModel(); if (doc.Ents.Count > 0) { Console.WriteLine("====================== EN_CORE_WEB_LG (Large) ======================"); foreach (SpacyDotNet.Span ent in doc.Ents) { Console.WriteLine($"Text: {ent.Text}, Category: {ent.Label}, SubCategory: N/A, Confidence score: N/A"); switch (ent.Label.ToString()) { case "PERSON": model.Person.Add(ent.Text); break; case "GPE": model.Location.Add(ent.Text); break; case "ORG": if (ent.Text.Contains(".net") || ent.Text.Contains(".com") || ent.Text.Contains("http")) { model.WebAddress.Add(ent.Text); } else { model.Organization.Add(ent.Text); } break; case "PhoneNumber": model.Phone.Add(ent.Text); break; case "Email": model.EmailOrURL.Add(ent.Text); break; case "URL": model.WebAddress.Add(ent.Text); break; case "PersonType": model.PersonType.Add(ent.Text); break; default: break; } } // Create candidate profile with details candidateModel.FullNameAsPerNricPassport = model.Person.FirstOrDefault(); if (!string.IsNullOrEmpty(candidateModel.FullNameAsPerNricPassport)) { candidateModel.FirstName = candidateModel.FullNameAsPerNricPassport.Split(' ').FirstOrDefault(); candidateModel.LastName = candidateModel.FullNameAsPerNricPassport.Split(' ').LastOrDefault(); } candidateModel.Email = model.EmailOrURL.FirstOrDefault(); candidateModel.MobilePhone = model.Phone.FirstOrDefault(); candidateModel.StreetAddress = model.Location.FirstOrDefault(); candidateModel.WebAddress = string.Join("; ", model.WebAddress); } */ // ============ END OF SpaCy NER ============