lcpcli


Namelcpcli JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryHelper for converting CONLLU files and uploading the corpus to LCP
upload_time2024-03-19 10:43:03
maintainer
docs_urlNone
authorJeremy Zehr and Jonathan Schaber
requires_python>=3.8
license
keywords corpus linguistics corpora conll tei vert
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LCP CLI module

> Helper for converting CONLLU files and uploading the corpus to LCP

## Installation

Clone this project along with its submodules:

```bash
git clone --recurse-submodules git@gitlab.uzh.ch:LiRI/projects/lcpcli.git
```

Make sure you have python 3.11 and pip installed in your local environment, then run:

```bash
./install.sh
```

## Usage

Help:

```bash
lcpcli --help
```

### CoNLL-U Format

The CoNLL-U format is documented at: https://universaldependencies.org/format.html

The LCP CLI converter will treat all the comments that start with `text` as document-level attributes. 
This means that if a CoNLL-U file contains the line `# text_author = John Doe`, then in LCP all the sentences from this file will be associated with a document whose `meta` attribute will contain `text_author: 'John Doe'`

All other comment lines following the format `# key = value` will add an entry to the `meta` attribute of the _segment_ corresponding to the sentence below that line (ie not at the document level) 

See below how to report these attributes in the template `.json` file

### Convert and Upload

1. Create a parent directory in which you have a child directory that contains all your properly-fromatted CONLLU files

2. In the **parent** directory, next to the folder containing the CONLLU files, create a template `.json` file that describes your corpus structure (see above about the `attributes` key on `Document` and `Segment`), for example:

```
{
    "meta":{
        "name":"My corpus",
        "author":"Myself",
        "date":"2023",
        "version": 1,
        "corpusDescription":"This is my corpus"
    },
    "firstClass": {
        "document": "Document",
        "segment": "Segment",
        "token": "Token"
    },
    "layer": {
        "Token": {
            "abstract": false,
            "layerType": "unit",
            "anchoring": {
                "location": false,
                "stream": true,
                "time": false
            },
            "attributes": {
                "form": {
                    "isGlobal": false,
                    "type": "text",
                    "nullable": false
                },
                "lemma": {
                    "isGlobal": false,
                    "type": "text",
                    "nullable": true
                },
                "upos": {
                    "isGlobal": true,
                    "type": "categorical",
                    "nullable": false
                }
            }
        },
        "Segment": {
            "abstract": false,
            "layerType": "span",
            "contains": "Token",
            "attributes": {
                "meta": {
                    "key": {
                      "type": "text",
                      "nullable": true
                    }
                }
            }
        },
        "Document": {
            "abstract": false,
            "contains": "Segment",
            "layerType": "span",
            "attributes": {
                "meta": {
                    "text_author": {
                      "type": "text",
                      "nullable": true
                    }
                }
            }
        }
    }
}
```

3. Visit LCP and create a new project if you don't already have one where your corpus should go

4. Retrieve the API key and secret for your project by clicking on the button that says: "Create API Key"

    The secret will appear at the bottom of the page and remain visible only for 120s, after which it will disappear forever (you would then need to revoke the API key and create a new one)
    
    The key itself is listed above the button that says "Revoke API key" (make sure to **not** copy the line that starts with "Secret Key" along with the API key itself)

5. Once you have your API key and secret, you can start converting and uploading your corpus by running the following command:

```
lcpcli -i $CONLLU_FOLDER -m upload -k $API_KEY -s $API_SECRET -p $PROJECT_NAME --live
```

