This commit is contained in:
@@ -9,13 +9,15 @@ from .base import ExtractedJob, ExtractionResult, FieldEvidence
|
||||
|
||||
LABEL_PATTERNS = {
|
||||
"location": re.compile(r"^(locatie|location|lieu|plaats|standplaats)\s*:?$", re.I),
|
||||
"date_posted": re.compile(r"^(publicatiedatum|geplaatst|date posted|published)\s*:?$", re.I),
|
||||
"employment_type": re.compile(r"^(dienstverband|contract|employment type)\s*:?$", re.I),
|
||||
"employer": re.compile(r"^(werkgever|employer|company|organisatie|société)\s*:?$", re.I),
|
||||
}
|
||||
|
||||
|
||||
class GenericHtmlAdapter:
|
||||
parser_key = "generic-html"
|
||||
parser_version = "1.0.0"
|
||||
parser_version = "1.1.0"
|
||||
|
||||
@staticmethod
|
||||
def _meta(soup: BeautifulSoup, *names: str) -> str:
|
||||
@@ -59,6 +61,8 @@ class GenericHtmlAdapter:
|
||||
soup, LABEL_PATTERNS["employer"]
|
||||
)
|
||||
location = self._label_value(soup, LABEL_PATTERNS["location"])
|
||||
date_posted = self._label_value(soup, LABEL_PATTERNS["date_posted"])
|
||||
employment_type = self._label_value(soup, LABEL_PATTERNS["employment_type"])
|
||||
main = soup.find("main") or soup.find("article") or soup.body
|
||||
description_html = str(main) if main else ""
|
||||
description_text = (
|
||||
@@ -74,6 +78,12 @@ class GenericHtmlAdapter:
|
||||
FieldEvidence("location_text", "html-label", 0.62, location[:240]),
|
||||
FieldEvidence("description", "html-main", 0.70, description_text[:300]),
|
||||
]
|
||||
if date_posted:
|
||||
evidence.append(FieldEvidence("date_posted", "html-label", 0.62, date_posted[:40]))
|
||||
if employment_type:
|
||||
evidence.append(
|
||||
FieldEvidence("employment_types", "html-label", 0.62, employment_type[:120])
|
||||
)
|
||||
job = ExtractedJob(
|
||||
url=job_url,
|
||||
title=title,
|
||||
@@ -81,6 +91,8 @@ class GenericHtmlAdapter:
|
||||
location_text=location,
|
||||
description_html=description_html,
|
||||
description_text=description_text,
|
||||
date_posted=date_posted,
|
||||
employment_types=[employment_type] if employment_type else [],
|
||||
raw={"generic_html": True},
|
||||
evidence=evidence,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user