lcpcli 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. lcpcli-0.1.1/LICENSE.txt +7 -0
  2. lcpcli-0.1.1/PKG-INFO +159 -0
  3. lcpcli-0.1.1/README.md +132 -0
  4. lcpcli-0.1.1/bin/lcpcli +3 -0
  5. lcpcli-0.1.1/corpert/_legacy_process_files/process_opensubtitles.py +533 -0
  6. lcpcli-0.1.1/corpert/_legacy_process_files/process_sparcling.py +415 -0
  7. lcpcli-0.1.1/corpert/build/lib/corpert/__init__.py +3 -0
  8. lcpcli-0.1.1/corpert/build/lib/corpert/__main__.py +10 -0
  9. lcpcli-0.1.1/corpert/build/lib/corpert/cli.py +43 -0
  10. lcpcli-0.1.1/corpert/build/lib/corpert/corpert.py +457 -0
  11. lcpcli-0.1.1/corpert/build/lib/corpert/parsers/__init__.py +0 -0
  12. lcpcli-0.1.1/corpert/build/lib/corpert/parsers/_parser.py +98 -0
  13. lcpcli-0.1.1/corpert/build/lib/corpert/parsers/conllu.py +227 -0
  14. lcpcli-0.1.1/corpert/build/lib/corpert/parsers/json.py +19 -0
  15. lcpcli-0.1.1/corpert/build/lib/corpert/parsers/tei.py +251 -0
  16. lcpcli-0.1.1/corpert/build/lib/corpert/parsers/vert.py +178 -0
  17. lcpcli-0.1.1/corpert/build/lib/corpert/utils.py +402 -0
  18. lcpcli-0.1.1/corpert/corpert/__init__.py +3 -0
  19. lcpcli-0.1.1/corpert/corpert/__main__.py +10 -0
  20. lcpcli-0.1.1/corpert/corpert/cli.py +43 -0
  21. lcpcli-0.1.1/corpert/corpert/corpert.py +478 -0
  22. lcpcli-0.1.1/corpert/corpert/lcp_corpus_template.json +164 -0
  23. lcpcli-0.1.1/corpert/corpert/parsers/__init__.py +0 -0
  24. lcpcli-0.1.1/corpert/corpert/parsers/_parser.py +467 -0
  25. lcpcli-0.1.1/corpert/corpert/parsers/conllu.py +311 -0
  26. lcpcli-0.1.1/corpert/corpert/parsers/json.py +19 -0
  27. lcpcli-0.1.1/corpert/corpert/parsers/tei.py +251 -0
  28. lcpcli-0.1.1/corpert/corpert/parsers/vert.py +178 -0
  29. lcpcli-0.1.1/corpert/corpert/utils.py +544 -0
  30. lcpcli-0.1.1/corpert/requirements.txt +5 -0
  31. lcpcli-0.1.1/corpert/setup.py +29 -0
  32. lcpcli-0.1.1/lcp-upload/build/lib/lcp_upload/__init__.py +4 -0
  33. lcpcli-0.1.1/lcp-upload/build/lib/lcp_upload/__main__.py +6 -0
  34. lcpcli-0.1.1/lcp-upload/build/lib/lcp_upload/cli.py +74 -0
  35. lcpcli-0.1.1/lcp-upload/build/lib/lcp_upload/lcp_upload.py +345 -0
  36. lcpcli-0.1.1/lcp-upload/lcp_upload/__init__.py +4 -0
  37. lcpcli-0.1.1/lcp-upload/lcp_upload/__main__.py +6 -0
  38. lcpcli-0.1.1/lcp-upload/lcp_upload/cli.py +74 -0
  39. lcpcli-0.1.1/lcp-upload/lcp_upload/lcp_upload.py +345 -0
  40. lcpcli-0.1.1/lcp-upload/requirements.txt +5 -0
  41. lcpcli-0.1.1/lcp-upload/setup.py +29 -0
  42. lcpcli-0.1.1/lcpcli/__init__.py +3 -0
  43. lcpcli-0.1.1/lcpcli/__main__.py +10 -0
  44. lcpcli-0.1.1/lcpcli/cli.py +107 -0
  45. lcpcli-0.1.1/lcpcli/lcpcli.py +75 -0
  46. lcpcli-0.1.1/lcpcli.egg-info/PKG-INFO +159 -0
  47. lcpcli-0.1.1/lcpcli.egg-info/SOURCES.txt +52 -0
  48. lcpcli-0.1.1/lcpcli.egg-info/dependency_links.txt +1 -0
  49. lcpcli-0.1.1/lcpcli.egg-info/requires.txt +10 -0
  50. lcpcli-0.1.1/lcpcli.egg-info/top_level.txt +3 -0
  51. lcpcli-0.1.1/lcpcli.egg-info/zip-safe +1 -0
  52. lcpcli-0.1.1/pyproject.toml +37 -0
  53. lcpcli-0.1.1/setup.cfg +4 -0
  54. lcpcli-0.1.1/setup.py +28 -0
