@whiteslove/parsing-lexicon 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whiteslove/parsing-lexicon",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Shared deterministic multilingual parsing lexicon for WhitesLove housing and hiring services",
5
5
  "repository": {
6
6
  "type": "git",
package/src/contact.js CHANGED
@@ -8,6 +8,7 @@ const PHONE_LIKE_RE = /\+?\d(?:[\t \u00a0().-]*\d){9,}/g;
8
8
  // only returned after libphonenumber validation.
9
9
  const PHONE_CANDIDATE_RE = /\+?\d(?:[\t \u00a0().-]*\d){6,}(?:[\t \u00a0]*(?:ext\.?|extension|x|доб\.?|дод\.?)\s*\d{1,6})?/giu;
10
10
  const PHONE_EXTENSION_RE = /[\t \u00a0]*(?:ext\.?|extension|x|доб\.?|дод\.?)\s*(\d{1,6})$/iu;
11
+ const DATE_LIKE_PHONE_RE = /^\d{1,2}[./-]\d{1,2}[./-](?:\d{2}|\d{4})(?:\s+\d{1,2})?$/u;
11
12
 
12
13
  const TELEGRAM_USERNAME_RE = /^[A-Za-z0-9_]{5,32}$/;
13
14
  const TELEGRAM_LINK_RE = /(?:https?:\/\/)?(?:t\.me|telegram\.me|telegram\.dog)\/([A-Za-z0-9_]{5,32})(?:\/[0-9]+)?(?:[/?#][^\s]*)?/giu;
@@ -97,6 +98,10 @@ export function parsePhoneNumbers(value, options = {}) {
97
98
 
98
99
  for (const match of text.matchAll(PHONE_CANDIDATE_RE)) {
99
100
  const raw = match[0].trim();
101
+ // Date stamps frequently contain enough digits to look phone-like before
102
+ // a following colon (for example "29.08.2026 10:15"). They are temporal
103
+ // evidence, never public contact details.
104
+ if (DATE_LIKE_PHONE_RE.test(raw)) continue;
100
105
  const { base, extension } = splitPhoneExtension(raw);
101
106
  const parsed = parsePhoneNumberFromString(base, countryHint);
102
107
  if (!parsed) continue;
@@ -1,4 +1,4 @@
1
- import { findPhoneLikeSpans, findTelegramContacts, parsePhoneNumbers } from './contact.js';
1
+ import { findTelegramContacts, parsePhoneNumbers } from './contact.js';
2
2
  import { countryPhoneHint } from './country-context.js';
3
3
 
4
4
  const EXPLICIT_FEMALE_RE = /(?:^|[^\p{L}])(?:женщина|женский|девушка|female|ayol)(?=$|[^\p{L}])/iu;
@@ -91,9 +91,13 @@ export function extractCandidateExperienceYears(value) {
91
91
  export function extractCandidateContacts(value, country = '') {
92
92
  const text = String(value || '');
93
93
  const countryHint = countryPhoneHint(country) || undefined;
94
+ // Candidate profiles must only publish normalized, country-aware phone
95
+ // evidence. A broad numeric mask is useful to protect housing money parsing,
96
+ // but it is deliberately permissive and can include dates or identifiers.
97
+ // Falling back to it here turns harmless activity timestamps into direct CV
98
+ // contacts and changes an otherwise platform-only profile's contact type.
94
99
  const parsedPhone = parsePhoneNumbers(text, { countryHint, includePossible: true })[0];
95
- const broadPhone = parsedPhone ? null : findPhoneLikeSpans(text)[0];
96
- const phone = parsedPhone?.number || broadPhone?.raw || undefined;
100
+ const phone = parsedPhone?.number || undefined;
97
101
  const email = text.match(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/iu)?.[0];
98
102
  const telegram = findTelegramContacts(text)[0]?.handle;
99
103
  return Object.freeze({ ...(phone ? { phone } : {}), ...(email ? { email } : {}), ...(telegram ? { telegram } : {}) });