---
title: "A parallel corpus of Python functions and documentation strings"
description: "Research on translating between source code and natural language has been limited by training data… 21 references, cited by 39 papers here."
authors: ["Antonio Valerio Miceli Barone", "Rico Sennrich"]
year: 2017
venue: "arXiv:1707.02275"
source: "https://arxiv.org/abs/1707.02275"
doi: "10.48550/arxiv.1707.02275"
arxiv: "1707.02275"
licence: "arXiv — non-exclusive licence to distribute"
licence_url: "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"
summary_licence: "Elamur Cosmic License"
canonical: "https://research.elamur.ai/free/en/papers/barone-2017-parallel-corpus-python-functions-documentation/"
---
[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/barone-2017-parallel-corpus-python-functions-documentation/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2017](https://md.research.elamur.ai/free/en/papers/2017/page/3/) / A parallel corpus of Python functions and documentation strings for automated code documentation and code generation

# A parallel corpus of Python functions and documentation strings for automated code documentation and code generation

**Authors:** [Antonio Valerio Miceli Barone](https://md.research.elamur.ai/free/en/authors/antonio-valerio-miceli-barone/) and [Rico Sennrich](https://md.research.elamur.ai/free/en/authors/rico-sennrich/) · **Year:** 2017 · **Venue:** arXiv:1707.02275 · **Licence:** [arXiv — non-exclusive licence to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

**Links:** [Publisher's page](https://arxiv.org/abs/1707.02275) · [PDF](https://arxiv.org/pdf/1707.02275) · [DOI 10.48550/arxiv.1707.02275](https://doi.org/10.48550/arxiv.1707.02275) · [arXiv 1707.02275](https://arxiv.org/abs/1707.02275) · [OpenAlex](https://openalex.org/W2728773317)

**Citations:** 96 citations (OpenAlex, 2026-10-14) · [39](https://md.research.elamur.ai/free/en/papers/barone-2017-parallel-corpus-python-functions-documentation/cited-by/) in our library, of the 149,439 papers whose bibliographies we read

## Summary
Research on translating between source code and natural language has been limited by training data that is tiny, tied to one domain, or noisy. Low-noise sets such as DJANGO and Hearthstone also appear unrealistically easy because they rely on pseudo-code or highly repetitive code. Miceli Barone and Sennrich address this by mining Python 2.7 repositories on GitHub and pairing each top-level function with the docstring its own author wrote. Each function is split into a declaration, a docstring and a body. The code is normalized by parsing and unparsing, and each example is tagged with provenance metadata so that project-level context can be reconstructed. Functions without docstrings go into a separate code-only corpus. As baselines, the authors train Nematus NMT models with BPE in both directions. They also augment code generation through back-translation with synthetic docstrings. The scores are low, at roughly 10–14 BLEU, compared with the 60–85 reported on earlier corpora. This suggests the new resource better reflects real-world difficulty and offers a demanding benchmark.

## Key points
- The main parallel corpus holds 150,370 declaration–docstring–body triples. After duplicate removal it is split into 109,108 training, 2,000 validation and 2,000 test examples. A code-only corpus adds 161,630 functions.
- Every example records where it came from: the owner and name of its repository, the file it appears in, and its line number.
- The baselines use Nematus with Moses tokenization and BPE (vocabulary of 89,500), the Adam optimizer, and Bayesian recurrent dropout. No knowledge of program syntax is used.
- BLEU results (validation/test):
  - Code-to-docstring: 14.03/13.84.
  - Docstring-to-code: 10.32/10.24.
  - Docstring-to-code with back-translation: 10.85/10.90, a gain of about 0.5–0.6 points.
- The data, extraction scripts, system configurations and model outputs are released at github.com/Avmb/code-docstring-corpus.

*Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.*

📚 Shelves (5): [🖥️ Computer Science](https://md.research.elamur.ai/free/en/shelves/computer-science/) · 19,503 works · [🤖 Artificial Intelligence](https://md.research.elamur.ai/free/en/shelves/computer-science/artificial-intelligence/) · 18,805 works · [🎭 Arts and Humanities](https://md.research.elamur.ai/free/en/shelves/arts-and-humanities/) · 17,959 works · [🗣️ Language and Linguistics](https://md.research.elamur.ai/free/en/shelves/arts-and-humanities/language-and-linguistics/) · 17,789 works · [🗄️ Information Systems](https://md.research.elamur.ai/free/en/shelves/computer-science/information-systems/) · 1,888 works

🧭 Topics (1): [💻 Code & programming languages](https://md.research.elamur.ai/free/en/topics/code-and-programming/) · 194 works

## Cite

Cite as: Antonio Valerio Miceli Barone and Rico Sennrich. 2017. A parallel corpus of Python functions and documentation strings for automated code documentation and code generation. arXiv:1707.02275.

The paper itself, not this page. BibTeX from the library's record of the work.

```bibtex
@misc{barone2017parallel,
  title = {{A parallel corpus of Python functions and documentation strings for automated code documentation and code generation}},
  author = {Antonio Valerio Miceli Barone and Rico Sennrich},
  year = {2017},
  doi = {10.48550/arxiv.1707.02275},
  eprint = {1707.02275},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.1707.02275}
}
```

- [← previous Neural Semantic Parsing by Character-based Translation: Experiments with Abstract Meaning Representations](https://md.research.elamur.ai/free/en/papers/noord-2017-neural-semantic-parsing-character-based/)
- [next → Answering Complex Questions Using Open Information Extraction](https://md.research.elamur.ai/free/en/papers/khot-2017-answering-complex-questions-open-information/)
- [↑ back to papers of 2017](https://md.research.elamur.ai/free/en/papers/2017/page/3/)

## References

21 references, 9 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

1. Miltiadis Allamanis, Earl T Barr, Christian Bird, and Charles Sutton. 2015a. Suggesting accurate method and class names. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, pages 38–49. ACM. [find](https://scholar.google.com/scholar?q=Miltiadis+Allamanis%2C+Earl+T+Barr%2C+Christian+Bird%2C+and+Charles+Sutton%2E+2015a%2E+Suggesting+accurate+method+and+class+names%2E+In+Proceedings+of+the+2015+10th+Joint+Meeting+on+Foundations+of+Software+Engine)
2. Miltos Allamanis and Charles Sutton. 2013. Mining source code repositories at massive scale using language modeling. In Working Conference on Mining Software Repositories (MSR). [find](https://scholar.google.com/scholar?q=Miltos+Allamanis+and+Charles+Sutton%2E+2013%2E+Mining+source+code+repositories+at+massive+scale+using+language+modeling%2E+In+Working+Conference+on+Mining+Software+Repositories+%28MSR%29%2E)
3. Miltos Allamanis, Daniel Tarlow, Andrew Gordon, and Yi Wei. 2015b. [Bimodal modelling of source code and natural language](https://md.research.elamur.ai/free/en/papers/allamanis-2015-bimodal-modelling-source-code-natural/). In Proceedings of the 32nd International Conference on Machine Learning, pages 2123–2132, Lille, France. PMLR.
4. Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. [Neural machine translation by jointly learning to align and translate](https://md.research.elamur.ai/free/en/papers/bahdanau-2014-neural-machine-translation-jointly-learning/). arXiv preprint arXiv:1409.0473.
5. Avishkar Bhoopchand, Tim Rocktäschel, Earl Barr, and Sebastian Riedel. 2016. Learning python code suggestion with a sparse pointer network. arXiv preprint arXiv:1611.08307. [find](https://scholar.google.com/scholar?q=Avishkar+Bhoopchand%2C+Tim+Rockta%CC%88schel%2C+Earl+Barr%2C+and+Sebastian+Riedel%2E+2016%2E+Learning+python+code+suggestion+with+a+sparse+pointer+network%2E+arXiv+preprint+arXiv%3A1611%2E08307%2E)
6. Mauro Cettolo, Jan Niehues, Sebastian Stüker, Luisa Bentivogli, and Marcello Federico. 2016. Report on the 13th IWSLT Evaluation Campaign. In IWSLT 2016, Seattle, USA. [find](https://scholar.google.com/scholar?q=Mauro+Cettolo%2C+Jan+Niehues%2C+Sebastian+Stu%CC%88ker%2C+Luisa+Bentivogli%2C+and+Marcello+Federico%2E+2016%2E+Report+on+the+13th+IWSLT+Evaluation+Campaign%2E+In+IWSLT+2016%2C+Seattle%2C+USA%2E)
7. Noam Chomsky. 1956. Three models for the description of language. IRE Transactions on information theory, 2(3):113–124. [find](https://scholar.google.com/scholar?q=Noam+Chomsky%2E+1956%2E+Three+models+for+the+description+of+language%2E+IRE+Transactions+on+information+theory%2C+2%283%29%3A113%E2%80%93124%2E)
8. Yarin Gal and Zoubin Ghahramani. 2016. [A Theoretically Grounded Application of Dropout in Recurrent Neural Networks](https://md.research.elamur.ai/free/en/papers/gal-2015-theoretically-grounded-application-dropout-recurrent/). In Advances in Neural Information Processing Systems 29 (NIPS).
9. Alex Graves, Greg Wayne, and Ivo Danihelka. 2014. Neural turing machines. arXiv preprint arXiv:1410.5401. [find](https://scholar.google.com/scholar?q=Alex+Graves%2C+Greg+Wayne%2C+and+Ivo+Danihelka%2E+2014%2E+Neural+turing+machines%2E+arXiv+preprint+arXiv%3A1410%2E5401%2E)
10. Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, and Luke Zettlemoyer. 2016. Summarizing source code using a neural attention model. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pages 2073–2083. [find](https://scholar.google.com/scholar?q=Srinivasan+Iyer%2C+Ioannis+Konstas%2C+Alvin+Cheung%2C+and+Luke+Zettlemoyer%2E+2016%2E+Summarizing+source+code+using+a+neural+attention+model%2E+In+Proceedings+of+the+54th+Annual+Meeting+of+the+Association+for+Com)
11. Diederik P. Kingma and Jimmy Ba. 2015. [Adam: A Method for Stochastic Optimization](https://md.research.elamur.ai/free/en/papers/kingma-2014-adam-method-stochastic-optimization/). In The International Conference on Learning Representations, San Diego, California, USA.
12. Philipp Koehn, Hieu Hoang, Alexandra Birch, Chris Callison-Burch, Marcello Federico, Nicola Bertoldi, Brooke Cowan, Wade Shen, Christine Moran, Richard Zens, et al. 2007. Moses: Open source toolkit for statistical machine translation. In Proceedings of the 45th annual meeting of the ACL on interacti… [find](https://scholar.google.com/scholar?q=Philipp+Koehn%2C+Hieu+Hoang%2C+Alexandra+Birch%2C+Chris+Callison%2DBurch%2C+Marcello+Federico%2C+Nicola+Bertoldi%2C+Brooke+Cowan%2C+Wade+Shen%2C+Christine+Moran%2C+Richard+Zens%2C+et+al%2E+2007%2E+Moses%3A+Open+source+toolkit+fo)
13. Wang Ling, Edward Grefenstette, Karl Moritz Hermann, Tomáš Kočiskỳ, Andrew Senior, Fumin Wang, and Phil Blunsom. 2016. [Latent predictor networks for code generation](https://md.research.elamur.ai/free/en/papers/ling-2016-latent-predictor-networks-code-generation/). arXiv preprint arXiv:1603.06744.
14. George A Miller. 2003. The cognitive revolution: a historical perspective. Trends in cognitive sciences, 7(3):141–144. [find](https://scholar.google.com/scholar?q=George+A+Miller%2E+2003%2E+The+cognitive+revolution%3A+a+historical+perspective%2E+Trends+in+cognitive+sciences%2C+7%283%29%3A141%E2%80%93144%2E)
15. Yusuke Oda, Hiroyuki Fudaba, Graham Neubig, Hideaki Hata, Sakriani Sakti, Tomoki Toda, and Satoshi Nakamura. 2015. Learning to generate pseudo-code from source code using statistical machine translation (t). In Automated Software Engineering (ASE), 2015 30th IEEE/ACM International Conference on, pag… [find](https://scholar.google.com/scholar?q=Yusuke+Oda%2C+Hiroyuki+Fudaba%2C+Graham+Neubig%2C+Hideaki+Hata%2C+Sakriani+Sakti%2C+Tomoki+Toda%2C+and+Satoshi+Nakamura%2E+2015%2E+Learning+to+generate+pseudo%2Dcode+from+source+code+using+statistical+machine+translati)
16. F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. 2011. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:282… [find](https://scholar.google.com/scholar?q=F%2E+Pedregosa%2C+G%2E+Varoquaux%2C+A%2E+Gramfort%2C+V%2E+Michel%2C+B%2E+Thirion%2C+O%2E+Grisel%2C+M%2E+Blondel%2C+P%2E+Prettenhofer%2C+R%2E+Weiss%2C+V%2E+Dubourg%2C+J%2E+Vanderplas%2C+A%2E+Passos%2C+D%2E+Cournapeau%2C+M%2E+Brucher%2C+M%2E+Perrot%2C+and+E%2E+Duc)
17. Chris Quirk, Raymond Mooney, and Michel Galley. 2015. [Language to code: Learning semantic parsers for if-this-then-that recipes](https://md.research.elamur.ai/free/en/papers/quirk-2015-language-code-learning-semantic-parsers/). In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, pages…
18. Rico Sennrich, Orhan Firat, Kyunghyun Cho, Alexandra Birch, Barry Haddow, Julian Hitschler, Marcin Junczys-Dowmunt, Samuel Läubli, Antonio Valerio Miceli Barone, Jozef Mokry, and Maria Nadejde. 2017. [Nematus: a Toolkit for Neural Machine Translation](https://md.research.elamur.ai/free/en/papers/sennrich-2017-nematus-toolkit-neural-machine-translation/). In Proceedings of the Demonstrations at the 15th…
19. Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016a. Improving Neural Machine Translation Models with Monolingual Data. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pages 86–96, Berlin, Germany. [find](https://scholar.google.com/scholar?q=Rico+Sennrich%2C+Barry+Haddow%2C+and+Alexandra+Birch%2E+2016a%2E+Improving+Neural+Machine+Translation+Models+with+Monolingual+Data%2E+In+Proceedings+of+the+54th+Annual+Meeting+of+the+Association+for+Computation)
20. Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016b. [Neural Machine Translation of Rare Words with Subword Units](https://md.research.elamur.ai/free/en/papers/sennrich-2016-neural-machine-translation-rare-words/). In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pages 1715–1725, Berlin, Germany.
21. Pengcheng Yin and Graham Neubig. 2017. [A syntactic neural model for general-purpose code generation](https://md.research.elamur.ai/free/en/papers/yin-2017-syntactic-neural-model-general-purpose/). In The 55th Annual Meeting of the Association for Computational Linguistics (ACL), Vancouver, Canada.

*Updated 3 November 2026*
