Skip to content

Commit

Permalink
#31 related refactoring. Scripts were moved.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r committed Apr 13, 2022
1 parent 6d2bba4 commit 737e8b3
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ python3.6 download.py
python standalone.py
```

Usage: proceed with the `examples` folder.

# Inference

Infer sentiment attitudes from a mass-media document(s).

Using the `BERT` fine-tuned model version:
```bash
python3.6 run_infer_bert.py --from-files data/texts-inosmi-rus/e1.txt \
python3.6 infer_texts_bert.py --from-files data/texts-inosmi-rus/e1.txt \
--labels-count 3 \
--terms-per-context 50 \
--tokens-per-context 128 \
Expand All @@ -55,7 +57,7 @@ python3.6 run_infer_bert.py --from-files data/texts-inosmi-rus/e1.txt \

Using the pretrained `PCNN` model (including frames annotation):
```bash
python3.6 run_infer_nn.py --from-files data/texts-inosmi-rus/e1.txt \
python3.6 infer_texts_nn.py --from-files data/texts-inosmi-rus/e1.txt \
--model-name pcnn \
--model-state-dir models/ \
--terms-per-context 50 \
Expand All @@ -79,7 +81,7 @@ python3.6 run_infer_nn.py --from-files data/texts-inosmi-rus/e1.txt \

For the `BERT` model:
```bash
python3.6 run_serialize_bert.py --from-files data/texts-inosmi-rus/e1.txt
python3.6 serialize_texts_bert.py --from-files data/texts-inosmi-rus/e1.txt
--entities-parser bert-ontonotes \
--terms-per-context 50
```
Expand All @@ -90,7 +92,7 @@ python3.6 run_serialize_bert.py --from-files data/texts-inosmi-rus/e1.txt

For the other neural networks (including embedding and other features):
```bash
python3.6 run_serialize_nn.py --from-files data/texts-inosmi-rus/e1.txt \
python3.6 serialize_texts_nn.py --from-files data/texts-inosmi-rus/e1.txt \
--entities-parser bert-ontonotes \
--stemmer mystem \
--terms-per-context 50 \
Expand Down
2 changes: 1 addition & 1 deletion arelight/text/ner_ontonotes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import importlib

from src.text.ner_base import BaseNER
from arelight.text.ner_base import BaseNER


class BertOntonotesNER(BaseNER):
Expand Down
3 changes: 1 addition & 2 deletions arelight/text/pipeline_entities_bert_ontonotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from arekit.common.news.objects_parser import SentenceObjectsParserPipelineItem
from arekit.common.text.partitioning.terms import TermsPartitioning
from arekit.processing.entities.obj_desc import NerObjectDescriptor

from src.text.ner_ontonotes import BertOntonotesNER
from arelight.text.ner_ontonotes import BertOntonotesNER


class BertOntonotesNERPipelineItem(SentenceObjectsParserPipelineItem):
Expand Down
3 changes: 3 additions & 0 deletions examples/args/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from arekit.contrib.source.rusentrel.io_utils import RuSentRelVersions
from arekit.contrib.source.rusentrel.utils import iter_synonym_groups
from arekit.processing.lemmatization.mystem import MystemWrapper
from arelight.text.pipeline_entities_bert_ontonotes import BertOntonotesNERPipelineItem

from arelight.text.pipeline_entities_default import TextEntitiesParser

from examples.args.base import BaseArg

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

0 comments on commit 737e8b3

Please sign in to comment.