Skip to content

Commit

Permalink
Spelling out names of packages and modules
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperFyhn committed Oct 30, 2023
1 parent 433e94e commit 1147504
Show file tree
Hide file tree
Showing 48 changed files with 37 additions and 36 deletions.
12 changes: 6 additions & 6 deletions docs/tutorials/overview.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{
"data": {
"text/plain": [
"<conspiracies.docproc.coref.coref_comp.CoreferenceComponent at 0x7fc7dad4f580>"
"<conspiracies.docprocessing.coref.coref_comp.CoreferenceComponent at 0x7fc7dad4f580>"
]
},
"execution_count": 1,
Expand All @@ -49,7 +49,7 @@
"source": [
"import spacy\n",
"from spacy.tokens import Span\n",
"from conspiracies.docproc.coref import CoreferenceComponent\n",
"from conspiracies.docprocessing.coref import CoreferenceComponent\n",
"\n",
"nlp = spacy.blank(\"da\")\n",
"nlp.add_pipe(\"sentencizer\")\n",
Expand Down Expand Up @@ -159,7 +159,7 @@
],
"source": [
"import spacy\n",
"from conspiracies.docproc.headwordextraction.headwordextraction_comp import contains_ents\n",
"from conspiracies.docprocessing.headwordextraction.headwordextraction_comp import contains_ents\n",
"\n",
"nlp = spacy.load(\"en_core_web_sm\")\n",
"nlp.add_pipe(\n",
Expand Down Expand Up @@ -209,7 +209,7 @@
"tokenizer = AutoTokenizer.from_pretrained(tokenizer_name)\n",
"\n",
"# An example with a very long text\n",
"from conspiracies.preproc.wordpiece_length_normalization import wordpiece_length_normalization\n",
"from conspiracies.preprocessing.wordpiece_length_normalization import wordpiece_length_normalization\n",
"\n",
"long_text = [\"Hej mit navn er Kenneth. \" * 200]\n",
"normalized_text = wordpiece_length_normalization(\n",
Expand Down Expand Up @@ -282,7 +282,7 @@
}
],
"source": [
"from conspiracies.docproc.relationextraction import SpacyRelationExtractor\n",
"from conspiracies.docprocessing.relationextraction import SpacyRelationExtractor\n",
"import spacy\n",
"\n",
"\n",
Expand Down Expand Up @@ -339,7 +339,7 @@
}
],
"source": [
"from conspiracies.docproc.relationextraction import KnowledgeTriplets\n",
"from conspiracies.docprocessing.relationextraction import KnowledgeTriplets\n",
"\n",
"\n",
"test_sents = [\n",
Expand Down
2 changes: 1 addition & 1 deletion paper/extract_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import re
from typing import List, Tuple
from spacy.tokens import Doc
from conspiracies.docproc.relationextraction.gptprompting.data_classes import (
from conspiracies.docprocessing.relationextraction.gptprompting.data_classes import (
DocTriplets,
)

Expand Down
2 changes: 1 addition & 1 deletion paper/extract_triplets_tweets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from data import load_gold_triplets
import spacy
from extract_examples import extract_examples
from conspiracies.docproc.relationextraction import (
from conspiracies.docprocessing.relationextraction import (
MarkdownPromptTemplate2,
PromptTemplate,
)
Expand Down
2 changes: 1 addition & 1 deletion paper/src/ents_heads_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import spacy

from relationextraction import SpacyRelationExtractor # noqa
from conspiracies.docproc.headwordextraction import contains_ents
from conspiracies.docprocessing.headwordextraction import contains_ents


def main():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ content-type = "text/markdown"


[project.entry-points.spacy_factories]
"conspiracies/docproc/relationextraction/gptprompting" = "conspiracies.docproc.relationextraction.gptprompting:create_prompt_relation_extraction_component"
"conspiracies/docproc/relationextraction/gptprompting" = "conspiracies.docprocessing.relationextraction.gptprompting:create_prompt_relation_extraction_component"


[build-system]
Expand Down
5 changes: 4 additions & 1 deletion src/conspiracies/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
from .registry import registry # noqa F401
from conspiracies.docproc.doc_utils import docs_from_jsonl, docs_to_jsonl # noqa F401
from conspiracies.docprocessing.doc_utils import (
docs_from_jsonl, # noqa F401
docs_to_jsonl, # noqa F401
)
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions src/conspiracies/docproc/coref/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/conspiracies/docproc/relationextraction/__init__.py

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions src/conspiracies/docprocessing/coref/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .coref_model import CoreferenceModel # noqa
from .coref_component import CoreferenceComponent, create_coref_component # noqa
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from spacy.tokens import Doc, Span
from spacy.util import minibatch

from conspiracies.docproc.coref import CoreferenceModel
from conspiracies.docprocessing.coref import CoreferenceModel


class CoreferenceComponent(TrainablePipe):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# required for reading an archive using the "coref"
from allennlp_models.coref.dataset_readers.conll import ConllCorefReader # noqa

from conspiracies.docproc.modeldownload import download_model
from conspiracies.docprocessing.modeldownload import download_model


@Predictor.register("coreference_resolution_v1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from spacy.language import Language
from spacy.tokens import Doc

from conspiracies.docproc.relationextraction.gptprompting import (
from conspiracies.docprocessing.relationextraction.gptprompting import (
DocTriplets,
SpanTriplet,
)
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/conspiracies/docprocessing/relationextraction/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .multi2oie.knowledge_triplets import KnowledgeTriplets # noqa F401
from .multi2oie.multi2oie_component import SpacyRelationExtractor # noqa F401
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
chatGPTPromptTemplate,
)

from .prompt_relation_comp import ( # noqa F401
from .prompt_relation_component import ( # noqa F401
create_prompt_relation_extraction_component,
score_open_relations,
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from conspiracies.registry import registry
from spacy.tokens import Doc

from conspiracies.docproc.relationextraction.gptprompting.prompt_templates import (
from conspiracies.docprocessing.relationextraction.gptprompting import (
PromptTemplate,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .knowledge_triplets import KnowledgeTriplets # noqa F401
from .multi2oie_component import SpacyRelationExtractor # noqa F401
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_coref_comp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from spacy.tokens import Span

from conspiracies.docproc.coref import CoreferenceComponent # noqa F401
from conspiracies.docprocessing.coref import CoreferenceComponent # noqa F401

from .utils import nlp_da, nlp_da_w_coref # noqa F401

Expand Down
2 changes: 1 addition & 1 deletion tests/test_coref_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .utils import nlp_da # noqa

from conspiracies.docproc.coref import CoreferenceModel
from conspiracies.docprocessing.coref import CoreferenceModel


def test_CoreferenceModel(nlp_da): # noqa
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data/prompt_data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List

import spacy
from conspiracies.docproc.relationextraction.gptprompting import (
from conspiracies.docprocessing.relationextraction.gptprompting import (
DocTriplets,
SpanTriplet,
StringTriplet,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ents_filter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import spacy
from spacy.tokens import Doc, Span

from conspiracies.docproc.headwordextraction.headwordextraction_comp import (
from conspiracies.docprocessing.headwordextraction.headwordextraction_component import (
contains_ents,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_prompt_data_classes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import spacy
from conspiracies.docproc.relationextraction.gptprompting import (
from conspiracies.docprocessing.relationextraction.gptprompting import (
DocTriplets,
SpanTriplet,
StringTriplet,
Expand Down
6 changes: 2 additions & 4 deletions tests/test_prompt_relation_evaluate.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import numpy as np
from conspiracies.docproc.relationextraction.gptprompting import (
from conspiracies.docprocessing.relationextraction.gptprompting import (
DocTriplets,
score_open_relations,
)
from spacy.training import Example

from conspiracies.docproc.relationextraction.gptprompting.prompt_relation_comp import (
score_open_relations,
)
from .utils import docs_with_triplets # noqa F401


Expand Down
2 changes: 1 addition & 1 deletion tests/test_prompt_relationextraction_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from confection import registry
from conspiracies.docproc.relationextraction.gptprompting import (
from conspiracies.docprocessing.relationextraction.gptprompting import (
SpanTriplet,
StringTriplet,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_prompt_template_create_prompt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from conspiracies.docproc.relationextraction.gptprompting.prompt_templates import (
from conspiracies.docprocessing.relationextraction.gptprompting import (
MarkdownPromptTemplate1,
MarkdownPromptTemplate2,
PromptTemplate1,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_prompt_template_parse_prompt.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from conspiracies.docproc.relationextraction.gptprompting.prompt_templates import (
from conspiracies.docprocessing.relationextraction.gptprompting import (
MarkdownPromptTemplate1,
MarkdownPromptTemplate2,
PromptTemplate1,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
import spacy
from conspiracies import docs_from_jsonl, docs_to_jsonl
from conspiracies.docproc.relationextraction.gptprompting import (
from conspiracies.docprocessing.relationextraction.gptprompting import (
DocTriplets,
SpanTriplet,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wp_length_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .utils import nlp_da # noqa

from conspiracies.preproc.wordpiece_length_normalization import (
from conspiracies.preprocessing.wordpiece_length_normalization import (
wordpiece_length_normalization,
)
from transformers import AutoTokenizer
Expand Down

0 comments on commit 1147504

Please sign in to comment.