Repository: acl-org/acl-anthology

Issue:
URL is missing from BibTeX
E.g. https://www.aclweb.org/anthology/S12-1020.bib should have the canonical URL.


Discussion:
This started happening around Oct. 2.
Drat, I know what caused this. I'll fix it today and also add a unit test so it won't happen again.

Resolving patch:
diff --git a/bin/anthology/utils.py b/bin/anthology/utils.py
--- a/bin/anthology/utils.py
+++ b/bin/anthology/utils.py
@@ -298,11 +298,11 @@ def parse_element(xml_element):
             value = element.text
 
         if tag == "url":
-            # Use the tag 'pdf' instead of 'url'
-            tag = 'pdf'
+            # Set the URL (canonical / landing page for Anthology)
+            value = infer_url(element.text)
 
-            # Convert relative URLs to canonical ones
-            value = element.text if element.text.startswith('http') else data.ANTHOLOGY_PDF.format(element.text)
+            # Add a PDF link with, converting relative URLs to canonical ones
+            attrib['pdf'] = element.text if urlparse(element.text).netloc else data.ANTHOLOGY_PDF.format(element.text)
 
         if tag in data.LIST_ELEMENTS:
             try:
diff --git a/bin/create_bibtex.py b/bin/create_bibtex.py
--- a/bin/create_bibtex.py
+++ b/bin/create_bibtex.py
@@ -64,6 +64,7 @@ def create_bibtex(anthology, trgdir, clean=False):
                     ) as file_paper:
                         contents = paper.as_bibtex()
                         file_paper.write(contents)
+                        file_paper.write("\n")
                         concise_contents = paper.as_bibtex(concise=True)
                         file_volume.write(concise_contents)
                         file_volume.write("\n")


