File size: 1,120 Bytes
e84ab4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import re


def extract_salary(text):
    if not text:
        return None

    patterns = [
        r"Rp\s?[\d.,]+\s?(rb|ribu|juta|jt|miliar|m)?",
        r"\$\s?[\d.,]+\s?(k|m)?",
        r"IDR\s?[\d.,]+",
        r"[\d.,]+\s?(juta|jt|rb|ribu|miliar)\s?(per|/)?\s?(bulan|tahun|month|year)?",
    ]
    for pattern in patterns:
        match = re.search(pattern, text, re.IGNORECASE)
        if match:
            return match.group(0).strip()
    return None


def extract_job_type(text):
    if not text:
        return "Full-time"

    lowered = text.lower()
    if re.search(r"\bintern(ship)?\b", lowered):
        return "Internship"
    if re.search(r"\bpart[- ]?time\b", lowered):
        return "Part-time"
    if re.search(r"\bcontract\b|\bfreelance\b", lowered):
        return "Contract"
    return "Full-time"


def extract_contact(text):
    if not text:
        return None

    email = re.search(r"[\w.+-]+@[\w-]+\.[\w.-]+", text)
    if email:
        return email.group(0)

    phone = re.search(r"(?:\+62|0)\s?8[\d\s-]{8,12}", text)
    if phone:
        return phone.group(0).strip()

    return None