- `$CONLLU_FOLDER` should point to the folder that contains your CONLLU files (ie. **inside** the parent folder)
- `$API_KEY` is the key you copied from your project on LCP (still visible when you visit the page)
- `$API_SECRET` is the secret you copied from your project on LCP (only visible upon API Key creation)
- `$PROJECT_NAME` is the name of the project exactly as displayed on LCP -- it is case-sensitive, and space characters should be escaped

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "lcpcli",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "corpus,linguistics,corpora,conll,tei,vert",
    "author": "Jeremy Zehr and Jonathan Schaber",
    "author_email": "Jeremy Zehr <jeremy.zehr@uzh.ch>",
    "download_url": "https://files.pythonhosted.org/packages/16/a0/831cc043451366958b74b9b173ce4b7774e35a6e7fa94601c149d9a68438/lcpcli-0.1.1.tar.gz",
    "platform": null,
    "description": "# LCP CLI module\n\n> Helper for converting CONLLU files and uploading the corpus to LCP\n\n## Installation\n\nClone this project along with its submodules:\n\n```bash\ngit clone --recurse-submodules git@gitlab.uzh.ch:LiRI/projects/lcpcli.git\n```\n\nMake sure you have python 3.11 and pip installed in your local environment, then run:\n\n```bash\n./install.sh\n```\n\n## Usage\n\nHelp:\n\n```bash\nlcpcli --help\n```\n\n### CoNLL-U Format\n\nThe CoNLL-U format is documented at: https://universaldependencies.org/format.html\n\nThe LCP CLI converter will treat all the comments that start with `text` as document-level attributes. \nThis means that if a CoNLL-U file contains the line `# text_author = John Doe`, then in LCP all the sentences from this file will be associated with a document whose `meta` attribute will contain `text_author: 'John Doe'`\n\nAll other comment lines following the format `# key = value` will add an entry to the `meta` attribute of the _segment_ corresponding to the sentence below that line (ie not at the document level) \n\nSee below how to report these attributes in the template `.json` file\n\n### Convert and Upload\n\n1. Create a parent directory in which you have a child directory that contains all your properly-fromatted CONLLU files\n\n2. In the **parent** directory, next to the folder containing the CONLLU files, create a template `.json` file that describes your corpus structure (see above about the `attributes` key on `Document` and `Segment`), for example:\n\n```\n{\n    \"meta\":{\n        \"name\":\"My corpus\",\n        \"author\":\"Myself\",\n        \"date\":\"2023\",\n        \"version\": 1,\n        \"corpusDescription\":\"This is my corpus\"\n    },\n    \"firstClass\": {\n        \"document\": \"Document\",\n        \"segment\": \"Segment\",\n        \"token\": \"Token\"\n    },\n    \"layer\": {\n        \"Token\": {\n            \"abstract\": false,\n            \"layerType\": \"unit\",\n            \"anchoring\": {\n                \"location\": false,\n                \"stream\": true,\n                \"time\": false\n            },\n            \"attributes\": {\n                \"form\": {\n                    \"isGlobal\": false,\n                    \"type\": \"text\",\n                    \"nullable\": false\n                },\n                \"lemma\": {\n                    \"isGlobal\": false,\n                    \"type\": \"text\",\n                    \"nullable\": true\n                },\n                \"upos\": {\n                    \"isGlobal\": true,\n                    \"type\": \"categorical\",\n                    \"nullable\": false\n                }\n            }\n        },\n        \"Segment\": {\n            \"abstract\": false,\n            \"layerType\": \"span\",\n            \"contains\": \"Token\",\n            \"attributes\": {\n                \"meta\": {\n                    \"key\": {\n                      \"type\": \"text\",\n                      \"nullable\": true\n                    }\n                }\n            }\n        },\n        \"Document\": {\n            \"abstract\": false,\n            \"contains\": \"Segment\",\n            \"layerType\": \"span\",\n            \"attributes\": {\n                \"meta\": {\n                    \"text_author\": {\n                      \"type\": \"text\",\n                      \"nullable\": true\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\n3. Visit LCP and create a new project if you don't already have one where your corpus should go\n\n4. Retrieve the API key and secret for your project by clicking on the button that says: \"Create API Key\"\n\n    The secret will appear at the bottom of the page and remain visible only for 120s, after which it will disappear forever (you would then need to revoke the API key and create a new one)\n    \n    The key itself is listed above the button that says \"Revoke API key\" (make sure to **not** copy the line that starts with \"Secret Key\" along with the API key itself)\n\n5. Once you have your API key and secret, you can start converting and uploading your corpus by running the following command:\n\n```\nlcpcli -i $CONLLU_FOLDER -m upload -k $API_KEY -s $API_SECRET -p $PROJECT_NAME --live\n```\n\n- `$CONLLU_FOLDER` should point to the folder that contains your CONLLU files (ie. **inside** the parent folder)\n- `$API_KEY` is the key you copied from your project on LCP (still visible when you visit the page)\n- `$API_SECRET` is the secret you copied from your project on LCP (only visible upon API Key creation)\n- `$PROJECT_NAME` is the name of the project exactly as displayed on LCP -- it is case-sensitive, and space characters should be escaped\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Helper for converting CONLLU files and uploading the corpus to LCP",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://gitlab.uzh.ch/LiRI/projects/lcpcli",
        "Issues": "https://gitlab.uzh.ch/LiRI/projects/lcpcli/-/issues"
    },
    "split_keywords": [
        "corpus",
        "linguistics",
        "corpora",
        "conll",
        "tei",
        "vert"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0592351402fe1303d29edc40c16e411b1b0053a510d9254edcecec812696b93a",
                "md5": "59eb1006cc0523febaf158d2968dedac",
                "sha256": "297812b54a6217e3b07d6aca3095d20e4a2a7c2974a6858c2f791597c2d5c2fa"
            },
            "downloads": -1,
            "filename": "lcpcli-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "59eb1006cc0523febaf158d2968dedac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 37126,
            "upload_time": "2024-03-19T10:43:01",
            "upload_time_iso_8601": "2024-03-19T10:43:01.971484Z",
            "url": "https://files.pythonhosted.org/packages/05/92/351402fe1303d29edc40c16e411b1b0053a510d9254edcecec812696b93a/lcpcli-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16a0831cc043451366958b74b9b173ce4b7774e35a6e7fa94601c149d9a68438",
                "md5": "23f18373d6ea891ec945588573a737c1",
                "sha256": "bbdd1869788df6bd8f1bc3f6472b619fce1f192802d3dec72d98eb30b76f0c4d"
            },
            "downloads": -1,
            "filename": "lcpcli-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "23f18373d6ea891ec945588573a737c1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 55810,
            "upload_time": "2024-03-19T10:43:03",
            "upload_time_iso_8601": "2024-03-19T10:43:03.928580Z",
            "url": "https://files.pythonhosted.org/packages/16/a0/831cc043451366958b74b9b173ce4b7774e35a6e7fa94601c149d9a68438/lcpcli-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-19 10:43:03",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "lcpcli"
}
        
Elapsed time: 0.20553s