@@ -0,0 +1,7 @@
1
+ Copyright 2023 Jeremy Zehr
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
lcpcli-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.1
2
+ Name: lcpcli
3
+ Version: 0.1.1
4
+ Summary: Helper for converting CONLLU files and uploading the corpus to LCP
5
+ Home-page:
6
+ Author: Jeremy Zehr and Jonathan Schaber
7
+ Author-email: Jeremy Zehr <jeremy.zehr@uzh.ch>
8
+ Project-URL: Homepage, https://gitlab.uzh.ch/LiRI/projects/lcpcli
9
+ Project-URL: Issues, https://gitlab.uzh.ch/LiRI/projects/lcpcli/-/issues
10
+ Keywords: corpus,linguistics,corpora,conll,tei,vert
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE.txt
17
+ Requires-Dist: lxml>=4.7.1
18
+ Requires-Dist: lupa>=1.13
19
+ Requires-Dist: xmltodict>=0.13
20
+ Requires-Dist: jsonpickle>=3.0
21
+ Requires-Dist: jsonschema>=4.21
22
+ Requires-Dist: requests>=2.30.0
23
+ Requires-Dist: py7zr>=0.20.5
24
+ Requires-Dist: tqdm>=4.65.0
25
+ Requires-Dist: types-tqdm>=4.65.0.1
26
+ Requires-Dist: types-requests>=2.30.0.0
27
+
28
+ # LCP CLI module
29
+
30
+ > Helper for converting CONLLU files and uploading the corpus to LCP
31
+
32
+ ## Installation
33
+
34
+ Clone this project along with its submodules:
35
+
36
+ ```bash
37
+ git clone --recurse-submodules git@gitlab.uzh.ch:LiRI/projects/lcpcli.git
38
+ ```
39
+
40
+ Make sure you have python 3.11 and pip installed in your local environment, then run:
41
+
42
+ ```bash
43
+ ./install.sh
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ Help:
49
+
50
+ ```bash
51
+ lcpcli --help
52
+ ```
53
+
54
+ ### CoNLL-U Format
55
+
56
+ The CoNLL-U format is documented at: https://universaldependencies.org/format.html
57
+
58
+ The LCP CLI converter will treat all the comments that start with `text` as document-level attributes.
59
+ 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'`
60
+
61
+ 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)
62
+
63
+ See below how to report these attributes in the template `.json` file
64
+
65
+ ### Convert and Upload
66
+
67
+ 1. Create a parent directory in which you have a child directory that contains all your properly-fromatted CONLLU files
68
+
69
+ 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:
70
+
71
+ ```
72
+ {
73
+ "meta":{
74
+ "name":"My corpus",
75
+ "author":"Myself",
76
+ "date":"2023",
77
+ "version": 1,
78
+ "corpusDescription":"This is my corpus"
79
+ },
80
+ "firstClass": {
81
+ "document": "Document",
82
+ "segment": "Segment",
83
+ "token": "Token"
84
+ },
85
+ "layer": {
86
+ "Token": {
87
+ "abstract": false,
88
+ "layerType": "unit",
89
+ "anchoring": {
90
+ "location": false,
91
+ "stream": true,
92
+ "time": false
93
+ },
94
+ "attributes": {
95
+ "form": {
96
+ "isGlobal": false,
97
+ "type": "text",
98
+ "nullable": false
99
+ },
100
+ "lemma": {
101
+ "isGlobal": false,
102
+ "type": "text",
103
+ "nullable": true
104
+ },
105
+ "upos": {
106
+ "isGlobal": true,
107
+ "type": "categorical",
108
+ "nullable": false
109
+ }
110
+ }
111
+ },
112
+ "Segment": {
113
+ "abstract": false,
114
+ "layerType": "span",
115
+ "contains": "Token",
116
+ "attributes": {
117
+ "meta": {
118
+ "key": {
119
+ "type": "text",
120
+ "nullable": true
121
+ }
122
+ }
123
+ }
124
+ },
125
+ "Document": {
126
+ "abstract": false,
127
+ "contains": "Segment",
128
+ "layerType": "span",
129
+ "attributes": {
130
+ "meta": {
131
+ "text_author": {
132
+ "type": "text",
133
+ "nullable": true
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ ```
141
+
142
+ 3. Visit LCP and create a new project if you don't already have one where your corpus should go
143
+
144
+ 4. Retrieve the API key and secret for your project by clicking on the button that says: "Create API Key"
145
+
146
+ 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)
147
+
148
+ 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)
149
+
150
+ 5. Once you have your API key and secret, you can start converting and uploading your corpus by running the following command:
151
+
152
+ ```
153
+ lcpcli -i $CONLLU_FOLDER -m upload -k $API_KEY -s $API_SECRET -p $PROJECT_NAME --live
154
+ ```
155
+
156
+ - `$CONLLU_FOLDER` should point to the folder that contains your CONLLU files (ie. **inside** the parent folder)
157
+ - `$API_KEY` is the key you copied from your project on LCP (still visible when you visit the page)
158
+ - `$API_SECRET` is the secret you copied from your project on LCP (only visible upon API Key creation)
159
+ - `$PROJECT_NAME` is the name of the project exactly as displayed on LCP -- it is case-sensitive, and space characters should be escaped
lcpcli-0.1.1/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # LCP CLI module
2
+
3
+ > Helper for converting CONLLU files and uploading the corpus to LCP
4
+
5
+ ## Installation
6
+
7
+ Clone this project along with its submodules:
8
+
9
+ ```bash
10
+ git clone --recurse-submodules git@gitlab.uzh.ch:LiRI/projects/lcpcli.git
11
+ ```
12
+
13
+ Make sure you have python 3.11 and pip installed in your local environment, then run:
14
+
15
+ ```bash
16
+ ./install.sh
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Help:
22
+
23
+ ```bash
24
+ lcpcli --help
25
+ ```
26
+
27
+ ### CoNLL-U Format
28
+
29
+ The CoNLL-U format is documented at: https://universaldependencies.org/format.html
30
+
31
+ The LCP CLI converter will treat all the comments that start with `text` as document-level attributes.
32
+ 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'`
33
+
34
+ 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)
35
+
36
+ See below how to report these attributes in the template `.json` file
37
+
38
+ ### Convert and Upload
39
+
40
+ 1. Create a parent directory in which you have a child directory that contains all your properly-fromatted CONLLU files
41
+
42
+ 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:
43
+
44
+ ```
45
+ {
46
+ "meta":{
47
+ "name":"My corpus",
48
+ "author":"Myself",
49
+ "date":"2023",
50
+ "version": 1,
51
+ "corpusDescription":"This is my corpus"
52
+ },
53
+ "firstClass": {
54
+ "document": "Document",
55
+ "segment": "Segment",
56
+ "token": "Token"
57
+ },
58
+ "layer": {
59
+ "Token": {
60
+ "abstract": false,
61
+ "layerType": "unit",
62
+ "anchoring": {
63
+ "location": false,
64
+ "stream": true,
65
+ "time": false
66
+ },
67
+ "attributes": {
68
+ "form": {
69
+ "isGlobal": false,
70
+ "type": "text",
71
+ "nullable": false
72
+ },
73
+ "lemma": {
74
+ "isGlobal": false,
75
+ "type": "text",
76
+ "nullable": true
77
+ },
78
+ "upos": {
79
+ "isGlobal": true,
80
+ "type": "categorical",
81
+ "nullable": false
82
+ }
83
+ }
84
+ },
85
+ "Segment": {
86
+ "abstract": false,
87
+ "layerType": "span",
88
+ "contains": "Token",
89
+ "attributes": {
90
+ "meta": {
91
+ "key": {
92
+ "type": "text",
93
+ "nullable": true
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "Document": {
99
+ "abstract": false,
100
+ "contains": "Segment",
101
+ "layerType": "span",
102
+ "attributes": {
103
+ "meta": {
104
+ "text_author": {
105
+ "type": "text",
106
+ "nullable": true
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ 3. Visit LCP and create a new project if you don't already have one where your corpus should go
116
+
117
+ 4. Retrieve the API key and secret for your project by clicking on the button that says: "Create API Key"
118
+
119
+ 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)
120
+
121
+ 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)
122
+
123
+ 5. Once you have your API key and secret, you can start converting and uploading your corpus by running the following command:
124
+
125
+ ```
126
+ lcpcli -i $CONLLU_FOLDER -m upload -k $API_KEY -s $API_SECRET -p $PROJECT_NAME --live
127
+ ```
128
+
129
+ - `$CONLLU_FOLDER` should point to the folder that contains your CONLLU files (ie. **inside** the parent folder)
130
+ - `$API_KEY` is the key you copied from your project on LCP (still visible when you visit the page)
131
+ - `$API_SECRET` is the secret you copied from your project on LCP (only visible upon API Key creation)
132
+ - `$PROJECT_NAME` is the name of the project exactly as displayed on LCP -- it is case-sensitive, and space characters should be escaped
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ python -m lcpcli $@