Skip to content

Commit

Permalink
simplify usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mam10eks committed Nov 13, 2024
1 parent 63a6a3b commit 084c9c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ We also include tools that ease uploading pooled documents and downloading relev
5. Prepare the relevance judgments in Doccano like so:

```shell
teaching-ir prepare-relevance-judgments project-prefix /path/to/pool1.jsonl /path/to/pool2.jsonl ...
teaching-ir prepare-relevance-judgments --doccano-url https://doccano.web.webis.de/ --doccano-username admin --doccano-password <PASSWORD> project-prefix data/<YOUR-COURSE>/
```

6. All teams can now work on their relevance judgments.
Expand Down
20 changes: 9 additions & 11 deletions cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,17 @@ def _generate_password(length: int = 10) -> str:
type=str,
)
@argument(
"pooled_documents_paths",
"project_directory",
type=PathType(
exists=True,
file_okay=True,
dir_okay=False,
writable=False,
file_okay=False,
dir_okay=True,
readable=True,
resolve_path=True,
allow_dash=False,
path_type=Path,
),
nargs=-1,
nargs=1,
)
def prepare_relevance_judgments(
doccano_url: str,
Expand All @@ -177,10 +176,10 @@ def prepare_relevance_judgments(
guidelines_path: Path | None,
extra_supervisors: Sequence[str],
prefix: str,
pooled_documents_paths: Sequence[Path],
project_directory: Path,
) -> None:
"""
Prepare the relevance judgments on Doccano for pooled documents from JSON Lines files specified in POOLED_DOCUMENTS_PATHS.
Prepare the relevance judgments on Doccano for pooled documents from JSON Lines files specified in PROJECT_DIRECTORY/doccano-judgment-pool.jsonl.
This script will automatically create users and projects, and upload the pooled documents for each group.
PREFIX is the common prefix of the generated project and user names.
"""
Expand All @@ -197,9 +196,8 @@ def prepare_relevance_judgments(
guidelines = files("cli").joinpath(
"guidelines.md").read_text()

if len(pooled_documents_paths) == 0:
return

pooled_documents_paths = [project_directory / 'doccano-judgment-pool.jsonl']
print(pooled_documents_paths)
doccano = DoccanoClient(doccano_url)
doccano.login(
username=doccano_username,
Expand All @@ -209,7 +207,7 @@ def prepare_relevance_judgments(

pool = concat(
read_json(
path,
open(path, 'r'),
lines=True,
dtype={
"group": str,
Expand Down

0 comments on commit 084c9c0

Please sign in to comment.