Repository: acl-org/acl-anthology

Issue:
Dummy frontmatter is causing problems
The EAMT ingestion introduced a "dummy frontmatter" to the code to make sure volume editors were properly registered:

https://github.com/acl-org/acl-anthology/blob/138f318a22c66db63d348e54402768b7190b365d/bin/anthology/volumes.py#L88-L90

Unfortunately, that's causing problems, including:

1. Iterating through `anthology.papers` yields objects that have no representation in the XML. *(I've stumbled on this trying to add bibkeys to the XML.)*
2. The website generates empty spaces both on volume entries ...
  ![image](https://user-images.githubusercontent.com/11348502/124798890-31c25b80-df54-11eb-9e1f-477245b98887.png)

3. ...and on the author pages:
  ![image](https://user-images.githubusercontent.com/11348502/124798920-3be45a00-df54-11eb-8b02-0c85b5208a1e.png)

4. Their respective BibTeX entries are invalid as they don't have titles:
  ![image](https://user-images.githubusercontent.com/11348502/124798976-4c94d000-df54-11eb-98a8-02c1549c5076.png)

I've attempted a quick fix (https://github.com/acl-org/acl-anthology/tree/fix-dummy-frontmatter) but it's not working as I hoped, so this might be a tricky problem to solve.
Dummy frontmatter is causing problems
The EAMT ingestion introduced a "dummy frontmatter" to the code to make sure volume editors were properly registered:

https://github.com/acl-org/acl-anthology/blob/138f318a22c66db63d348e54402768b7190b365d/bin/anthology/volumes.py#L88-L90

Unfortunately, that's causing problems, including:

1. Iterating through `anthology.papers` yields objects that have no representation in the XML. *(I've stumbled on this trying to add bibkeys to the XML.)*
2. The website generates empty spaces both on volume entries ...
  ![image](https://user-images.githubusercontent.com/11348502/124798890-31c25b80-df54-11eb-9e1f-477245b98887.png)

3. ...and on the author pages:
  ![image](https://user-images.githubusercontent.com/11348502/124798920-3be45a00-df54-11eb-8b02-0c85b5208a1e.png)

4. Their respective BibTeX entries are invalid as they don't have titles:
  ![image](https://user-images.githubusercontent.com/11348502/124798976-4c94d000-df54-11eb-98a8-02c1549c5076.png)

I've attempted a quick fix (https://github.com/acl-org/acl-anthology/tree/fix-dummy-frontmatter) but it's not working as I hoped, so this might be a tricky problem to solve.


Discussion:

Resolving patch:
diff --git a/bin/anthology/anthology.py b/bin/anthology/anthology.py
--- a/bin/anthology/anthology.py
+++ b/bin/anthology/anthology.py
@@ -103,6 +103,11 @@ def import_file(self, filename):
                 front_matter = volume.content[0]
                 self.pindex.register(front_matter)
                 self.papers[front_matter.full_id] = front_matter
+            else:
+                # dummy front matter to make sure that editors of
+                # volume get registered as people in author database
+                dummy_front_matter = Paper("0", None, volume, self.formatter)
+                self.pindex.register(dummy_front_matter, dummy=True)
 
             self.volumes[volume.full_id] = volume
             for paper_xml in volume_xml.findall("paper"):
diff --git a/bin/anthology/index.py b/bin/anthology/index.py
--- a/bin/anthology/index.py
+++ b/bin/anthology/index.py
@@ -230,8 +230,14 @@ def create_bibkey(self, paper):
         self.bibkeys.add(bibkey)
         return bibkey
 
-    def register(self, paper):
-        """Register all names associated with the given paper."""
+    def register(self, paper, dummy=False):
+        """Register all names associated with the given paper.
+
+        :param dummy: If True, will only resolve the author/editor names without
+        actually linking them to the given paper.  This is used for volumes
+        without frontmatter to make sure their editors still get registered
+        here, but without creating links to a non-existent paper.
+        """
         from .papers import Paper
 
         assert isinstance(paper, Paper), "Expected Paper, got {} ({})".format(
@@ -264,15 +270,17 @@ def register(self, paper):
                     explicit = True
 
                 self.id_to_used[id_].add(name)
-                # Register paper
-                self.id_to_papers[id_][role].append(paper.full_id)
-                self.name_to_papers[name][explicit].append(paper.full_id)
-                # Register co-author(s)
-                for co_name, co_id in paper.get(role):
-                    if co_id is None:
-                        co_id = self.resolve_name(co_name)["id"]
-                    if co_id != id_:
-                        self.coauthors[id_][co_id] += 1
+
+                if not dummy:
+                    # Register paper
+                    self.id_to_papers[id_][role].append(paper.full_id)
+                    self.name_to_papers[name][explicit].append(paper.full_id)
+                    # Register co-author(s)
+                    for co_name, co_id in paper.get(role):
+                        if co_id is None:
+                            co_id = self.resolve_name(co_name)["id"]
+                        if co_id != id_:
+                            self.coauthors[id_][co_id] += 1
 
     def verify(self):
         ## no longer issuing a warning for unused variants
diff --git a/bin/anthology/volumes.py b/bin/anthology/volumes.py
--- a/bin/anthology/volumes.py
+++ b/bin/anthology/volumes.py
@@ -84,11 +84,7 @@ def from_xml(
         front_matter_xml = volume_xml.find("frontmatter")
         if front_matter_xml is not None:
             front_matter = Paper.from_xml(front_matter_xml, volume, formatter)
-        else:
-            # dummy front matter to make sure that editors of
-            # volume get registered as people in author database
-            front_matter = Paper("0", ingest_date, volume, formatter)
-        volume.add_frontmatter(front_matter)
+            volume.add_frontmatter(front_matter)
 
         return volume
 


Test patch: