Upload folder using huggingface_hub
Browse files- scripts/aacl/aacl.py +130 -0
- scripts/aacl/aacl2025.py +122 -0
- scripts/acl/acl.py +130 -0
- scripts/acl/acl2025.py +124 -0
- scripts/cl/cl.py +128 -0
- scripts/cl/cl2025.py +122 -0
- scripts/coling/coling.py +128 -0
- scripts/coling/coling2025.py +122 -0
- scripts/conll/conll.py +128 -0
- scripts/conll/conll2025.py +122 -0
- scripts/eacl/eacl.py +130 -0
- scripts/eacl/eacl2026.py +122 -0
- scripts/emnlp/emnlp.py +130 -0
- scripts/emnlp/emnlp2025.py +122 -0
- scripts/ijcnlp/ijcnlp.py +128 -0
- scripts/ijcnlp/ijcnlp2025.py +122 -0
- scripts/iwslt/iwslt.py +128 -0
- scripts/iwslt/iwslt2025.py +122 -0
- scripts/lrec/lrec.py +128 -0
- scripts/naacl/naacl.py +130 -0
- scripts/naacl/naacl2025.py +122 -0
- scripts/rocling/rocling.py +128 -0
- scripts/rocling/rocling2025.py +122 -0
- scripts/semeval/semeval.py +128 -0
- scripts/semeval/semeval2025.py +122 -0
- scripts/tacl/tacl.py +130 -0
- scripts/tacl/tacl2025.py +122 -0
- scripts/tacl/tacl2026.py +122 -0
- scripts/wmt/wmt.py +128 -0
- scripts/wmt/wmt2025.py +122 -0
scripts/aacl/aacl.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/aacl-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/aacl/aacl{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
# with open("acl.txt", "w") as f:
|
| 16 |
+
# f.write(resp.text)
|
| 17 |
+
return resp.text
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def abs_url(href):
|
| 21 |
+
if not href:
|
| 22 |
+
return ""
|
| 23 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def parse_papers(html):
|
| 27 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 28 |
+
papers = []
|
| 29 |
+
|
| 30 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 31 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 32 |
+
|
| 33 |
+
for paper_div in paper_divs:
|
| 34 |
+
paper = parse_paper_div(paper_div)
|
| 35 |
+
if paper:
|
| 36 |
+
papers.append(paper)
|
| 37 |
+
|
| 38 |
+
return papers
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def parse_paper_div(paper_div):
|
| 42 |
+
# Extract the paper title and URL
|
| 43 |
+
title_element = paper_div.find("strong")
|
| 44 |
+
if not title_element:
|
| 45 |
+
return None
|
| 46 |
+
|
| 47 |
+
title_link = title_element.find("a")
|
| 48 |
+
if not title_link:
|
| 49 |
+
return None
|
| 50 |
+
|
| 51 |
+
title = title_link.get_text(strip=False)
|
| 52 |
+
href = title_link.get("href", "")
|
| 53 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 54 |
+
url = abs_url(href)
|
| 55 |
+
|
| 56 |
+
# Skip if no paper_id found
|
| 57 |
+
if not paper_id:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
# PDF / BIB links from the button-row div
|
| 61 |
+
pdf_url = bib_url = ""
|
| 62 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 63 |
+
if btn_row:
|
| 64 |
+
for a in btn_row.find_all("a", href=True):
|
| 65 |
+
text = a.get_text(strip=True).lower()
|
| 66 |
+
h = a["href"]
|
| 67 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 68 |
+
pdf_url = abs_url(h)
|
| 69 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 70 |
+
bib_url = abs_url(h)
|
| 71 |
+
|
| 72 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 73 |
+
authors = []
|
| 74 |
+
span = paper_div.find("span", class_="d-block")
|
| 75 |
+
if span:
|
| 76 |
+
for a in span.find_all("a", href=True):
|
| 77 |
+
if "/people/" in a["href"]:
|
| 78 |
+
authors.append(a.get_text(strip=True))
|
| 79 |
+
|
| 80 |
+
# Abstract: look for the collapse div with abstract content
|
| 81 |
+
abstract = ""
|
| 82 |
+
# Find the abstract ID from the button
|
| 83 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 84 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 85 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 86 |
+
# Find the abstract div using this ID
|
| 87 |
+
abs_div = soup.find("div", id=abs_id)
|
| 88 |
+
if abs_div:
|
| 89 |
+
body = abs_div.find("div", class_="card-body")
|
| 90 |
+
if body:
|
| 91 |
+
abstract = body.get_text(strip=True)
|
| 92 |
+
|
| 93 |
+
# Determine volume from paper_id
|
| 94 |
+
volume = ""
|
| 95 |
+
if paper_id:
|
| 96 |
+
parts = paper_id.split(".")
|
| 97 |
+
if len(parts) >= 2:
|
| 98 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 99 |
+
|
| 100 |
+
return {
|
| 101 |
+
"paper_id": paper_id,
|
| 102 |
+
"title": title,
|
| 103 |
+
"authors": authors,
|
| 104 |
+
"abstract": abstract,
|
| 105 |
+
"url": url,
|
| 106 |
+
"pdf_url": pdf_url,
|
| 107 |
+
"bib_url": bib_url,
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def main():
|
| 112 |
+
for year in [20, 22, 23]:
|
| 113 |
+
year = f"20{year:02d}"
|
| 114 |
+
try:
|
| 115 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 116 |
+
print("Parsing ...", flush=True)
|
| 117 |
+
papers = parse_papers(html)
|
| 118 |
+
|
| 119 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 120 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 121 |
+
for p in papers:
|
| 122 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 123 |
+
|
| 124 |
+
print("Done")
|
| 125 |
+
except Exception as e:
|
| 126 |
+
print(f"Error: {e}")
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
main()
|
scripts/aacl/aacl2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/aacl-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/aacl/aacl2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/acl/acl.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/acl-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/acl/acl{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
# with open("acl.txt", "w") as f:
|
| 16 |
+
# f.write(resp.text)
|
| 17 |
+
return resp.text
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def abs_url(href):
|
| 21 |
+
if not href:
|
| 22 |
+
return ""
|
| 23 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def parse_papers(html):
|
| 27 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 28 |
+
papers = []
|
| 29 |
+
|
| 30 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 31 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 32 |
+
|
| 33 |
+
for paper_div in paper_divs:
|
| 34 |
+
paper = parse_paper_div(paper_div)
|
| 35 |
+
if paper:
|
| 36 |
+
papers.append(paper)
|
| 37 |
+
|
| 38 |
+
return papers
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def parse_paper_div(paper_div):
|
| 42 |
+
# Extract the paper title and URL
|
| 43 |
+
title_element = paper_div.find("strong")
|
| 44 |
+
if not title_element:
|
| 45 |
+
return None
|
| 46 |
+
|
| 47 |
+
title_link = title_element.find("a")
|
| 48 |
+
if not title_link:
|
| 49 |
+
return None
|
| 50 |
+
|
| 51 |
+
title = title_link.get_text(strip=False)
|
| 52 |
+
href = title_link.get("href", "")
|
| 53 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 54 |
+
url = abs_url(href)
|
| 55 |
+
|
| 56 |
+
# Skip if no paper_id found
|
| 57 |
+
if not paper_id:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
# PDF / BIB links from the button-row div
|
| 61 |
+
pdf_url = bib_url = ""
|
| 62 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 63 |
+
if btn_row:
|
| 64 |
+
for a in btn_row.find_all("a", href=True):
|
| 65 |
+
text = a.get_text(strip=True).lower()
|
| 66 |
+
h = a["href"]
|
| 67 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 68 |
+
pdf_url = abs_url(h)
|
| 69 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 70 |
+
bib_url = abs_url(h)
|
| 71 |
+
|
| 72 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 73 |
+
authors = []
|
| 74 |
+
span = paper_div.find("span", class_="d-block")
|
| 75 |
+
if span:
|
| 76 |
+
for a in span.find_all("a", href=True):
|
| 77 |
+
if "/people/" in a["href"]:
|
| 78 |
+
authors.append(a.get_text(strip=True))
|
| 79 |
+
|
| 80 |
+
# Abstract: look for the collapse div with abstract content
|
| 81 |
+
abstract = ""
|
| 82 |
+
# Find the abstract ID from the button
|
| 83 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 84 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 85 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 86 |
+
# Find the abstract div using this ID
|
| 87 |
+
abs_div = soup.find("div", id=abs_id)
|
| 88 |
+
if abs_div:
|
| 89 |
+
body = abs_div.find("div", class_="card-body")
|
| 90 |
+
if body:
|
| 91 |
+
abstract = body.get_text(strip=True)
|
| 92 |
+
|
| 93 |
+
# Determine volume from paper_id
|
| 94 |
+
volume = ""
|
| 95 |
+
if paper_id:
|
| 96 |
+
parts = paper_id.split(".")
|
| 97 |
+
if len(parts) >= 2:
|
| 98 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 99 |
+
|
| 100 |
+
return {
|
| 101 |
+
"paper_id": paper_id,
|
| 102 |
+
"title": title,
|
| 103 |
+
"authors": authors,
|
| 104 |
+
"abstract": abstract,
|
| 105 |
+
"url": url,
|
| 106 |
+
"pdf_url": pdf_url,
|
| 107 |
+
"bib_url": bib_url,
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def main():
|
| 112 |
+
for year in range(25):
|
| 113 |
+
year = f"20{year:02d}"
|
| 114 |
+
try:
|
| 115 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 116 |
+
print("Parsing ...", flush=True)
|
| 117 |
+
papers = parse_papers(html)
|
| 118 |
+
|
| 119 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 120 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 121 |
+
for p in papers:
|
| 122 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 123 |
+
|
| 124 |
+
print("Done")
|
| 125 |
+
except Exception as e:
|
| 126 |
+
print(f"Error: {e}")
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
main()
|
scripts/acl/acl2025.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/acl-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/acl/acl2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
with open("acl.txt", "w") as f:
|
| 16 |
+
f.write(resp.text)
|
| 17 |
+
return resp.text
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def abs_url(href):
|
| 21 |
+
if not href:
|
| 22 |
+
return ""
|
| 23 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def parse_papers(html):
|
| 27 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 28 |
+
papers = []
|
| 29 |
+
|
| 30 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 31 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 32 |
+
|
| 33 |
+
for vol_div in volume_divs:
|
| 34 |
+
volume_id = vol_div.get("id", "")
|
| 35 |
+
|
| 36 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 37 |
+
h4 = vol_div.find("h4")
|
| 38 |
+
if h4:
|
| 39 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 40 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 41 |
+
else:
|
| 42 |
+
volume_name = volume_id
|
| 43 |
+
|
| 44 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 45 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 46 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 47 |
+
if paper:
|
| 48 |
+
papers.append(paper)
|
| 49 |
+
|
| 50 |
+
return papers
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def parse_card(card, volume_id, volume_name):
|
| 54 |
+
# Title
|
| 55 |
+
strong = card.find("strong")
|
| 56 |
+
if not strong:
|
| 57 |
+
return None
|
| 58 |
+
title_link = strong.find("a")
|
| 59 |
+
if not title_link:
|
| 60 |
+
return None
|
| 61 |
+
|
| 62 |
+
title = title_link.get_text(strip=False)
|
| 63 |
+
href = title_link.get("href", "")
|
| 64 |
+
paper_id = href.strip("/")
|
| 65 |
+
url = abs_url(href)
|
| 66 |
+
|
| 67 |
+
# Skip front-matter entries (end with ".0")
|
| 68 |
+
if paper_id.endswith(".0"):
|
| 69 |
+
return None
|
| 70 |
+
|
| 71 |
+
# PDF / BIB from the button-row div
|
| 72 |
+
pdf_url = bib_url = ""
|
| 73 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 74 |
+
if btn_row:
|
| 75 |
+
for a in btn_row.find_all("a", href=True):
|
| 76 |
+
text = a.get_text(strip=True).lower()
|
| 77 |
+
h = a["href"]
|
| 78 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 79 |
+
pdf_url = abs_url(h)
|
| 80 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 81 |
+
bib_url = abs_url(h)
|
| 82 |
+
|
| 83 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 84 |
+
authors = []
|
| 85 |
+
span = card.find("span", class_="d-block")
|
| 86 |
+
if span:
|
| 87 |
+
for a in span.find_all("a", href=True):
|
| 88 |
+
if "/people/" in a["href"]:
|
| 89 |
+
authors.append(a.get_text(strip=True))
|
| 90 |
+
|
| 91 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 92 |
+
abstract = ""
|
| 93 |
+
nxt = card.find_next_sibling()
|
| 94 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 95 |
+
body = nxt.find("div", class_="card-body")
|
| 96 |
+
if body:
|
| 97 |
+
abstract = body.get_text(strip=True)
|
| 98 |
+
|
| 99 |
+
return {
|
| 100 |
+
"paper_id": paper_id,
|
| 101 |
+
"title": title,
|
| 102 |
+
"authors": authors,
|
| 103 |
+
"abstract": abstract,
|
| 104 |
+
"url": url,
|
| 105 |
+
"pdf_url": pdf_url,
|
| 106 |
+
"bib_url": bib_url,
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def main():
|
| 111 |
+
html = fetch_page(SOURCE_URL)
|
| 112 |
+
print("Parsing ...", flush=True)
|
| 113 |
+
papers = parse_papers(html)
|
| 114 |
+
|
| 115 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 116 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 117 |
+
for p in papers:
|
| 118 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 119 |
+
|
| 120 |
+
print("Done")
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
if __name__ == "__main__":
|
| 124 |
+
main()
|
scripts/cl/cl.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/cl-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/cl/cl{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 29 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 30 |
+
|
| 31 |
+
for paper_div in paper_divs:
|
| 32 |
+
paper = parse_paper_div(paper_div)
|
| 33 |
+
if paper:
|
| 34 |
+
papers.append(paper)
|
| 35 |
+
|
| 36 |
+
return papers
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_paper_div(paper_div):
|
| 40 |
+
# Extract the paper title and URL
|
| 41 |
+
title_element = paper_div.find("strong")
|
| 42 |
+
if not title_element:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
title_link = title_element.find("a")
|
| 46 |
+
if not title_link:
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
title = title_link.get_text(strip=False)
|
| 50 |
+
href = title_link.get("href", "")
|
| 51 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 52 |
+
url = abs_url(href)
|
| 53 |
+
|
| 54 |
+
# Skip if no paper_id found
|
| 55 |
+
if not paper_id:
|
| 56 |
+
return None
|
| 57 |
+
|
| 58 |
+
# PDF / BIB links from the button-row div
|
| 59 |
+
pdf_url = bib_url = ""
|
| 60 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 61 |
+
if btn_row:
|
| 62 |
+
for a in btn_row.find_all("a", href=True):
|
| 63 |
+
text = a.get_text(strip=True).lower()
|
| 64 |
+
h = a["href"]
|
| 65 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 66 |
+
pdf_url = abs_url(h)
|
| 67 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 68 |
+
bib_url = abs_url(h)
|
| 69 |
+
|
| 70 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 71 |
+
authors = []
|
| 72 |
+
span = paper_div.find("span", class_="d-block")
|
| 73 |
+
if span:
|
| 74 |
+
for a in span.find_all("a", href=True):
|
| 75 |
+
if "/people/" in a["href"]:
|
| 76 |
+
authors.append(a.get_text(strip=True))
|
| 77 |
+
|
| 78 |
+
# Abstract: look for the collapse div with abstract content
|
| 79 |
+
abstract = ""
|
| 80 |
+
# Find the abstract ID from the button
|
| 81 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 82 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 83 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 84 |
+
# Find the abstract div using this ID
|
| 85 |
+
abs_div = soup.find("div", id=abs_id)
|
| 86 |
+
if abs_div:
|
| 87 |
+
body = abs_div.find("div", class_="card-body")
|
| 88 |
+
if body:
|
| 89 |
+
abstract = body.get_text(strip=True)
|
| 90 |
+
|
| 91 |
+
# Determine volume from paper_id
|
| 92 |
+
volume = ""
|
| 93 |
+
if paper_id:
|
| 94 |
+
parts = paper_id.split(".")
|
| 95 |
+
if len(parts) >= 2:
|
| 96 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 97 |
+
|
| 98 |
+
return {
|
| 99 |
+
"paper_id": paper_id,
|
| 100 |
+
"title": title,
|
| 101 |
+
"authors": authors,
|
| 102 |
+
"abstract": abstract,
|
| 103 |
+
"url": url,
|
| 104 |
+
"pdf_url": pdf_url,
|
| 105 |
+
"bib_url": bib_url,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main():
|
| 110 |
+
for year in range(25):
|
| 111 |
+
year = f"20{year:02d}"
|
| 112 |
+
try:
|
| 113 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 114 |
+
print("Parsing ...", flush=True)
|
| 115 |
+
papers = parse_papers(html)
|
| 116 |
+
|
| 117 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 118 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 119 |
+
for p in papers:
|
| 120 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 121 |
+
|
| 122 |
+
print("Done")
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"Error: {e}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
main()
|
scripts/cl/cl2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/cl-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/cl/cl2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/coling/coling.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/coling-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/coling/coling{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 29 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 30 |
+
|
| 31 |
+
for paper_div in paper_divs:
|
| 32 |
+
paper = parse_paper_div(paper_div)
|
| 33 |
+
if paper:
|
| 34 |
+
papers.append(paper)
|
| 35 |
+
|
| 36 |
+
return papers
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_paper_div(paper_div):
|
| 40 |
+
# Extract the paper title and URL
|
| 41 |
+
title_element = paper_div.find("strong")
|
| 42 |
+
if not title_element:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
title_link = title_element.find("a")
|
| 46 |
+
if not title_link:
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
title = title_link.get_text(strip=False)
|
| 50 |
+
href = title_link.get("href", "")
|
| 51 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 52 |
+
url = abs_url(href)
|
| 53 |
+
|
| 54 |
+
# Skip if no paper_id found
|
| 55 |
+
if not paper_id:
|
| 56 |
+
return None
|
| 57 |
+
|
| 58 |
+
# PDF / BIB links from the button-row div
|
| 59 |
+
pdf_url = bib_url = ""
|
| 60 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 61 |
+
if btn_row:
|
| 62 |
+
for a in btn_row.find_all("a", href=True):
|
| 63 |
+
text = a.get_text(strip=True).lower()
|
| 64 |
+
h = a["href"]
|
| 65 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 66 |
+
pdf_url = abs_url(h)
|
| 67 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 68 |
+
bib_url = abs_url(h)
|
| 69 |
+
|
| 70 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 71 |
+
authors = []
|
| 72 |
+
span = paper_div.find("span", class_="d-block")
|
| 73 |
+
if span:
|
| 74 |
+
for a in span.find_all("a", href=True):
|
| 75 |
+
if "/people/" in a["href"]:
|
| 76 |
+
authors.append(a.get_text(strip=True))
|
| 77 |
+
|
| 78 |
+
# Abstract: look for the collapse div with abstract content
|
| 79 |
+
abstract = ""
|
| 80 |
+
# Find the abstract ID from the button
|
| 81 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 82 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 83 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 84 |
+
# Find the abstract div using this ID
|
| 85 |
+
abs_div = soup.find("div", id=abs_id)
|
| 86 |
+
if abs_div:
|
| 87 |
+
body = abs_div.find("div", class_="card-body")
|
| 88 |
+
if body:
|
| 89 |
+
abstract = body.get_text(strip=True)
|
| 90 |
+
|
| 91 |
+
# Determine volume from paper_id
|
| 92 |
+
volume = ""
|
| 93 |
+
if paper_id:
|
| 94 |
+
parts = paper_id.split(".")
|
| 95 |
+
if len(parts) >= 2:
|
| 96 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 97 |
+
|
| 98 |
+
return {
|
| 99 |
+
"paper_id": paper_id,
|
| 100 |
+
"title": title,
|
| 101 |
+
"authors": authors,
|
| 102 |
+
"abstract": abstract,
|
| 103 |
+
"url": url,
|
| 104 |
+
"pdf_url": pdf_url,
|
| 105 |
+
"bib_url": bib_url,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main():
|
| 110 |
+
for year in range(0, 25, 2):
|
| 111 |
+
year = f"20{year:02d}"
|
| 112 |
+
try:
|
| 113 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 114 |
+
print("Parsing ...", flush=True)
|
| 115 |
+
papers = parse_papers(html)
|
| 116 |
+
|
| 117 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 118 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 119 |
+
for p in papers:
|
| 120 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 121 |
+
|
| 122 |
+
print("Done")
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"Error: {e}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
main()
|
scripts/coling/coling2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/coling-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/coling/coling2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/conll/conll.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/conll-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/conll/conll{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 29 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 30 |
+
|
| 31 |
+
for paper_div in paper_divs:
|
| 32 |
+
paper = parse_paper_div(paper_div)
|
| 33 |
+
if paper:
|
| 34 |
+
papers.append(paper)
|
| 35 |
+
|
| 36 |
+
return papers
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_paper_div(paper_div):
|
| 40 |
+
# Extract the paper title and URL
|
| 41 |
+
title_element = paper_div.find("strong")
|
| 42 |
+
if not title_element:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
title_link = title_element.find("a")
|
| 46 |
+
if not title_link:
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
title = title_link.get_text(strip=False)
|
| 50 |
+
href = title_link.get("href", "")
|
| 51 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 52 |
+
url = abs_url(href)
|
| 53 |
+
|
| 54 |
+
# Skip if no paper_id found
|
| 55 |
+
if not paper_id:
|
| 56 |
+
return None
|
| 57 |
+
|
| 58 |
+
# PDF / BIB links from the button-row div
|
| 59 |
+
pdf_url = bib_url = ""
|
| 60 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 61 |
+
if btn_row:
|
| 62 |
+
for a in btn_row.find_all("a", href=True):
|
| 63 |
+
text = a.get_text(strip=True).lower()
|
| 64 |
+
h = a["href"]
|
| 65 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 66 |
+
pdf_url = abs_url(h)
|
| 67 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 68 |
+
bib_url = abs_url(h)
|
| 69 |
+
|
| 70 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 71 |
+
authors = []
|
| 72 |
+
span = paper_div.find("span", class_="d-block")
|
| 73 |
+
if span:
|
| 74 |
+
for a in span.find_all("a", href=True):
|
| 75 |
+
if "/people/" in a["href"]:
|
| 76 |
+
authors.append(a.get_text(strip=True))
|
| 77 |
+
|
| 78 |
+
# Abstract: look for the collapse div with abstract content
|
| 79 |
+
abstract = ""
|
| 80 |
+
# Find the abstract ID from the button
|
| 81 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 82 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 83 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 84 |
+
# Find the abstract div using this ID
|
| 85 |
+
abs_div = soup.find("div", id=abs_id)
|
| 86 |
+
if abs_div:
|
| 87 |
+
body = abs_div.find("div", class_="card-body")
|
| 88 |
+
if body:
|
| 89 |
+
abstract = body.get_text(strip=True)
|
| 90 |
+
|
| 91 |
+
# Determine volume from paper_id
|
| 92 |
+
volume = ""
|
| 93 |
+
if paper_id:
|
| 94 |
+
parts = paper_id.split(".")
|
| 95 |
+
if len(parts) >= 2:
|
| 96 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 97 |
+
|
| 98 |
+
return {
|
| 99 |
+
"paper_id": paper_id,
|
| 100 |
+
"title": title,
|
| 101 |
+
"authors": authors,
|
| 102 |
+
"abstract": abstract,
|
| 103 |
+
"url": url,
|
| 104 |
+
"pdf_url": pdf_url,
|
| 105 |
+
"bib_url": bib_url,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main():
|
| 110 |
+
for year in range(25):
|
| 111 |
+
year = f"20{year:02d}"
|
| 112 |
+
try:
|
| 113 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 114 |
+
print("Parsing ...", flush=True)
|
| 115 |
+
papers = parse_papers(html)
|
| 116 |
+
|
| 117 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 118 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 119 |
+
for p in papers:
|
| 120 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 121 |
+
|
| 122 |
+
print("Done")
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"Error: {e}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
main()
|
scripts/conll/conll2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/conll-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/conll/conll2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/eacl/eacl.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/eacl-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/eacl/eacl{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
# with open("acl.txt", "w") as f:
|
| 16 |
+
# f.write(resp.text)
|
| 17 |
+
return resp.text
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def abs_url(href):
|
| 21 |
+
if not href:
|
| 22 |
+
return ""
|
| 23 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def parse_papers(html):
|
| 27 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 28 |
+
papers = []
|
| 29 |
+
|
| 30 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 31 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 32 |
+
|
| 33 |
+
for paper_div in paper_divs:
|
| 34 |
+
paper = parse_paper_div(paper_div)
|
| 35 |
+
if paper:
|
| 36 |
+
papers.append(paper)
|
| 37 |
+
|
| 38 |
+
return papers
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def parse_paper_div(paper_div):
|
| 42 |
+
# Extract the paper title and URL
|
| 43 |
+
title_element = paper_div.find("strong")
|
| 44 |
+
if not title_element:
|
| 45 |
+
return None
|
| 46 |
+
|
| 47 |
+
title_link = title_element.find("a")
|
| 48 |
+
if not title_link:
|
| 49 |
+
return None
|
| 50 |
+
|
| 51 |
+
title = title_link.get_text(strip=False)
|
| 52 |
+
href = title_link.get("href", "")
|
| 53 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 54 |
+
url = abs_url(href)
|
| 55 |
+
|
| 56 |
+
# Skip if no paper_id found
|
| 57 |
+
if not paper_id:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
# PDF / BIB links from the button-row div
|
| 61 |
+
pdf_url = bib_url = ""
|
| 62 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 63 |
+
if btn_row:
|
| 64 |
+
for a in btn_row.find_all("a", href=True):
|
| 65 |
+
text = a.get_text(strip=True).lower()
|
| 66 |
+
h = a["href"]
|
| 67 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 68 |
+
pdf_url = abs_url(h)
|
| 69 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 70 |
+
bib_url = abs_url(h)
|
| 71 |
+
|
| 72 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 73 |
+
authors = []
|
| 74 |
+
span = paper_div.find("span", class_="d-block")
|
| 75 |
+
if span:
|
| 76 |
+
for a in span.find_all("a", href=True):
|
| 77 |
+
if "/people/" in a["href"]:
|
| 78 |
+
authors.append(a.get_text(strip=True))
|
| 79 |
+
|
| 80 |
+
# Abstract: look for the collapse div with abstract content
|
| 81 |
+
abstract = ""
|
| 82 |
+
# Find the abstract ID from the button
|
| 83 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 84 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 85 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 86 |
+
# Find the abstract div using this ID
|
| 87 |
+
abs_div = soup.find("div", id=abs_id)
|
| 88 |
+
if abs_div:
|
| 89 |
+
body = abs_div.find("div", class_="card-body")
|
| 90 |
+
if body:
|
| 91 |
+
abstract = body.get_text(strip=True)
|
| 92 |
+
|
| 93 |
+
# Determine volume from paper_id
|
| 94 |
+
volume = ""
|
| 95 |
+
if paper_id:
|
| 96 |
+
parts = paper_id.split(".")
|
| 97 |
+
if len(parts) >= 2:
|
| 98 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 99 |
+
|
| 100 |
+
return {
|
| 101 |
+
"paper_id": paper_id,
|
| 102 |
+
"title": title,
|
| 103 |
+
"authors": authors,
|
| 104 |
+
"abstract": abstract,
|
| 105 |
+
"url": url,
|
| 106 |
+
"pdf_url": pdf_url,
|
| 107 |
+
"bib_url": bib_url,
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def main():
|
| 112 |
+
for year in [24, 23, 21, 17, 14, 12, 9, 6, 3]:
|
| 113 |
+
year = f"20{year:02d}"
|
| 114 |
+
try:
|
| 115 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 116 |
+
print("Parsing ...", flush=True)
|
| 117 |
+
papers = parse_papers(html)
|
| 118 |
+
|
| 119 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 120 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 121 |
+
for p in papers:
|
| 122 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 123 |
+
|
| 124 |
+
print("Done")
|
| 125 |
+
except Exception as e:
|
| 126 |
+
print(f"Error: {e}")
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
main()
|
scripts/eacl/eacl2026.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/eacl-2026/"
|
| 6 |
+
OUTPUT_FILE = "data/eacl/eacl2026_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2026"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/emnlp/emnlp.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/emnlp-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/emnlp/emnlp{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
# with open("acl.txt", "w") as f:
|
| 16 |
+
# f.write(resp.text)
|
| 17 |
+
return resp.text
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def abs_url(href):
|
| 21 |
+
if not href:
|
| 22 |
+
return ""
|
| 23 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def parse_papers(html):
|
| 27 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 28 |
+
papers = []
|
| 29 |
+
|
| 30 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 31 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 32 |
+
|
| 33 |
+
for paper_div in paper_divs:
|
| 34 |
+
paper = parse_paper_div(paper_div)
|
| 35 |
+
if paper:
|
| 36 |
+
papers.append(paper)
|
| 37 |
+
|
| 38 |
+
return papers
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def parse_paper_div(paper_div):
|
| 42 |
+
# Extract the paper title and URL
|
| 43 |
+
title_element = paper_div.find("strong")
|
| 44 |
+
if not title_element:
|
| 45 |
+
return None
|
| 46 |
+
|
| 47 |
+
title_link = title_element.find("a")
|
| 48 |
+
if not title_link:
|
| 49 |
+
return None
|
| 50 |
+
|
| 51 |
+
title = title_link.get_text(strip=False)
|
| 52 |
+
href = title_link.get("href", "")
|
| 53 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 54 |
+
url = abs_url(href)
|
| 55 |
+
|
| 56 |
+
# Skip if no paper_id found
|
| 57 |
+
if not paper_id:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
# PDF / BIB links from the button-row div
|
| 61 |
+
pdf_url = bib_url = ""
|
| 62 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 63 |
+
if btn_row:
|
| 64 |
+
for a in btn_row.find_all("a", href=True):
|
| 65 |
+
text = a.get_text(strip=True).lower()
|
| 66 |
+
h = a["href"]
|
| 67 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 68 |
+
pdf_url = abs_url(h)
|
| 69 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 70 |
+
bib_url = abs_url(h)
|
| 71 |
+
|
| 72 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 73 |
+
authors = []
|
| 74 |
+
span = paper_div.find("span", class_="d-block")
|
| 75 |
+
if span:
|
| 76 |
+
for a in span.find_all("a", href=True):
|
| 77 |
+
if "/people/" in a["href"]:
|
| 78 |
+
authors.append(a.get_text(strip=True))
|
| 79 |
+
|
| 80 |
+
# Abstract: look for the collapse div with abstract content
|
| 81 |
+
abstract = ""
|
| 82 |
+
# Find the abstract ID from the button
|
| 83 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 84 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 85 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 86 |
+
# Find the abstract div using this ID
|
| 87 |
+
abs_div = soup.find("div", id=abs_id)
|
| 88 |
+
if abs_div:
|
| 89 |
+
body = abs_div.find("div", class_="card-body")
|
| 90 |
+
if body:
|
| 91 |
+
abstract = body.get_text(strip=True)
|
| 92 |
+
|
| 93 |
+
# Determine volume from paper_id
|
| 94 |
+
volume = ""
|
| 95 |
+
if paper_id:
|
| 96 |
+
parts = paper_id.split(".")
|
| 97 |
+
if len(parts) >= 2:
|
| 98 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 99 |
+
|
| 100 |
+
return {
|
| 101 |
+
"paper_id": paper_id,
|
| 102 |
+
"title": title,
|
| 103 |
+
"authors": authors,
|
| 104 |
+
"abstract": abstract,
|
| 105 |
+
"url": url,
|
| 106 |
+
"pdf_url": pdf_url,
|
| 107 |
+
"bib_url": bib_url,
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def main():
|
| 112 |
+
for year in range(25):
|
| 113 |
+
year = f"20{year:02d}"
|
| 114 |
+
try:
|
| 115 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 116 |
+
print("Parsing ...", flush=True)
|
| 117 |
+
papers = parse_papers(html)
|
| 118 |
+
|
| 119 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 120 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 121 |
+
for p in papers:
|
| 122 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 123 |
+
|
| 124 |
+
print("Done")
|
| 125 |
+
except Exception as e:
|
| 126 |
+
print(f"Error: {e}")
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
main()
|
scripts/emnlp/emnlp2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/emnlp-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/emnlp/emnlp2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/ijcnlp/ijcnlp.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/ijcnlp-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/ijcnlp/ijcnlp{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 29 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 30 |
+
|
| 31 |
+
for paper_div in paper_divs:
|
| 32 |
+
paper = parse_paper_div(paper_div)
|
| 33 |
+
if paper:
|
| 34 |
+
papers.append(paper)
|
| 35 |
+
|
| 36 |
+
return papers
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_paper_div(paper_div):
|
| 40 |
+
# Extract the paper title and URL
|
| 41 |
+
title_element = paper_div.find("strong")
|
| 42 |
+
if not title_element:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
title_link = title_element.find("a")
|
| 46 |
+
if not title_link:
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
title = title_link.get_text(strip=False)
|
| 50 |
+
href = title_link.get("href", "")
|
| 51 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 52 |
+
url = abs_url(href)
|
| 53 |
+
|
| 54 |
+
# Skip if no paper_id found
|
| 55 |
+
if not paper_id:
|
| 56 |
+
return None
|
| 57 |
+
|
| 58 |
+
# PDF / BIB links from the button-row div
|
| 59 |
+
pdf_url = bib_url = ""
|
| 60 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 61 |
+
if btn_row:
|
| 62 |
+
for a in btn_row.find_all("a", href=True):
|
| 63 |
+
text = a.get_text(strip=True).lower()
|
| 64 |
+
h = a["href"]
|
| 65 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 66 |
+
pdf_url = abs_url(h)
|
| 67 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 68 |
+
bib_url = abs_url(h)
|
| 69 |
+
|
| 70 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 71 |
+
authors = []
|
| 72 |
+
span = paper_div.find("span", class_="d-block")
|
| 73 |
+
if span:
|
| 74 |
+
for a in span.find_all("a", href=True):
|
| 75 |
+
if "/people/" in a["href"]:
|
| 76 |
+
authors.append(a.get_text(strip=True))
|
| 77 |
+
|
| 78 |
+
# Abstract: look for the collapse div with abstract content
|
| 79 |
+
abstract = ""
|
| 80 |
+
# Find the abstract ID from the button
|
| 81 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 82 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 83 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 84 |
+
# Find the abstract div using this ID
|
| 85 |
+
abs_div = soup.find("div", id=abs_id)
|
| 86 |
+
if abs_div:
|
| 87 |
+
body = abs_div.find("div", class_="card-body")
|
| 88 |
+
if body:
|
| 89 |
+
abstract = body.get_text(strip=True)
|
| 90 |
+
|
| 91 |
+
# Determine volume from paper_id
|
| 92 |
+
volume = ""
|
| 93 |
+
if paper_id:
|
| 94 |
+
parts = paper_id.split(".")
|
| 95 |
+
if len(parts) >= 2:
|
| 96 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 97 |
+
|
| 98 |
+
return {
|
| 99 |
+
"paper_id": paper_id,
|
| 100 |
+
"title": title,
|
| 101 |
+
"authors": authors,
|
| 102 |
+
"abstract": abstract,
|
| 103 |
+
"url": url,
|
| 104 |
+
"pdf_url": pdf_url,
|
| 105 |
+
"bib_url": bib_url,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main():
|
| 110 |
+
for year in [23, 22, 21, 19, 17, 15, 13, 11, 9, 8, 5]:
|
| 111 |
+
year = f"20{year:02d}"
|
| 112 |
+
try:
|
| 113 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 114 |
+
print("Parsing ...", flush=True)
|
| 115 |
+
papers = parse_papers(html)
|
| 116 |
+
|
| 117 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 118 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 119 |
+
for p in papers:
|
| 120 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 121 |
+
|
| 122 |
+
print("Done")
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"Error: {e}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
main()
|
scripts/ijcnlp/ijcnlp2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/ijcnlp-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/ijcnlp/ijcnlp2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/iwslt/iwslt.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/iwslt-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/iwslt/iwslt{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 29 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 30 |
+
|
| 31 |
+
for paper_div in paper_divs:
|
| 32 |
+
paper = parse_paper_div(paper_div)
|
| 33 |
+
if paper:
|
| 34 |
+
papers.append(paper)
|
| 35 |
+
|
| 36 |
+
return papers
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_paper_div(paper_div):
|
| 40 |
+
# Extract the paper title and URL
|
| 41 |
+
title_element = paper_div.find("strong")
|
| 42 |
+
if not title_element:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
title_link = title_element.find("a")
|
| 46 |
+
if not title_link:
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
title = title_link.get_text(strip=False)
|
| 50 |
+
href = title_link.get("href", "")
|
| 51 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 52 |
+
url = abs_url(href)
|
| 53 |
+
|
| 54 |
+
# Skip if no paper_id found
|
| 55 |
+
if not paper_id:
|
| 56 |
+
return None
|
| 57 |
+
|
| 58 |
+
# PDF / BIB links from the button-row div
|
| 59 |
+
pdf_url = bib_url = ""
|
| 60 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 61 |
+
if btn_row:
|
| 62 |
+
for a in btn_row.find_all("a", href=True):
|
| 63 |
+
text = a.get_text(strip=True).lower()
|
| 64 |
+
h = a["href"]
|
| 65 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 66 |
+
pdf_url = abs_url(h)
|
| 67 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 68 |
+
bib_url = abs_url(h)
|
| 69 |
+
|
| 70 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 71 |
+
authors = []
|
| 72 |
+
span = paper_div.find("span", class_="d-block")
|
| 73 |
+
if span:
|
| 74 |
+
for a in span.find_all("a", href=True):
|
| 75 |
+
if "/people/" in a["href"]:
|
| 76 |
+
authors.append(a.get_text(strip=True))
|
| 77 |
+
|
| 78 |
+
# Abstract: look for the collapse div with abstract content
|
| 79 |
+
abstract = ""
|
| 80 |
+
# Find the abstract ID from the button
|
| 81 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 82 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 83 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 84 |
+
# Find the abstract div using this ID
|
| 85 |
+
abs_div = soup.find("div", id=abs_id)
|
| 86 |
+
if abs_div:
|
| 87 |
+
body = abs_div.find("div", class_="card-body")
|
| 88 |
+
if body:
|
| 89 |
+
abstract = body.get_text(strip=True)
|
| 90 |
+
|
| 91 |
+
# Determine volume from paper_id
|
| 92 |
+
volume = ""
|
| 93 |
+
if paper_id:
|
| 94 |
+
parts = paper_id.split(".")
|
| 95 |
+
if len(parts) >= 2:
|
| 96 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 97 |
+
|
| 98 |
+
return {
|
| 99 |
+
"paper_id": paper_id,
|
| 100 |
+
"title": title,
|
| 101 |
+
"authors": authors,
|
| 102 |
+
"abstract": abstract,
|
| 103 |
+
"url": url,
|
| 104 |
+
"pdf_url": pdf_url,
|
| 105 |
+
"bib_url": bib_url,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main():
|
| 110 |
+
for year in range(4, 25):
|
| 111 |
+
year = f"20{year:02d}"
|
| 112 |
+
try:
|
| 113 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 114 |
+
print("Parsing ...", flush=True)
|
| 115 |
+
papers = parse_papers(html)
|
| 116 |
+
|
| 117 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 118 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 119 |
+
for p in papers:
|
| 120 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 121 |
+
|
| 122 |
+
print("Done")
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"Error: {e}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
main()
|
scripts/iwslt/iwslt2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/iwslt-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/iwslt/iwslt2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/lrec/lrec.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/lrec-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/lrec/lrec{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 29 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 30 |
+
|
| 31 |
+
for paper_div in paper_divs:
|
| 32 |
+
paper = parse_paper_div(paper_div)
|
| 33 |
+
if paper:
|
| 34 |
+
papers.append(paper)
|
| 35 |
+
|
| 36 |
+
return papers
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_paper_div(paper_div):
|
| 40 |
+
# Extract the paper title and URL
|
| 41 |
+
title_element = paper_div.find("strong")
|
| 42 |
+
if not title_element:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
title_link = title_element.find("a")
|
| 46 |
+
if not title_link:
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
title = title_link.get_text(strip=False)
|
| 50 |
+
href = title_link.get("href", "")
|
| 51 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 52 |
+
url = abs_url(href)
|
| 53 |
+
|
| 54 |
+
# Skip if no paper_id found
|
| 55 |
+
if not paper_id:
|
| 56 |
+
return None
|
| 57 |
+
|
| 58 |
+
# PDF / BIB links from the button-row div
|
| 59 |
+
pdf_url = bib_url = ""
|
| 60 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 61 |
+
if btn_row:
|
| 62 |
+
for a in btn_row.find_all("a", href=True):
|
| 63 |
+
text = a.get_text(strip=True).lower()
|
| 64 |
+
h = a["href"]
|
| 65 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 66 |
+
pdf_url = abs_url(h)
|
| 67 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 68 |
+
bib_url = abs_url(h)
|
| 69 |
+
|
| 70 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 71 |
+
authors = []
|
| 72 |
+
span = paper_div.find("span", class_="d-block")
|
| 73 |
+
if span:
|
| 74 |
+
for a in span.find_all("a", href=True):
|
| 75 |
+
if "/people/" in a["href"]:
|
| 76 |
+
authors.append(a.get_text(strip=True))
|
| 77 |
+
|
| 78 |
+
# Abstract: look for the collapse div with abstract content
|
| 79 |
+
abstract = ""
|
| 80 |
+
# Find the abstract ID from the button
|
| 81 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 82 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 83 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 84 |
+
# Find the abstract div using this ID
|
| 85 |
+
abs_div = soup.find("div", id=abs_id)
|
| 86 |
+
if abs_div:
|
| 87 |
+
body = abs_div.find("div", class_="card-body")
|
| 88 |
+
if body:
|
| 89 |
+
abstract = body.get_text(strip=True)
|
| 90 |
+
|
| 91 |
+
# Determine volume from paper_id
|
| 92 |
+
volume = ""
|
| 93 |
+
if paper_id:
|
| 94 |
+
parts = paper_id.split(".")
|
| 95 |
+
if len(parts) >= 2:
|
| 96 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 97 |
+
|
| 98 |
+
return {
|
| 99 |
+
"paper_id": paper_id,
|
| 100 |
+
"title": title,
|
| 101 |
+
"authors": authors,
|
| 102 |
+
"abstract": abstract,
|
| 103 |
+
"url": url,
|
| 104 |
+
"pdf_url": pdf_url,
|
| 105 |
+
"bib_url": bib_url,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main():
|
| 110 |
+
for year in range(0, 25, 2):
|
| 111 |
+
year = f"20{year:02d}"
|
| 112 |
+
try:
|
| 113 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 114 |
+
print("Parsing ...", flush=True)
|
| 115 |
+
papers = parse_papers(html)
|
| 116 |
+
|
| 117 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 118 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 119 |
+
for p in papers:
|
| 120 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 121 |
+
|
| 122 |
+
print("Done")
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"Error: {e}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
main()
|
scripts/naacl/naacl.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/naacl-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/naacl/naacl{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
# with open("acl.txt", "w") as f:
|
| 16 |
+
# f.write(resp.text)
|
| 17 |
+
return resp.text
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def abs_url(href):
|
| 21 |
+
if not href:
|
| 22 |
+
return ""
|
| 23 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def parse_papers(html):
|
| 27 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 28 |
+
papers = []
|
| 29 |
+
|
| 30 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 31 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 32 |
+
|
| 33 |
+
for paper_div in paper_divs:
|
| 34 |
+
paper = parse_paper_div(paper_div)
|
| 35 |
+
if paper:
|
| 36 |
+
papers.append(paper)
|
| 37 |
+
|
| 38 |
+
return papers
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def parse_paper_div(paper_div):
|
| 42 |
+
# Extract the paper title and URL
|
| 43 |
+
title_element = paper_div.find("strong")
|
| 44 |
+
if not title_element:
|
| 45 |
+
return None
|
| 46 |
+
|
| 47 |
+
title_link = title_element.find("a")
|
| 48 |
+
if not title_link:
|
| 49 |
+
return None
|
| 50 |
+
|
| 51 |
+
title = title_link.get_text(strip=False)
|
| 52 |
+
href = title_link.get("href", "")
|
| 53 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 54 |
+
url = abs_url(href)
|
| 55 |
+
|
| 56 |
+
# Skip if no paper_id found
|
| 57 |
+
if not paper_id:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
# PDF / BIB links from the button-row div
|
| 61 |
+
pdf_url = bib_url = ""
|
| 62 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 63 |
+
if btn_row:
|
| 64 |
+
for a in btn_row.find_all("a", href=True):
|
| 65 |
+
text = a.get_text(strip=True).lower()
|
| 66 |
+
h = a["href"]
|
| 67 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 68 |
+
pdf_url = abs_url(h)
|
| 69 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 70 |
+
bib_url = abs_url(h)
|
| 71 |
+
|
| 72 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 73 |
+
authors = []
|
| 74 |
+
span = paper_div.find("span", class_="d-block")
|
| 75 |
+
if span:
|
| 76 |
+
for a in span.find_all("a", href=True):
|
| 77 |
+
if "/people/" in a["href"]:
|
| 78 |
+
authors.append(a.get_text(strip=True))
|
| 79 |
+
|
| 80 |
+
# Abstract: look for the collapse div with abstract content
|
| 81 |
+
abstract = ""
|
| 82 |
+
# Find the abstract ID from the button
|
| 83 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 84 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 85 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 86 |
+
# Find the abstract div using this ID
|
| 87 |
+
abs_div = soup.find("div", id=abs_id)
|
| 88 |
+
if abs_div:
|
| 89 |
+
body = abs_div.find("div", class_="card-body")
|
| 90 |
+
if body:
|
| 91 |
+
abstract = body.get_text(strip=True)
|
| 92 |
+
|
| 93 |
+
# Determine volume from paper_id
|
| 94 |
+
volume = ""
|
| 95 |
+
if paper_id:
|
| 96 |
+
parts = paper_id.split(".")
|
| 97 |
+
if len(parts) >= 2:
|
| 98 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 99 |
+
|
| 100 |
+
return {
|
| 101 |
+
"paper_id": paper_id,
|
| 102 |
+
"title": title,
|
| 103 |
+
"authors": authors,
|
| 104 |
+
"abstract": abstract,
|
| 105 |
+
"url": url,
|
| 106 |
+
"pdf_url": pdf_url,
|
| 107 |
+
"bib_url": bib_url,
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def main():
|
| 112 |
+
for year in [25, 24, 22, 21, 19, 18, 16, 15, 13, 12, 10, 9, 7, 6, 4, 3, 1, 0]:
|
| 113 |
+
year = f"20{year:02d}"
|
| 114 |
+
try:
|
| 115 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 116 |
+
print("Parsing ...", flush=True)
|
| 117 |
+
papers = parse_papers(html)
|
| 118 |
+
|
| 119 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 120 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 121 |
+
for p in papers:
|
| 122 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 123 |
+
|
| 124 |
+
print("Done")
|
| 125 |
+
except Exception as e:
|
| 126 |
+
print(f"Error: {e}")
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
main()
|
scripts/naacl/naacl2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/naacl-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/naacl/naacl2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/rocling/rocling.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/rocling-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/rocling/rocling{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 29 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 30 |
+
|
| 31 |
+
for paper_div in paper_divs:
|
| 32 |
+
paper = parse_paper_div(paper_div)
|
| 33 |
+
if paper:
|
| 34 |
+
papers.append(paper)
|
| 35 |
+
|
| 36 |
+
return papers
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_paper_div(paper_div):
|
| 40 |
+
# Extract the paper title and URL
|
| 41 |
+
title_element = paper_div.find("strong")
|
| 42 |
+
if not title_element:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
title_link = title_element.find("a")
|
| 46 |
+
if not title_link:
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
title = title_link.get_text(strip=False)
|
| 50 |
+
href = title_link.get("href", "")
|
| 51 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 52 |
+
url = abs_url(href)
|
| 53 |
+
|
| 54 |
+
# Skip if no paper_id found
|
| 55 |
+
if not paper_id:
|
| 56 |
+
return None
|
| 57 |
+
|
| 58 |
+
# PDF / BIB links from the button-row div
|
| 59 |
+
pdf_url = bib_url = ""
|
| 60 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 61 |
+
if btn_row:
|
| 62 |
+
for a in btn_row.find_all("a", href=True):
|
| 63 |
+
text = a.get_text(strip=True).lower()
|
| 64 |
+
h = a["href"]
|
| 65 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 66 |
+
pdf_url = abs_url(h)
|
| 67 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 68 |
+
bib_url = abs_url(h)
|
| 69 |
+
|
| 70 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 71 |
+
authors = []
|
| 72 |
+
span = paper_div.find("span", class_="d-block")
|
| 73 |
+
if span:
|
| 74 |
+
for a in span.find_all("a", href=True):
|
| 75 |
+
if "/people/" in a["href"]:
|
| 76 |
+
authors.append(a.get_text(strip=True))
|
| 77 |
+
|
| 78 |
+
# Abstract: look for the collapse div with abstract content
|
| 79 |
+
abstract = ""
|
| 80 |
+
# Find the abstract ID from the button
|
| 81 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 82 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 83 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 84 |
+
# Find the abstract div using this ID
|
| 85 |
+
abs_div = soup.find("div", id=abs_id)
|
| 86 |
+
if abs_div:
|
| 87 |
+
body = abs_div.find("div", class_="card-body")
|
| 88 |
+
if body:
|
| 89 |
+
abstract = body.get_text(strip=True)
|
| 90 |
+
|
| 91 |
+
# Determine volume from paper_id
|
| 92 |
+
volume = ""
|
| 93 |
+
if paper_id:
|
| 94 |
+
parts = paper_id.split(".")
|
| 95 |
+
if len(parts) >= 2:
|
| 96 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 97 |
+
|
| 98 |
+
return {
|
| 99 |
+
"paper_id": paper_id,
|
| 100 |
+
"title": title,
|
| 101 |
+
"authors": authors,
|
| 102 |
+
"abstract": abstract,
|
| 103 |
+
"url": url,
|
| 104 |
+
"pdf_url": pdf_url,
|
| 105 |
+
"bib_url": bib_url,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main():
|
| 110 |
+
for year in range(3, 25):
|
| 111 |
+
year = f"20{year:02d}"
|
| 112 |
+
try:
|
| 113 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 114 |
+
print("Parsing ...", flush=True)
|
| 115 |
+
papers = parse_papers(html)
|
| 116 |
+
|
| 117 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 118 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 119 |
+
for p in papers:
|
| 120 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 121 |
+
|
| 122 |
+
print("Done")
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"Error: {e}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
main()
|
scripts/rocling/rocling2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/rocling-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/rocling/rocling2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/semeval/semeval.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/semeval-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/semeval/semeval{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 29 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 30 |
+
|
| 31 |
+
for paper_div in paper_divs:
|
| 32 |
+
paper = parse_paper_div(paper_div)
|
| 33 |
+
if paper:
|
| 34 |
+
papers.append(paper)
|
| 35 |
+
|
| 36 |
+
return papers
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_paper_div(paper_div):
|
| 40 |
+
# Extract the paper title and URL
|
| 41 |
+
title_element = paper_div.find("strong")
|
| 42 |
+
if not title_element:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
title_link = title_element.find("a")
|
| 46 |
+
if not title_link:
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
title = title_link.get_text(strip=False)
|
| 50 |
+
href = title_link.get("href", "")
|
| 51 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 52 |
+
url = abs_url(href)
|
| 53 |
+
|
| 54 |
+
# Skip if no paper_id found
|
| 55 |
+
if not paper_id:
|
| 56 |
+
return None
|
| 57 |
+
|
| 58 |
+
# PDF / BIB links from the button-row div
|
| 59 |
+
pdf_url = bib_url = ""
|
| 60 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 61 |
+
if btn_row:
|
| 62 |
+
for a in btn_row.find_all("a", href=True):
|
| 63 |
+
text = a.get_text(strip=True).lower()
|
| 64 |
+
h = a["href"]
|
| 65 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 66 |
+
pdf_url = abs_url(h)
|
| 67 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 68 |
+
bib_url = abs_url(h)
|
| 69 |
+
|
| 70 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 71 |
+
authors = []
|
| 72 |
+
span = paper_div.find("span", class_="d-block")
|
| 73 |
+
if span:
|
| 74 |
+
for a in span.find_all("a", href=True):
|
| 75 |
+
if "/people/" in a["href"]:
|
| 76 |
+
authors.append(a.get_text(strip=True))
|
| 77 |
+
|
| 78 |
+
# Abstract: look for the collapse div with abstract content
|
| 79 |
+
abstract = ""
|
| 80 |
+
# Find the abstract ID from the button
|
| 81 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 82 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 83 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 84 |
+
# Find the abstract div using this ID
|
| 85 |
+
abs_div = soup.find("div", id=abs_id)
|
| 86 |
+
if abs_div:
|
| 87 |
+
body = abs_div.find("div", class_="card-body")
|
| 88 |
+
if body:
|
| 89 |
+
abstract = body.get_text(strip=True)
|
| 90 |
+
|
| 91 |
+
# Determine volume from paper_id
|
| 92 |
+
volume = ""
|
| 93 |
+
if paper_id:
|
| 94 |
+
parts = paper_id.split(".")
|
| 95 |
+
if len(parts) >= 2:
|
| 96 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 97 |
+
|
| 98 |
+
return {
|
| 99 |
+
"paper_id": paper_id,
|
| 100 |
+
"title": title,
|
| 101 |
+
"authors": authors,
|
| 102 |
+
"abstract": abstract,
|
| 103 |
+
"url": url,
|
| 104 |
+
"pdf_url": pdf_url,
|
| 105 |
+
"bib_url": bib_url,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main():
|
| 110 |
+
for year in list(range(12, 25)) + [1, 4, 7, 10]:
|
| 111 |
+
year = f"20{year:02d}"
|
| 112 |
+
try:
|
| 113 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 114 |
+
print("Parsing ...", flush=True)
|
| 115 |
+
papers = parse_papers(html)
|
| 116 |
+
|
| 117 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 118 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 119 |
+
for p in papers:
|
| 120 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 121 |
+
|
| 122 |
+
print("Done")
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"Error: {e}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
main()
|
scripts/semeval/semeval2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/semeval-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/semeval/semeval2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/tacl/tacl.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/tacl-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/tacl/tacl{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
# with open("acl.txt", "w") as f:
|
| 16 |
+
# f.write(resp.text)
|
| 17 |
+
return resp.text
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def abs_url(href):
|
| 21 |
+
if not href:
|
| 22 |
+
return ""
|
| 23 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def parse_papers(html):
|
| 27 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 28 |
+
papers = []
|
| 29 |
+
|
| 30 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 31 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 32 |
+
|
| 33 |
+
for paper_div in paper_divs:
|
| 34 |
+
paper = parse_paper_div(paper_div)
|
| 35 |
+
if paper:
|
| 36 |
+
papers.append(paper)
|
| 37 |
+
|
| 38 |
+
return papers
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def parse_paper_div(paper_div):
|
| 42 |
+
# Extract the paper title and URL
|
| 43 |
+
title_element = paper_div.find("strong")
|
| 44 |
+
if not title_element:
|
| 45 |
+
return None
|
| 46 |
+
|
| 47 |
+
title_link = title_element.find("a")
|
| 48 |
+
if not title_link:
|
| 49 |
+
return None
|
| 50 |
+
|
| 51 |
+
title = title_link.get_text(strip=False)
|
| 52 |
+
href = title_link.get("href", "")
|
| 53 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 54 |
+
url = abs_url(href)
|
| 55 |
+
|
| 56 |
+
# Skip if no paper_id found
|
| 57 |
+
if not paper_id:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
# PDF / BIB links from the button-row div
|
| 61 |
+
pdf_url = bib_url = ""
|
| 62 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 63 |
+
if btn_row:
|
| 64 |
+
for a in btn_row.find_all("a", href=True):
|
| 65 |
+
text = a.get_text(strip=True).lower()
|
| 66 |
+
h = a["href"]
|
| 67 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 68 |
+
pdf_url = abs_url(h)
|
| 69 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 70 |
+
bib_url = abs_url(h)
|
| 71 |
+
|
| 72 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 73 |
+
authors = []
|
| 74 |
+
span = paper_div.find("span", class_="d-block")
|
| 75 |
+
if span:
|
| 76 |
+
for a in span.find_all("a", href=True):
|
| 77 |
+
if "/people/" in a["href"]:
|
| 78 |
+
authors.append(a.get_text(strip=True))
|
| 79 |
+
|
| 80 |
+
# Abstract: look for the collapse div with abstract content
|
| 81 |
+
abstract = ""
|
| 82 |
+
# Find the abstract ID from the button
|
| 83 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 84 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 85 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 86 |
+
# Find the abstract div using this ID
|
| 87 |
+
abs_div = soup.find("div", id=abs_id)
|
| 88 |
+
if abs_div:
|
| 89 |
+
body = abs_div.find("div", class_="card-body")
|
| 90 |
+
if body:
|
| 91 |
+
abstract = body.get_text(strip=True)
|
| 92 |
+
|
| 93 |
+
# Determine volume from paper_id
|
| 94 |
+
volume = ""
|
| 95 |
+
if paper_id:
|
| 96 |
+
parts = paper_id.split(".")
|
| 97 |
+
if len(parts) >= 2:
|
| 98 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 99 |
+
|
| 100 |
+
return {
|
| 101 |
+
"paper_id": paper_id,
|
| 102 |
+
"title": title,
|
| 103 |
+
"authors": authors,
|
| 104 |
+
"abstract": abstract,
|
| 105 |
+
"url": url,
|
| 106 |
+
"pdf_url": pdf_url,
|
| 107 |
+
"bib_url": bib_url,
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def main():
|
| 112 |
+
for year in range(13, 25):
|
| 113 |
+
year = f"20{year:02d}"
|
| 114 |
+
try:
|
| 115 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 116 |
+
print("Parsing ...", flush=True)
|
| 117 |
+
papers = parse_papers(html)
|
| 118 |
+
|
| 119 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 120 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 121 |
+
for p in papers:
|
| 122 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 123 |
+
|
| 124 |
+
print("Done")
|
| 125 |
+
except Exception as e:
|
| 126 |
+
print(f"Error: {e}")
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
main()
|
scripts/tacl/tacl2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/tacl-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/tacl/tacl2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/tacl/tacl2026.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/tacl-2026/"
|
| 6 |
+
OUTPUT_FILE = "data/tacl/tacl2026_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2026"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|
scripts/wmt/wmt.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/wmt-{year}/"
|
| 6 |
+
OUTPUT_FILE = "data/wmt/wmt{year}_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Find all paper divs - each paper is in a div with class "d-sm-flex align-items-stretch mb-3"
|
| 29 |
+
paper_divs = soup.find_all("div", class_="d-sm-flex align-items-stretch mb-3")
|
| 30 |
+
|
| 31 |
+
for paper_div in paper_divs:
|
| 32 |
+
paper = parse_paper_div(paper_div)
|
| 33 |
+
if paper:
|
| 34 |
+
papers.append(paper)
|
| 35 |
+
|
| 36 |
+
return papers
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def parse_paper_div(paper_div):
|
| 40 |
+
# Extract the paper title and URL
|
| 41 |
+
title_element = paper_div.find("strong")
|
| 42 |
+
if not title_element:
|
| 43 |
+
return None
|
| 44 |
+
|
| 45 |
+
title_link = title_element.find("a")
|
| 46 |
+
if not title_link:
|
| 47 |
+
return None
|
| 48 |
+
|
| 49 |
+
title = title_link.get_text(strip=False)
|
| 50 |
+
href = title_link.get("href", "")
|
| 51 |
+
paper_id = href.strip("/").split("/")[-1] if href else ""
|
| 52 |
+
url = abs_url(href)
|
| 53 |
+
|
| 54 |
+
# Skip if no paper_id found
|
| 55 |
+
if not paper_id:
|
| 56 |
+
return None
|
| 57 |
+
|
| 58 |
+
# PDF / BIB links from the button-row div
|
| 59 |
+
pdf_url = bib_url = ""
|
| 60 |
+
btn_row = paper_div.find("div", class_="list-button-row")
|
| 61 |
+
if btn_row:
|
| 62 |
+
for a in btn_row.find_all("a", href=True):
|
| 63 |
+
text = a.get_text(strip=True).lower()
|
| 64 |
+
h = a["href"]
|
| 65 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 66 |
+
pdf_url = abs_url(h)
|
| 67 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 68 |
+
bib_url = abs_url(h)
|
| 69 |
+
|
| 70 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 71 |
+
authors = []
|
| 72 |
+
span = paper_div.find("span", class_="d-block")
|
| 73 |
+
if span:
|
| 74 |
+
for a in span.find_all("a", href=True):
|
| 75 |
+
if "/people/" in a["href"]:
|
| 76 |
+
authors.append(a.get_text(strip=True))
|
| 77 |
+
|
| 78 |
+
# Abstract: look for the collapse div with abstract content
|
| 79 |
+
abstract = ""
|
| 80 |
+
# Find the abstract ID from the button
|
| 81 |
+
abs_button = paper_div.find("a", class_="badge text-bg-info")
|
| 82 |
+
if abs_button and "data-bs-target" in abs_button.attrs:
|
| 83 |
+
abs_id = abs_button["data-bs-target"].lstrip("#")
|
| 84 |
+
# Find the abstract div using this ID
|
| 85 |
+
abs_div = soup.find("div", id=abs_id)
|
| 86 |
+
if abs_div:
|
| 87 |
+
body = abs_div.find("div", class_="card-body")
|
| 88 |
+
if body:
|
| 89 |
+
abstract = body.get_text(strip=True)
|
| 90 |
+
|
| 91 |
+
# Determine volume from paper_id
|
| 92 |
+
volume = ""
|
| 93 |
+
if paper_id:
|
| 94 |
+
parts = paper_id.split(".")
|
| 95 |
+
if len(parts) >= 2:
|
| 96 |
+
volume = parts[1] # e.g., "acl-long" from "2023.acl-long.19"
|
| 97 |
+
|
| 98 |
+
return {
|
| 99 |
+
"paper_id": paper_id,
|
| 100 |
+
"title": title,
|
| 101 |
+
"authors": authors,
|
| 102 |
+
"abstract": abstract,
|
| 103 |
+
"url": url,
|
| 104 |
+
"pdf_url": pdf_url,
|
| 105 |
+
"bib_url": bib_url,
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def main():
|
| 110 |
+
for year in range(6, 25):
|
| 111 |
+
year = f"20{year:02d}"
|
| 112 |
+
try:
|
| 113 |
+
html = fetch_page(SOURCE_URL.format(year=year))
|
| 114 |
+
print("Parsing ...", flush=True)
|
| 115 |
+
papers = parse_papers(html)
|
| 116 |
+
|
| 117 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE.format(year=year)} ...", flush=True)
|
| 118 |
+
with open(OUTPUT_FILE.format(year=year), "w", encoding="utf-8") as f:
|
| 119 |
+
for p in papers:
|
| 120 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 121 |
+
|
| 122 |
+
print("Done")
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f"Error: {e}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
main()
|
scripts/wmt/wmt2025.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import requests
|
| 3 |
+
from bs4 import BeautifulSoup
|
| 4 |
+
|
| 5 |
+
SOURCE_URL = "https://aclanthology.org/events/wmt-2025/"
|
| 6 |
+
OUTPUT_FILE = "data/wmt/wmt2025_papers.jsonl"
|
| 7 |
+
BASE_URL = "https://aclanthology.org"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def fetch_page(url):
|
| 11 |
+
headers = {"User-Agent": "Mozilla/5.0 (ACL-parser/1.0; research)"}
|
| 12 |
+
print(f"Fetching {url} ...", flush=True)
|
| 13 |
+
resp = requests.get(url, headers=headers, timeout=120)
|
| 14 |
+
resp.raise_for_status()
|
| 15 |
+
return resp.text
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def abs_url(href):
|
| 19 |
+
if not href:
|
| 20 |
+
return ""
|
| 21 |
+
return href if href.startswith("http") else BASE_URL + href
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def parse_papers(html):
|
| 25 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 26 |
+
papers = []
|
| 27 |
+
|
| 28 |
+
# Each volume section is wrapped in <div id="2025acl-long"> etc.
|
| 29 |
+
volume_divs = soup.find_all("div", id=lambda i: i and i.startswith("2025"))
|
| 30 |
+
|
| 31 |
+
for vol_div in volume_divs:
|
| 32 |
+
volume_id = vol_div.get("id", "")
|
| 33 |
+
|
| 34 |
+
# Volume name is in the <a class="align-middle"> inside the <h4>
|
| 35 |
+
h4 = vol_div.find("h4")
|
| 36 |
+
if h4:
|
| 37 |
+
vol_link = h4.find("a", class_="align-middle")
|
| 38 |
+
volume_name = vol_link.get_text(strip=True) if vol_link else h4.get_text(strip=True)
|
| 39 |
+
else:
|
| 40 |
+
volume_name = volume_id
|
| 41 |
+
|
| 42 |
+
# Each paper is a <div class="d-sm-flex align-items-stretch mb-3">
|
| 43 |
+
for card in vol_div.find_all("div", class_="d-sm-flex align-items-stretch mb-3"):
|
| 44 |
+
paper = parse_card(card, volume_id, volume_name)
|
| 45 |
+
if paper:
|
| 46 |
+
papers.append(paper)
|
| 47 |
+
|
| 48 |
+
return papers
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def parse_card(card, volume_id, volume_name):
|
| 52 |
+
# Title
|
| 53 |
+
strong = card.find("strong")
|
| 54 |
+
if not strong:
|
| 55 |
+
return None
|
| 56 |
+
title_link = strong.find("a")
|
| 57 |
+
if not title_link:
|
| 58 |
+
return None
|
| 59 |
+
|
| 60 |
+
title = title_link.get_text(strip=False)
|
| 61 |
+
href = title_link.get("href", "")
|
| 62 |
+
paper_id = href.strip("/")
|
| 63 |
+
url = abs_url(href)
|
| 64 |
+
|
| 65 |
+
# Skip front-matter entries (end with ".0")
|
| 66 |
+
if paper_id.endswith(".0"):
|
| 67 |
+
return None
|
| 68 |
+
|
| 69 |
+
# PDF / BIB from the button-row div
|
| 70 |
+
pdf_url = bib_url = ""
|
| 71 |
+
btn_row = card.find("div", class_="list-button-row")
|
| 72 |
+
if btn_row:
|
| 73 |
+
for a in btn_row.find_all("a", href=True):
|
| 74 |
+
text = a.get_text(strip=True).lower()
|
| 75 |
+
h = a["href"]
|
| 76 |
+
if text == "pdf" or h.endswith(".pdf"):
|
| 77 |
+
pdf_url = abs_url(h)
|
| 78 |
+
elif text == "bib" or h.endswith(".bib"):
|
| 79 |
+
bib_url = abs_url(h)
|
| 80 |
+
|
| 81 |
+
# Authors: <a href="/people/..."> links inside the d-block span
|
| 82 |
+
authors = []
|
| 83 |
+
span = card.find("span", class_="d-block")
|
| 84 |
+
if span:
|
| 85 |
+
for a in span.find_all("a", href=True):
|
| 86 |
+
if "/people/" in a["href"]:
|
| 87 |
+
authors.append(a.get_text(strip=True))
|
| 88 |
+
|
| 89 |
+
# Abstract: next sibling div with class "abstract-collapse"
|
| 90 |
+
abstract = ""
|
| 91 |
+
nxt = card.find_next_sibling()
|
| 92 |
+
if nxt and "abstract-collapse" in nxt.get("class", []):
|
| 93 |
+
body = nxt.find("div", class_="card-body")
|
| 94 |
+
if body:
|
| 95 |
+
abstract = body.get_text(strip=True)
|
| 96 |
+
|
| 97 |
+
return {
|
| 98 |
+
"paper_id": paper_id,
|
| 99 |
+
"title": title,
|
| 100 |
+
"authors": authors,
|
| 101 |
+
"abstract": abstract,
|
| 102 |
+
"url": url,
|
| 103 |
+
"pdf_url": pdf_url,
|
| 104 |
+
"bib_url": bib_url,
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main():
|
| 109 |
+
html = fetch_page(SOURCE_URL)
|
| 110 |
+
print("Parsing ...", flush=True)
|
| 111 |
+
papers = parse_papers(html)
|
| 112 |
+
|
| 113 |
+
print(f"Found {len(papers)} papers. Writing to {OUTPUT_FILE} ...", flush=True)
|
| 114 |
+
with open(OUTPUT_FILE, "w", encoding="utf-8") as f:
|
| 115 |
+
for p in papers:
|
| 116 |
+
f.write(json.dumps(p, ensure_ascii=False) + "\n")
|
| 117 |
+
|
| 118 |
+
print("Done")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
if __name__ == "__main__":
|
| 122 |
+
main()
|