Skip to content

Commit

Permalink
Merge branch 'master' into nert-server2
Browse files Browse the repository at this point in the history
  • Loading branch information
nschneid committed Aug 19, 2020
2 parents 24e13ef + 3a1e97e commit 28ea017
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 21 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,29 +100,29 @@ It comes with a prepopulated SQLite database.

We use the library django-import-export for loading new models when there are too many to create by hand. Developers can follow the following procedure to load a new corpus into the database.

- On the homepage, click the language you are working with and then click metadata (You may first need to create the Language object if it doesn't exist. In this case, click metadata on the homepage). Click `Create a Corpus` and fill out the form.
- The corpus you want to import must be in the STREUSLE json format. Place it in the directory `<Xposition>/scripts`.
- On the webpage, click the language you are working with and then click metadata (You may first need to create the Language object if it doesn't exist. In this case, click metadata on the homepage). Click `Create a Corpus` and fill out the form.
- The corpus you want to import must be in the STREUSLE json format. Place it in the directory `<Xposition>/xposition/scripts`.
- Modify the top of the file `new_corpus.py` so that the constants `LANGUAGE`, `CORPUS`, etc. are correct.
- Go to the xposition directory: `cd <Xposition>\xposition`
- Go to the xposition directory: `cd <Xposition>/xposition`
- Import new supersenses and adpositions:
- Run `python manage.py shell` and then type `exec(open(r'..\scripts\generate_basic_files.py').read())`. This will create json files for all supersenses and adpositions in the corpus and it will place them in `<Xposition>/scripts/<corpus><version>_files`.
- You can then import new supersenses and adpositions through the admin interface on the webpage at `<homepage_url>/admin`, by clicking `Supersense revisions` or `Adposition revisions`, Import, and then choose the corresponding file from `<Xposition>/scripts/<corpus><version>_files`.
- Run `python manage.py shell` and then type `from scripts.generate_basic_files import main; main()`. This will create json files for all supersenses and adpositions in the corpus and it will place them in `<Xposition>/xposition/scripts/<corpus><version>_files`.
- You can then import new supersenses and adpositions through the admin interface on the webpage at `<homepage_url>/admin`, by clicking `Supersense revisions` or `Adposition revisions`, Import, and then choose the corresponding file from `<Xposition>/xposition/scripts/<corpus><version>_files`.
- Import new construals:
- Run `python manage.py shell` and then type `exec(open(r'..\scripts\generate_construal_file.py').read())`. This will create a json file for all construals in the corpus.
- You can then import new construals through the admin interface on the webpage at `<homepage_url>/admin`, by clicking `Construals`, Import, and then choose the corresponding file from `<Xposition>/scripts/<corpus><version>_files`.
- Run `python manage.py shell` and then type `from scripts.generate_construal_file import main; main()`. This will create a json file for all construals in the corpus.
- You can then import new construals through the admin interface on the webpage at `<homepage_url>/admin`, by clicking `Construals`, Import, and then choose the corresponding file from `<Xposition>/xposition/scripts/<corpus><version>_files`.
- Note: Construals depend on supersenses, so if there are any supersenses missing from the database, you may get a 'Missing Supersense' error.
- Import new usages:
- Run `python manage.py shell` and then type `exec(open(r'..\scripts\generate_usage_file.py').read())`. This will create a json file for all usages in the corpus.
- You can then import new usages through the admin interface on the webpage at `<homepage_url>/admin`, by clicking `Usage revisions`, Import, and then choose the corresponding file from `<Xposition>/scripts/<corpus><version>_files`.
- Run `python manage.py shell` and then type `from scripts.generate_usage_file import main; main()`. This will create a json file for all usages in the corpus.
- You can then import new usages through the admin interface on the webpage at `<homepage_url>/admin`, by clicking `Usage revisions`, Import, and then choose the corresponding file from `<Xposition>/xposition/scripts/<corpus><version>_files`.
- Note: Usages depend on construals and adpositions, so if there are any construals or adpositions missing from the database, you may get a 'Missing' error.
- Import new sentences and ptoken_annotations:
- Run `python manage.py shell` and then type `exec(open(r'..\scripts\generate_corpus_files.py').read())`. This will create tsv files for all CorpusSentences and PTokenAnnotations in the corpus.
- You can then import them through the admin interface on the webpage at `<homepage_url>/admin`, by clicking `Corpus sentences` or `Adposition token annotations`, Import, and then choose the corresponding file from `<Xposition>/scripts/<corpus><version>_files`. Adposition token annotations will be divided into multiple files labelled `ptoken_annotations0.tsv`, `ptoken_annotations1.tsv`, etc.
- Run `python manage.py shell` and then type `from scripts.generate_corpus_files import main; main()`. This will create a tsv file for all CorpusSentences and PTokenAnnotations in the corpus.
- You can then import them through the admin interface on the webpage at `<homepage_url>/admin`, by clicking `Corpus sentences` or `Adposition token annotations`, Import, and then choose the corresponding file from `<Xposition>/xposition/scripts/<corpus><version>_files`. Adposition token annotations will be divided into multiple files labelled `ptoken_annotations0.tsv`, `ptoken_annotations1.tsv`, etc.
- Note: PTokenAnnotations depend on usages and adpositions, so if there are any usages or adpositions missing from the database, you may get a 'Missing' error.
- If you are importing a new version of an existing Corpus, please mark any older versions of the Corpus as deprecated, so that annotations from older versions will be hidden by default. Go to the corpus page and in the table titled "Metdata", click the edit button and check the box for "Is this a deprecated version of an existing Corpus".
- If you are importing a new version of an existing Corpus, please mark any older versions of the Corpus as deprecated, so that annotations from older versions will be hidden by default. Go to the corpus page and in the table titled "Metadata", click the edit button and check the box for "Is this a deprecated version of an existing Corpus".

# Credits

* Project leader: [Nathan Schneider](http://nathan.cl) (Georgetown)
* Xposition software development: Max Kim, Joseph Ledford (Georgetown)
* Xposition software development: Max Kim, Joseph Ledford, Austin Blodgett, Luke Gessler (Georgetown)
* Other collaborators/contributors: TODO/see PrepWiki
File renamed without changes.
Empty file added xposition/scripts/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os, json

os.chdir('../scripts')
from new_corpus import Data
os.chdir('scripts')
from .new_corpus import Data


def main():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json
import os

os.chdir('../scripts')
from new_corpus import Data
os.chdir('scripts')
from .new_corpus import Data

def main():
data = Data(missing_ss_error=True, save_con=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from unidecode import unidecode

os.chdir('../scripts')
from new_corpus import Data
os.chdir('scripts')
from .new_corpus import Data


class TSV_Writer:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import json
import os

os.chdir('../scripts')
from new_corpus import Data
os.chdir('scripts')
from .new_corpus import Data



Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 28ea017

Please sign in to comment.