Test patch:
diff --git a/test/data/P19-1007.bib b/test/data/P19-1007.bib
new file mode 100644
--- /dev/null
+++ b/test/data/P19-1007.bib
@@ -0,0 +1,17 @@
+@inproceedings{cao-etal-2019-semantic,
+    title = "Semantic Parsing with Dual Learning",
+    author = "Cao, Ruisheng  and
+      Zhu, Su  and
+      Liu, Chen  and
+      Li, Jieyu  and
+      Yu, Kai",
+    booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
+    month = jul,
+    year = "2019",
+    address = "Florence, Italy",
+    publisher = "Association for Computational Linguistics",
+    url = "https://www.aclweb.org/anthology/P19-1007",
+    doi = "10.18653/v1/P19-1007",
+    pages = "51--64",
+    abstract = "Semantic parsing converts natural language queries into structured logical forms. The lack of training data is still one of the most serious problems in this area. In this work, we develop a semantic parsing framework with the dual learning algorithm, which enables a semantic parser to make full use of data (labeled and even unlabeled) through a dual-learning game. This game between a primal model (semantic parsing) and a dual model (logical form to query) forces them to regularize each other, and can achieve feedback signals from some prior-knowledge. By utilizing the prior-knowledge of logical form structures, we propose a novel reward signal at the surface and semantic levels which tends to generate complete and reasonable logical forms. Experimental results show that our approach achieves new state-of-the-art performance on ATIS dataset and gets competitive performance on OVERNIGHT dataset.",
+}
diff --git a/test/data/P19-1007.endf b/test/data/P19-1007.endf
new file mode 100644
--- /dev/null
+++ b/test/data/P19-1007.endf
@@ -0,0 +1,19 @@
+﻿%0 Conference Proceedings
+%T Semantic Parsing with Dual Learning
+%A Cao, Ruisheng
+%A Zhu, Su
+%A Liu, Chen
+%A Li, Jieyu
+%A Yu, Kai
+%S Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics
+%D 2019
+%8 jul
+%I Association for Computational Linguistics
+%C Florence, Italy
+%F cao-etal-2019-semantic
+%X Semantic parsing converts natural language queries into structured logical forms. The lack of training data is still one of the most serious problems in this area. In this work, we develop a semantic parsing framework with the dual learning algorithm, which enables a semantic parser to make full use of data (labeled and even unlabeled) through a dual-learning game. This game between a primal model (semantic parsing) and a dual model (logical form to query) forces them to regularize each other, and can achieve feedback signals from some prior-knowledge. By utilizing the prior-knowledge of logical form structures, we propose a novel reward signal at the surface and semantic levels which tends to generate complete and reasonable logical forms. Experimental results show that our approach achieves new state-of-the-art performance on ATIS dataset and gets competitive performance on OVERNIGHT dataset.
+%R 10.18653/v1/P19-1007
+%U https://www.aclweb.org/anthology/P19-1007
+%U https://doi.org/10.18653/v1/P19-1007
+%P 51-64
+
diff --git a/test/data/P19-1007.xml b/test/data/P19-1007.xml
new file mode 100644
--- /dev/null
+++ b/test/data/P19-1007.xml
@@ -0,0 +1,72 @@
+﻿<?xml version="1.0" encoding="UTF-8"?>
+<modsCollection xmlns="http://www.loc.gov/mods/v3">
+<mods ID="cao-etal-2019-semantic">
+    <titleInfo>
+        <title>Semantic Parsing with Dual Learning</title>
+    </titleInfo>
+    <name type="personal">
+        <namePart type="given">Ruisheng</namePart>
+        <namePart type="family">Cao</namePart>
+        <role>
+            <roleTerm authority="marcrelator" type="text">author</roleTerm>
+        </role>
+    </name>
+    <name type="personal">
+        <namePart type="given">Su</namePart>
+        <namePart type="family">Zhu</namePart>
+        <role>
+            <roleTerm authority="marcrelator" type="text">author</roleTerm>
+        </role>
+    </name>
+    <name type="personal">
+        <namePart type="given">Chen</namePart>
+        <namePart type="family">Liu</namePart>
+        <role>
+            <roleTerm authority="marcrelator" type="text">author</roleTerm>
+        </role>
+    </name>
+    <name type="personal">
+        <namePart type="given">Jieyu</namePart>
+        <namePart type="family">Li</namePart>
+        <role>
+            <roleTerm authority="marcrelator" type="text">author</roleTerm>
+        </role>
+    </name>
+    <name type="personal">
+        <namePart type="given">Kai</namePart>
+        <namePart type="family">Yu</namePart>
+        <role>
+            <roleTerm authority="marcrelator" type="text">author</roleTerm>
+        </role>
+    </name>
+    <originInfo>
+        <dateIssued>2019-jul</dateIssued>
+    </originInfo>
+    <typeOfResource>text</typeOfResource>
+    <relatedItem type="host">
+        <titleInfo>
+            <title>Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics</title>
+        </titleInfo>
+        <originInfo>
+            <publisher>Association for Computational Linguistics</publisher>
+            <place>
+                <placeTerm type="text">Florence, Italy</placeTerm>
+            </place>
+        </originInfo>
+        <genre authority="marcgt">conference publication</genre>
+    </relatedItem>
+    <abstract>Semantic parsing converts natural language queries into structured logical forms. The lack of training data is still one of the most serious problems in this area. In this work, we develop a semantic parsing framework with the dual learning algorithm, which enables a semantic parser to make full use of data (labeled and even unlabeled) through a dual-learning game. This game between a primal model (semantic parsing) and a dual model (logical form to query) forces them to regularize each other, and can achieve feedback signals from some prior-knowledge. By utilizing the prior-knowledge of logical form structures, we propose a novel reward signal at the surface and semantic levels which tends to generate complete and reasonable logical forms. Experimental results show that our approach achieves new state-of-the-art performance on ATIS dataset and gets competitive performance on OVERNIGHT dataset.</abstract>
+    <identifier type="citekey">cao-etal-2019-semantic</identifier>
+    <identifier type="doi">10.18653/v1/P19-1007</identifier>
+    <location>
+        <url>https://www.aclweb.org/anthology/P19-1007</url>
+    </location>
+    <part>
+        <date>2019-jul</date>
+        <extent unit="page">
+            <start>51</start>
+            <end>64</end>
+        </extent>
+    </part>
+</mods>
+</modsCollection>