diff --git a/convert-anystyle-data/tei-to-biblstruct-gs.ipynb b/convert-anystyle-data/tei-to-biblstruct-gs.ipynb index 3f9c179f5186f1ae3358b0212e7fab8fb6447c24..839846dde2ce58646c429033fc4327cb16e3c86c 100644 --- a/convert-anystyle-data/tei-to-biblstruct-gs.ipynb +++ b/convert-anystyle-data/tei-to-biblstruct-gs.ipynb @@ -59,7 +59,9 @@ { "metadata": {}, "cell_type": "markdown", - "source": "We first need to add an identifier to each `<bibl>` element so that the corresponding `<biblStruct>` element can be found", + "source": [ + "We first need to add an identifier to each `<bibl>` element so that the corresponding `<biblStruct>` element can be found" + ], "id": "3bb25cf372bf9e66" }, { diff --git a/convert-anystyle-data/tei-to-gold.ipynb b/convert-anystyle-data/tei-to-gold.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..adeed2e9a2838e6ee026d58c4f3425ee2de8ff67 --- /dev/null +++ b/convert-anystyle-data/tei-to-gold.ipynb @@ -0,0 +1,99 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Translate TEI/bibl to final gold standard schema\n" + ], + "metadata": { + "collapsed": false + }, + "id": "a7894c78ec06bd10" + }, + { + "cell_type": "code", + "execution_count": 14, + "outputs": [ + { + "data": { + "text/plain": "'3 See R. Goff, ‘The Search for Principle’ (1983) Proceeedings of the British Academy 169, at 171. This is an\\n amplification of Dicey’s remark that ‘[b]y adequate study and careful thought whole departments of law can .\\n . . be reduced to order and exhibited under the form of a few principles which sum up the effect of a\\n hundred cases . . .’. A. Dicey, Can English Law be taught at the Universities? (1883) 20.'" + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from lxml import etree\n", + "tree = etree.parse('./schema/gold_standard.xml')\n", + "input_formatted = tree.find(\".//input[@type='formatted']\")\n", + "etree.tounicode(input_formatted, method='text').strip()" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-10-08T11:18:49.880708500Z", + "start_time": "2024-10-08T11:18:49.873127500Z" + } + }, + "id": "78f4e23b884790d" + }, + { + "cell_type": "code", + "execution_count": 13, + "outputs": [ + { + "data": { + "text/plain": "'3 See R. Goff, ‘The Search for Principle’ (1983) Proceeedings of the British Academy 169, at 171. This is an amplification of Dicey’s remark that ‘[b]y adequate study and careful thought whole departments of law can . . . be reduced to order and exhibited under the form of a few principles which sum up the effect of a hundred cases . . .’. A. Dicey, Can English Law be taught at the Universities? (1883) 20.'" + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "input_raw = tree.find(\".//input[@type='raw']\")\n", + "etree.tounicode(input_raw, method='text').strip()" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-10-08T11:18:42.693696400Z", + "start_time": "2024-10-08T11:18:42.668273100Z" + } + }, + "id": "cfb51a0fd0603503" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + }, + "id": "897eaa6d13d1a498" + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}