Skip to content

An Exploration of Left-Corner Transformations, EMNLP 2023

Notifications You must be signed in to change notification settings

rycolab/left-corner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An Exploration of Left-Corner Transformations

TL;DR The repository implements the generalized left-corner transformation from our EMNLP 2023 paper and many other utilities for working with context-free grammars.

Abstract: The left-corner transformation is used to remove left recursion from context-free grammars, which is an important step towards making the grammar parsable top-down with simple techniques. This paper generalizes prior left-corner transformations to support semiring-weighted production rules and to provide finer-grained control over which left corners may be moved. Our generalized left-corner transformation (GLCT) arose from unifying the left-corner transformation and speculation transformation, originally for logic programming. Our new transformation and speculation define equivalent weighted languages. Yet, their derivation trees are structurally different in an important way: GLCT replaces left recursion with right recursion, and speculation does not. We also provide several technical results regarding the formal relationships between the outputs of GLCT, speculation, and the original grammar. Lastly, we empirically investigate the efficiency of GLCT for left-recursion elimination from grammars of nine languages.

Getting Started 🚦

Installation 🔧

Option 1: pip

$ pip install leftcorner

Option 2: Clone and install the development version

$ git clone [email protected]:rycolab/left-corner.git ./left-corner
$ cd left-corner
$ pip install -e .

Tutorial 🎓

Please see the tutorial notebook (Tutorial.ipynb).

Tests 🙋

Unit and integration tests

$ pytest tests/tests.py 

Code coverage

$ ./run-coverage.bash

Experiments 🧪

The experiments on the English ATIS grammar can be run without downloading additional data. To run the experiments on the non-English, SPMRL grammars, you will need to acquire the SPRML treebanks from the shared task website.

$ python test/test_grammars.py

Citation 📜

If you use this repository in your work, please link to it or cite it with the following BibTeX:

@inproceedings{opedal-etal-2023-exploration,
    title = "An Exploration of Left-Corner Transformations",
    author = "Opedal, Andreas  and
      Tsipidi, Eleftheria  and
      Pimentel, Tiago  and
      Cotterell, Ryan  and
      Vieira, Tim",
    booktitle = "Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing",
    month = dec,
    year = "2023",
    address = "Singapore",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2023.emnlp-main.827",
    pages = "13393--13427",
}

About

An Exploration of Left-Corner Transformations, EMNLP 2023

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published