arekit 0.24.0__py3-none-any.whl
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.
- arekit/__init__.py +0 -0
- arekit/common/__init__.py +0 -0
- arekit/common/bound.py +48 -0
- arekit/common/context/__init__.py +0 -0
- arekit/common/context/terms_mapper.py +51 -0
- arekit/common/context/token.py +16 -0
- arekit/common/data/__init__.py +0 -0
- arekit/common/data/const.py +21 -0
- arekit/common/data/doc_provider.py +6 -0
- arekit/common/data/input/__init__.py +0 -0
- arekit/common/data/input/providers/__init__.py +0 -0
- arekit/common/data/input/providers/columns/__init__.py +0 -0
- arekit/common/data/input/providers/columns/base.py +9 -0
- arekit/common/data/input/providers/columns/sample.py +59 -0
- arekit/common/data/input/providers/const.py +3 -0
- arekit/common/data/input/providers/contents.py +9 -0
- arekit/common/data/input/providers/instances/__init__.py +0 -0
- arekit/common/data/input/providers/instances/base.py +14 -0
- arekit/common/data/input/providers/instances/multiple.py +27 -0
- arekit/common/data/input/providers/instances/single.py +8 -0
- arekit/common/data/input/providers/label/__init__.py +0 -0
- arekit/common/data/input/providers/label/base.py +24 -0
- arekit/common/data/input/providers/label/binary.py +11 -0
- arekit/common/data/input/providers/label/multiple.py +15 -0
- arekit/common/data/input/providers/rows/__init__.py +0 -0
- arekit/common/data/input/providers/rows/base.py +64 -0
- arekit/common/data/input/providers/rows/samples.py +227 -0
- arekit/common/data/input/providers/sample/__init__.py +0 -0
- arekit/common/data/input/providers/sample/cropped.py +43 -0
- arekit/common/data/input/providers/text/__init__.py +0 -0
- arekit/common/data/input/providers/text/single.py +49 -0
- arekit/common/data/input/repositories/__init__.py +0 -0
- arekit/common/data/input/repositories/base.py +68 -0
- arekit/common/data/input/repositories/sample.py +22 -0
- arekit/common/data/input/sample.py +66 -0
- arekit/common/data/input/terms_mapper.py +88 -0
- arekit/common/data/rows_fmt.py +82 -0
- arekit/common/data/rows_parser.py +43 -0
- arekit/common/data/storages/__init__.py +0 -0
- arekit/common/data/storages/base.py +109 -0
- arekit/common/data/views/__init__.py +0 -0
- arekit/common/data/views/samples.py +26 -0
- arekit/common/docs/__init__.py +0 -0
- arekit/common/docs/base.py +30 -0
- arekit/common/docs/entities_grouping.py +16 -0
- arekit/common/docs/entity.py +18 -0
- arekit/common/docs/objects_parser.py +37 -0
- arekit/common/docs/parsed/__init__.py +0 -0
- arekit/common/docs/parsed/base.py +101 -0
- arekit/common/docs/parsed/providers/__init__.py +0 -0
- arekit/common/docs/parsed/providers/base.py +68 -0
- arekit/common/docs/parsed/providers/base_pairs.py +51 -0
- arekit/common/docs/parsed/providers/entity_service.py +175 -0
- arekit/common/docs/parsed/providers/opinion_pairs.py +20 -0
- arekit/common/docs/parsed/providers/text_opinion_pairs.py +78 -0
- arekit/common/docs/parsed/service.py +31 -0
- arekit/common/docs/parsed/term_position.py +42 -0
- arekit/common/docs/parser.py +34 -0
- arekit/common/docs/sentence.py +14 -0
- arekit/common/entities/__init__.py +0 -0
- arekit/common/entities/base.py +51 -0
- arekit/common/entities/collection.py +72 -0
- arekit/common/entities/str_fmt.py +8 -0
- arekit/common/entities/types.py +9 -0
- arekit/common/experiment/__init__.py +0 -0
- arekit/common/experiment/api/__init__.py +0 -0
- arekit/common/experiment/api/base_samples_io.py +20 -0
- arekit/common/experiment/data_type.py +17 -0
- arekit/common/frames/__init__.py +0 -0
- arekit/common/frames/connotations/__init__.py +0 -0
- arekit/common/frames/connotations/descriptor.py +17 -0
- arekit/common/frames/connotations/provider.py +4 -0
- arekit/common/frames/text_variant.py +43 -0
- arekit/common/frames/variants/__init__.py +0 -0
- arekit/common/frames/variants/base.py +21 -0
- arekit/common/frames/variants/collection.py +60 -0
- arekit/common/labels/__init__.py +0 -0
- arekit/common/labels/base.py +19 -0
- arekit/common/labels/provider/__init__.py +0 -0
- arekit/common/labels/provider/base.py +7 -0
- arekit/common/labels/provider/constant.py +14 -0
- arekit/common/labels/scaler/__init__.py +0 -0
- arekit/common/labels/scaler/base.py +85 -0
- arekit/common/labels/scaler/sentiment.py +7 -0
- arekit/common/labels/scaler/single.py +10 -0
- arekit/common/labels/str_fmt.py +55 -0
- arekit/common/linkage/__init__.py +0 -0
- arekit/common/linkage/base.py +44 -0
- arekit/common/linkage/meta.py +23 -0
- arekit/common/linkage/opinions.py +9 -0
- arekit/common/linkage/text_opinions.py +22 -0
- arekit/common/log_utils.py +29 -0
- arekit/common/model/__init__.py +0 -0
- arekit/common/model/labeling/__init__.py +0 -0
- arekit/common/model/labeling/base.py +24 -0
- arekit/common/model/labeling/modes.py +8 -0
- arekit/common/model/labeling/single.py +24 -0
- arekit/common/opinions/__init__.py +0 -0
- arekit/common/opinions/annot/__init__.py +0 -0
- arekit/common/opinions/annot/algo/__init__.py +0 -0
- arekit/common/opinions/annot/algo/base.py +4 -0
- arekit/common/opinions/annot/algo/pair_based.py +99 -0
- arekit/common/opinions/annot/algo/predefined.py +16 -0
- arekit/common/opinions/annot/algo_based.py +55 -0
- arekit/common/opinions/annot/base.py +15 -0
- arekit/common/opinions/base.py +74 -0
- arekit/common/opinions/collection.py +150 -0
- arekit/common/opinions/enums.py +6 -0
- arekit/common/opinions/provider.py +4 -0
- arekit/common/opinions/writer.py +4 -0
- arekit/common/pipeline/__init__.py +0 -0
- arekit/common/pipeline/base.py +25 -0
- arekit/common/pipeline/context.py +36 -0
- arekit/common/pipeline/conts.py +2 -0
- arekit/common/pipeline/items/__init__.py +0 -0
- arekit/common/pipeline/items/base.py +12 -0
- arekit/common/pipeline/items/flatten.py +14 -0
- arekit/common/pipeline/items/handle.py +17 -0
- arekit/common/pipeline/items/iter.py +11 -0
- arekit/common/pipeline/items/map.py +11 -0
- arekit/common/pipeline/items/map_nested.py +13 -0
- arekit/common/synonyms/__init__.py +0 -0
- arekit/common/synonyms/base.py +151 -0
- arekit/common/synonyms/grouping.py +21 -0
- arekit/common/text/__init__.py +0 -0
- arekit/common/text/enums.py +12 -0
- arekit/common/text/parsed.py +42 -0
- arekit/common/text/parser.py +12 -0
- arekit/common/text/partitioning/__init__.py +0 -0
- arekit/common/text/partitioning/base.py +4 -0
- arekit/common/text/partitioning/str.py +36 -0
- arekit/common/text/partitioning/terms.py +35 -0
- arekit/common/text/stemmer.py +16 -0
- arekit/common/text_opinions/__init__.py +0 -0
- arekit/common/text_opinions/base.py +105 -0
- arekit/common/utils.py +129 -0
- arekit/contrib/__init__.py +0 -0
- arekit/contrib/bert/__init__.py +0 -0
- arekit/contrib/bert/input/__init__.py +0 -0
- arekit/contrib/bert/input/providers/__init__.py +0 -0
- arekit/contrib/bert/input/providers/cropped_sample.py +17 -0
- arekit/contrib/bert/input/providers/text_pair.py +62 -0
- arekit/contrib/bert/terms/__init__.py +0 -0
- arekit/contrib/bert/terms/mapper.py +20 -0
- arekit/contrib/networks/__init__.py +0 -0
- arekit/contrib/networks/embedding.py +149 -0
- arekit/contrib/networks/embedding_io.py +18 -0
- arekit/contrib/networks/input/__init__.py +0 -0
- arekit/contrib/networks/input/const.py +6 -0
- arekit/contrib/networks/input/ctx_serialization.py +28 -0
- arekit/contrib/networks/input/embedding/__init__.py +0 -0
- arekit/contrib/networks/input/embedding/matrix.py +29 -0
- arekit/contrib/networks/input/embedding/offsets.py +55 -0
- arekit/contrib/networks/input/formatters/__init__.py +0 -0
- arekit/contrib/networks/input/formatters/pos_mapper.py +22 -0
- arekit/contrib/networks/input/providers/__init__.py +0 -0
- arekit/contrib/networks/input/providers/sample.py +129 -0
- arekit/contrib/networks/input/providers/term_connotation.py +23 -0
- arekit/contrib/networks/input/providers/text.py +24 -0
- arekit/contrib/networks/input/rows_parser.py +47 -0
- arekit/contrib/networks/input/term_types.py +13 -0
- arekit/contrib/networks/input/terms_mapping.py +60 -0
- arekit/contrib/networks/vectorizer.py +6 -0
- arekit/contrib/prompt/__init__.py +0 -0
- arekit/contrib/prompt/sample.py +61 -0
- arekit/contrib/source/__init__.py +0 -0
- arekit/contrib/source/brat/__init__.py +0 -0
- arekit/contrib/source/brat/annot.py +84 -0
- arekit/contrib/source/brat/doc.py +28 -0
- arekit/contrib/source/brat/entities/__init__.py +0 -0
- arekit/contrib/source/brat/entities/compound.py +13 -0
- arekit/contrib/source/brat/entities/entity.py +42 -0
- arekit/contrib/source/brat/entities/parser.py +53 -0
- arekit/contrib/source/brat/opinions/__init__.py +0 -0
- arekit/contrib/source/brat/opinions/converter.py +19 -0
- arekit/contrib/source/brat/relation.py +32 -0
- arekit/contrib/source/brat/sentence.py +69 -0
- arekit/contrib/source/brat/sentences_reader.py +128 -0
- arekit/contrib/source/download.py +41 -0
- arekit/contrib/source/nerel/__init__.py +0 -0
- arekit/contrib/source/nerel/entities.py +55 -0
- arekit/contrib/source/nerel/folding/__init__.py +0 -0
- arekit/contrib/source/nerel/folding/fixed.py +74 -0
- arekit/contrib/source/nerel/io_utils.py +62 -0
- arekit/contrib/source/nerel/labels.py +241 -0
- arekit/contrib/source/nerel/reader.py +46 -0
- arekit/contrib/source/nerel/utils.py +24 -0
- arekit/contrib/source/nerel/versions.py +12 -0
- arekit/contrib/source/nerelbio/__init__.py +0 -0
- arekit/contrib/source/nerelbio/io_utils.py +62 -0
- arekit/contrib/source/nerelbio/labels.py +265 -0
- arekit/contrib/source/nerelbio/reader.py +8 -0
- arekit/contrib/source/nerelbio/versions.py +8 -0
- arekit/contrib/source/ruattitudes/__init__.py +0 -0
- arekit/contrib/source/ruattitudes/collection.py +36 -0
- arekit/contrib/source/ruattitudes/doc.py +51 -0
- arekit/contrib/source/ruattitudes/doc_brat.py +44 -0
- arekit/contrib/source/ruattitudes/entity/__init__.py +0 -0
- arekit/contrib/source/ruattitudes/entity/parser.py +7 -0
- arekit/contrib/source/ruattitudes/io_utils.py +56 -0
- arekit/contrib/source/ruattitudes/labels_fmt.py +12 -0
- arekit/contrib/source/ruattitudes/opinions/__init__.py +0 -0
- arekit/contrib/source/ruattitudes/opinions/base.py +28 -0
- arekit/contrib/source/ruattitudes/opinions/converter.py +37 -0
- arekit/contrib/source/ruattitudes/reader.py +268 -0
- arekit/contrib/source/ruattitudes/sentence.py +73 -0
- arekit/contrib/source/ruattitudes/synonyms.py +17 -0
- arekit/contrib/source/ruattitudes/text_object.py +59 -0
- arekit/contrib/source/rusentiframes/__init__.py +0 -0
- arekit/contrib/source/rusentiframes/collection.py +157 -0
- arekit/contrib/source/rusentiframes/effect.py +24 -0
- arekit/contrib/source/rusentiframes/io_utils.py +19 -0
- arekit/contrib/source/rusentiframes/labels_fmt.py +22 -0
- arekit/contrib/source/rusentiframes/polarity.py +35 -0
- arekit/contrib/source/rusentiframes/role.py +15 -0
- arekit/contrib/source/rusentiframes/state.py +24 -0
- arekit/contrib/source/rusentiframes/types.py +42 -0
- arekit/contrib/source/rusentiframes/value.py +2 -0
- arekit/contrib/source/rusentrel/__init__.py +0 -0
- arekit/contrib/source/rusentrel/const.py +3 -0
- arekit/contrib/source/rusentrel/docs_reader.py +51 -0
- arekit/contrib/source/rusentrel/entities.py +26 -0
- arekit/contrib/source/rusentrel/io_utils.py +125 -0
- arekit/contrib/source/rusentrel/labels_fmt.py +12 -0
- arekit/contrib/source/rusentrel/opinions/__init__.py +0 -0
- arekit/contrib/source/rusentrel/opinions/collection.py +30 -0
- arekit/contrib/source/rusentrel/opinions/converter.py +40 -0
- arekit/contrib/source/rusentrel/opinions/provider.py +54 -0
- arekit/contrib/source/rusentrel/opinions/writer.py +42 -0
- arekit/contrib/source/rusentrel/synonyms.py +17 -0
- arekit/contrib/source/sentinerel/__init__.py +0 -0
- arekit/contrib/source/sentinerel/entities.py +52 -0
- arekit/contrib/source/sentinerel/folding/__init__.py +0 -0
- arekit/contrib/source/sentinerel/folding/factory.py +31 -0
- arekit/contrib/source/sentinerel/folding/fixed.py +70 -0
- arekit/contrib/source/sentinerel/io_utils.py +87 -0
- arekit/contrib/source/sentinerel/labels.py +53 -0
- arekit/contrib/source/sentinerel/labels_scaler.py +30 -0
- arekit/contrib/source/sentinerel/reader.py +42 -0
- arekit/contrib/source/synonyms/__init__.py +0 -0
- arekit/contrib/source/synonyms/utils.py +19 -0
- arekit/contrib/source/zip_utils.py +47 -0
- arekit/contrib/utils/__init__.py +0 -0
- arekit/contrib/utils/bert/__init__.py +0 -0
- arekit/contrib/utils/bert/samplers.py +17 -0
- arekit/contrib/utils/connotations/__init__.py +0 -0
- arekit/contrib/utils/connotations/rusentiframes_sentiment.py +23 -0
- arekit/contrib/utils/data/__init__.py +0 -0
- arekit/contrib/utils/data/contents/__init__.py +0 -0
- arekit/contrib/utils/data/contents/opinions.py +37 -0
- arekit/contrib/utils/data/doc_provider/__init__.py +0 -0
- arekit/contrib/utils/data/doc_provider/dict_based.py +13 -0
- arekit/contrib/utils/data/doc_provider/dir_based.py +53 -0
- arekit/contrib/utils/data/readers/__init__.py +0 -0
- arekit/contrib/utils/data/readers/base.py +7 -0
- arekit/contrib/utils/data/readers/csv_pd.py +38 -0
- arekit/contrib/utils/data/readers/jsonl.py +15 -0
- arekit/contrib/utils/data/service/__init__.py +0 -0
- arekit/contrib/utils/data/service/balance.py +50 -0
- arekit/contrib/utils/data/storages/__init__.py +0 -0
- arekit/contrib/utils/data/storages/jsonl_based.py +18 -0
- arekit/contrib/utils/data/storages/pandas_based.py +123 -0
- arekit/contrib/utils/data/storages/row_cache.py +48 -0
- arekit/contrib/utils/data/writers/__init__.py +0 -0
- arekit/contrib/utils/data/writers/base.py +27 -0
- arekit/contrib/utils/data/writers/csv_native.py +63 -0
- arekit/contrib/utils/data/writers/csv_pd.py +40 -0
- arekit/contrib/utils/data/writers/json_opennre.py +132 -0
- arekit/contrib/utils/data/writers/sqlite_native.py +110 -0
- arekit/contrib/utils/download.py +77 -0
- arekit/contrib/utils/embeddings/__init__.py +0 -0
- arekit/contrib/utils/embeddings/rusvectores.py +58 -0
- arekit/contrib/utils/embeddings/tokens.py +30 -0
- arekit/contrib/utils/entities/__init__.py +0 -0
- arekit/contrib/utils/entities/filter.py +7 -0
- arekit/contrib/utils/entities/formatters/__init__.py +0 -0
- arekit/contrib/utils/entities/formatters/str_display.py +11 -0
- arekit/contrib/utils/entities/formatters/str_simple_sharp_prefixed_fmt.py +15 -0
- arekit/contrib/utils/io_utils/__init__.py +0 -0
- arekit/contrib/utils/io_utils/embedding.py +72 -0
- arekit/contrib/utils/io_utils/opinions.py +37 -0
- arekit/contrib/utils/io_utils/samples.py +79 -0
- arekit/contrib/utils/io_utils/utils.py +39 -0
- arekit/contrib/utils/lexicons/__init__.py +0 -0
- arekit/contrib/utils/lexicons/lexicon.py +41 -0
- arekit/contrib/utils/lexicons/relation.py +42 -0
- arekit/contrib/utils/lexicons/rusentilex.py +37 -0
- arekit/contrib/utils/nn/__init__.py +0 -0
- arekit/contrib/utils/nn/rows.py +83 -0
- arekit/contrib/utils/np_utils/__init__.py +0 -0
- arekit/contrib/utils/np_utils/embedding.py +22 -0
- arekit/contrib/utils/np_utils/npz_utils.py +13 -0
- arekit/contrib/utils/np_utils/vocab.py +20 -0
- arekit/contrib/utils/pipelines/__init__.py +0 -0
- arekit/contrib/utils/pipelines/items/__init__.py +0 -0
- arekit/contrib/utils/pipelines/items/sampling/__init__.py +0 -0
- arekit/contrib/utils/pipelines/items/sampling/base.py +99 -0
- arekit/contrib/utils/pipelines/items/sampling/networks.py +54 -0
- arekit/contrib/utils/pipelines/items/text/__init__.py +0 -0
- arekit/contrib/utils/pipelines/items/text/entities_default.py +23 -0
- arekit/contrib/utils/pipelines/items/text/frames.py +86 -0
- arekit/contrib/utils/pipelines/items/text/frames_lemmatized.py +36 -0
- arekit/contrib/utils/pipelines/items/text/frames_negation.py +32 -0
- arekit/contrib/utils/pipelines/items/text/terms_splitter.py +10 -0
- arekit/contrib/utils/pipelines/items/text/tokenizer.py +107 -0
- arekit/contrib/utils/pipelines/items/text/translator.py +135 -0
- arekit/contrib/utils/pipelines/opinion_collections.py +85 -0
- arekit/contrib/utils/pipelines/sources/__init__.py +0 -0
- arekit/contrib/utils/pipelines/sources/nerel/__init__.py +0 -0
- arekit/contrib/utils/pipelines/sources/nerel/doc_provider.py +27 -0
- arekit/contrib/utils/pipelines/sources/nerel/extract_text_relations.py +65 -0
- arekit/contrib/utils/pipelines/sources/nerel/labels_fmt.py +60 -0
- arekit/contrib/utils/pipelines/sources/nerel_bio/__init__.py +0 -0
- arekit/contrib/utils/pipelines/sources/nerel_bio/doc_provider.py +29 -0
- arekit/contrib/utils/pipelines/sources/nerel_bio/extrat_text_relations.py +64 -0
- arekit/contrib/utils/pipelines/sources/nerel_bio/labels_fmt.py +79 -0
- arekit/contrib/utils/pipelines/sources/ruattitudes/__init__.py +0 -0
- arekit/contrib/utils/pipelines/sources/ruattitudes/doc_provider.py +56 -0
- arekit/contrib/utils/pipelines/sources/ruattitudes/entity_filter.py +20 -0
- arekit/contrib/utils/pipelines/sources/ruattitudes/extract_text_opinions.py +65 -0
- arekit/contrib/utils/pipelines/sources/rusentrel/__init__.py +0 -0
- arekit/contrib/utils/pipelines/sources/rusentrel/doc_provider.py +21 -0
- arekit/contrib/utils/pipelines/sources/rusentrel/extract_text_opinions.py +107 -0
- arekit/contrib/utils/pipelines/sources/sentinerel/__init__.py +0 -0
- arekit/contrib/utils/pipelines/sources/sentinerel/doc_provider.py +29 -0
- arekit/contrib/utils/pipelines/sources/sentinerel/entity_filter.py +62 -0
- arekit/contrib/utils/pipelines/sources/sentinerel/extract_text_opinions.py +180 -0
- arekit/contrib/utils/pipelines/sources/sentinerel/labels_fmt.py +50 -0
- arekit/contrib/utils/pipelines/text_opinion/__init__.py +0 -0
- arekit/contrib/utils/pipelines/text_opinion/annot/__init__.py +0 -0
- arekit/contrib/utils/pipelines/text_opinion/annot/algo_based.py +34 -0
- arekit/contrib/utils/pipelines/text_opinion/annot/predefined.py +88 -0
- arekit/contrib/utils/pipelines/text_opinion/extraction.py +93 -0
- arekit/contrib/utils/pipelines/text_opinion/filters/__init__.py +0 -0
- arekit/contrib/utils/pipelines/text_opinion/filters/base.py +4 -0
- arekit/contrib/utils/pipelines/text_opinion/filters/distance_based.py +16 -0
- arekit/contrib/utils/pipelines/text_opinion/filters/entity_based.py +29 -0
- arekit/contrib/utils/pipelines/text_opinion/filters/limitation.py +26 -0
- arekit/contrib/utils/processing/__init__.py +0 -0
- arekit/contrib/utils/processing/languages/__init__.py +0 -0
- arekit/contrib/utils/processing/languages/mods.py +12 -0
- arekit/contrib/utils/processing/languages/pos.py +23 -0
- arekit/contrib/utils/processing/languages/ru/__init__.py +0 -0
- arekit/contrib/utils/processing/languages/ru/cases.py +78 -0
- arekit/contrib/utils/processing/languages/ru/constants.py +6 -0
- arekit/contrib/utils/processing/languages/ru/mods.py +13 -0
- arekit/contrib/utils/processing/languages/ru/number.py +23 -0
- arekit/contrib/utils/processing/languages/ru/pos_service.py +36 -0
- arekit/contrib/utils/processing/lemmatization/__init__.py +0 -0
- arekit/contrib/utils/processing/lemmatization/mystem.py +51 -0
- arekit/contrib/utils/processing/pos/__init__.py +0 -0
- arekit/contrib/utils/processing/pos/base.py +12 -0
- arekit/contrib/utils/processing/pos/mystem_wrap.py +134 -0
- arekit/contrib/utils/processing/pos/russian.py +10 -0
- arekit/contrib/utils/processing/text/__init__.py +0 -0
- arekit/contrib/utils/processing/text/tokens.py +127 -0
- arekit/contrib/utils/resources.py +25 -0
- arekit/contrib/utils/serializer.py +43 -0
- arekit/contrib/utils/sources/__init__.py +0 -0
- arekit/contrib/utils/sources/sentinerel/__init__.py +0 -0
- arekit/contrib/utils/sources/sentinerel/text_opinion/__init__.py +0 -0
- arekit/contrib/utils/sources/sentinerel/text_opinion/prof_per_org_filter.py +63 -0
- arekit/contrib/utils/synonyms/__init__.py +0 -0
- arekit/contrib/utils/synonyms/simple.py +15 -0
- arekit/contrib/utils/synonyms/stemmer_based.py +38 -0
- arekit/contrib/utils/vectorizers/__init__.py +0 -0
- arekit/contrib/utils/vectorizers/bpe.py +93 -0
- arekit/contrib/utils/vectorizers/random_norm.py +39 -0
- arekit/download_data.py +11 -0
- arekit-0.24.0.dist-info/LICENSE +21 -0
- arekit-0.24.0.dist-info/METADATA +23 -0
- arekit-0.24.0.dist-info/RECORD +374 -0
- arekit-0.24.0.dist-info/WHEEL +5 -0
- arekit-0.24.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
class Entity(object):
|
|
2
|
+
|
|
3
|
+
def __init__(self, value, e_type, childs=None, display_value=None, group_index=None):
|
|
4
|
+
assert(isinstance(value, str) and len(value) > 0)
|
|
5
|
+
assert(isinstance(e_type, str) or e_type is None)
|
|
6
|
+
assert(isinstance(display_value, str) or display_value is None)
|
|
7
|
+
assert(isinstance(group_index, int) or group_index is None)
|
|
8
|
+
assert(isinstance(childs, list) or childs is None)
|
|
9
|
+
self.__value = value
|
|
10
|
+
self.__type = e_type
|
|
11
|
+
self.__display_value = display_value
|
|
12
|
+
self.__group_index = group_index
|
|
13
|
+
self.__childs = childs
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def GroupIndex(self):
|
|
17
|
+
return self.__group_index
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def Value(self):
|
|
21
|
+
return self.__value
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def DisplayValue(self):
|
|
25
|
+
""" Now, we consider the default value in case
|
|
26
|
+
of the undefined caption, and display_value otherwise.
|
|
27
|
+
"""
|
|
28
|
+
return self.__value if self.__display_value is None else self.__display_value
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def Type(self):
|
|
32
|
+
return self.__type
|
|
33
|
+
|
|
34
|
+
def set_display_value(self, caption):
|
|
35
|
+
""" Caption allows to customize the original value.
|
|
36
|
+
Required for optional value modification.
|
|
37
|
+
"""
|
|
38
|
+
assert(isinstance(caption, str))
|
|
39
|
+
self.__display_value = caption
|
|
40
|
+
|
|
41
|
+
def set_group_index(self, value):
|
|
42
|
+
assert(isinstance(value, int) and value >= -1)
|
|
43
|
+
assert(self.__group_index is None)
|
|
44
|
+
self.__group_index = value
|
|
45
|
+
|
|
46
|
+
def iter_childs(self):
|
|
47
|
+
if self.__childs is None:
|
|
48
|
+
return
|
|
49
|
+
yield
|
|
50
|
+
for child in self.__childs:
|
|
51
|
+
yield child
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
class EntityCollection(object):
|
|
2
|
+
""" Collection of annotated entities
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
class KeyType:
|
|
6
|
+
BY_SYNONYMS = 0
|
|
7
|
+
BY_VALUE = 1
|
|
8
|
+
|
|
9
|
+
def __init__(self, entities, value_to_group_id_func):
|
|
10
|
+
assert(isinstance(entities, list))
|
|
11
|
+
assert(callable(value_to_group_id_func))
|
|
12
|
+
|
|
13
|
+
self.__entities = entities
|
|
14
|
+
self.__value_to_group_id_func = value_to_group_id_func
|
|
15
|
+
|
|
16
|
+
self.__by_value = self.create_index(entities=entities,
|
|
17
|
+
key_func=lambda e: e.Value)
|
|
18
|
+
|
|
19
|
+
self.__by_synonyms = self.create_index(
|
|
20
|
+
entities=entities,
|
|
21
|
+
key_func=lambda e: value_to_group_id_func(e.Value))
|
|
22
|
+
|
|
23
|
+
@staticmethod
|
|
24
|
+
def __value_or_none(d, key):
|
|
25
|
+
return d[key] if key in d else None
|
|
26
|
+
|
|
27
|
+
# region protected methods
|
|
28
|
+
|
|
29
|
+
def _sort_entities(self, key):
|
|
30
|
+
assert(callable(key))
|
|
31
|
+
self.__entities.sort(key=key)
|
|
32
|
+
|
|
33
|
+
# endregion
|
|
34
|
+
|
|
35
|
+
# region public methods
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def create_index(entities, key_func):
|
|
39
|
+
index = {}
|
|
40
|
+
for e in entities:
|
|
41
|
+
key = key_func(e)
|
|
42
|
+
if key in index:
|
|
43
|
+
index[key].append(e)
|
|
44
|
+
else:
|
|
45
|
+
index[key] = [e]
|
|
46
|
+
return index
|
|
47
|
+
|
|
48
|
+
def get_entity_by_index(self, index):
|
|
49
|
+
assert(isinstance(index, int))
|
|
50
|
+
return self.__entities[index]
|
|
51
|
+
|
|
52
|
+
def try_get_entities(self, value, group_key):
|
|
53
|
+
assert(isinstance(value, str))
|
|
54
|
+
|
|
55
|
+
if group_key == self.KeyType.BY_SYNONYMS:
|
|
56
|
+
key = self.__value_to_group_id_func(value)
|
|
57
|
+
return self.__value_or_none(self.__by_synonyms, key)
|
|
58
|
+
if group_key == self.KeyType.BY_VALUE:
|
|
59
|
+
return self.__value_or_none(self.__by_value, value)
|
|
60
|
+
|
|
61
|
+
# endregion
|
|
62
|
+
|
|
63
|
+
# region base methods
|
|
64
|
+
|
|
65
|
+
def __len__(self):
|
|
66
|
+
return len(self.__entities)
|
|
67
|
+
|
|
68
|
+
def __iter__(self):
|
|
69
|
+
for entity in self.__entities:
|
|
70
|
+
yield entity
|
|
71
|
+
|
|
72
|
+
# endregion
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class BaseSamplesIO(object):
|
|
2
|
+
""" Represents base experiment utils for input/output for:
|
|
3
|
+
samples -- data that utilized for experiments;
|
|
4
|
+
results -- evaluation of experiments.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
@property
|
|
8
|
+
def Reader(self):
|
|
9
|
+
raise NotImplementedError()
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
def Writer(self):
|
|
13
|
+
""" For serialization
|
|
14
|
+
"""
|
|
15
|
+
raise NotImplementedError()
|
|
16
|
+
|
|
17
|
+
def create_target(self, data_type):
|
|
18
|
+
""" Path for reaiding/viewing
|
|
19
|
+
"""
|
|
20
|
+
raise NotImplementedError()
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class FrameConnotationDescriptor(object):
|
|
2
|
+
"""
|
|
3
|
+
Polarity description between source (Agent) towards dest (Theme)
|
|
4
|
+
The latter is related to the roles of frame polarity.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
@property
|
|
8
|
+
def Source(self):
|
|
9
|
+
raise NotImplementedError()
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
def Destination(self):
|
|
13
|
+
raise NotImplementedError()
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def Label(self):
|
|
17
|
+
raise NotImplementedError()
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from arekit.common.frames.variants.base import FrameVariant
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TextFrameVariant(object):
|
|
5
|
+
"""
|
|
6
|
+
FrameVariant in a text, i.e. related object provides position in text.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
def __init__(self, variant):
|
|
10
|
+
assert(isinstance(variant, FrameVariant))
|
|
11
|
+
self.__variant = variant
|
|
12
|
+
self.__is_negated = False
|
|
13
|
+
|
|
14
|
+
# region properties
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def Variant(self):
|
|
18
|
+
return self.__variant
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def IsNegated(self):
|
|
22
|
+
return self.__is_negated
|
|
23
|
+
|
|
24
|
+
# endregion
|
|
25
|
+
|
|
26
|
+
# region public methods
|
|
27
|
+
|
|
28
|
+
def iter_terms(self):
|
|
29
|
+
for term in self.__variant.iter_terms():
|
|
30
|
+
yield term
|
|
31
|
+
|
|
32
|
+
def set_is_negated(self, value):
|
|
33
|
+
assert(isinstance(value, bool))
|
|
34
|
+
self.__is_negated = value
|
|
35
|
+
|
|
36
|
+
# endregion
|
|
37
|
+
|
|
38
|
+
# region overriden
|
|
39
|
+
|
|
40
|
+
def __len__(self):
|
|
41
|
+
return len(self.__variant)
|
|
42
|
+
|
|
43
|
+
# endregion
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class FrameVariant(object):
|
|
2
|
+
|
|
3
|
+
def __init__(self, terms, frame_id):
|
|
4
|
+
assert(isinstance(terms, list))
|
|
5
|
+
assert(isinstance(frame_id, str))
|
|
6
|
+
self.__terms = terms
|
|
7
|
+
self.__frame_id = frame_id
|
|
8
|
+
|
|
9
|
+
@property
|
|
10
|
+
def FrameID(self):
|
|
11
|
+
return self.__frame_id
|
|
12
|
+
|
|
13
|
+
def get_value(self):
|
|
14
|
+
return " ".join(self.__terms)
|
|
15
|
+
|
|
16
|
+
def iter_terms(self):
|
|
17
|
+
for term in self.__terms:
|
|
18
|
+
yield term
|
|
19
|
+
|
|
20
|
+
def __len__(self):
|
|
21
|
+
return len(self.__terms)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from collections.abc import Iterable
|
|
2
|
+
from arekit.common.frames.variants.base import FrameVariant
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class FrameVariantsCollection(object):
|
|
6
|
+
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self.__variants = {}
|
|
9
|
+
self.__frames_list = []
|
|
10
|
+
|
|
11
|
+
# region private methods
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def __register_frame(frames_dict, frames_list, id):
|
|
15
|
+
assert(isinstance(id, str))
|
|
16
|
+
if id not in frames_dict:
|
|
17
|
+
frames_dict[id] = len(frames_list)
|
|
18
|
+
frames_list.append(id)
|
|
19
|
+
return frames_dict[id]
|
|
20
|
+
|
|
21
|
+
# endregion
|
|
22
|
+
|
|
23
|
+
# region public methods
|
|
24
|
+
|
|
25
|
+
def fill_from_iterable(self, variants_with_id, overwrite_existed_variant, raise_error_on_existed_variant):
|
|
26
|
+
assert(isinstance(variants_with_id, Iterable))
|
|
27
|
+
assert(isinstance(overwrite_existed_variant, bool))
|
|
28
|
+
assert(isinstance(raise_error_on_existed_variant, bool))
|
|
29
|
+
assert(len(self.__variants) == 0)
|
|
30
|
+
assert(len(self.__frames_list) == 0)
|
|
31
|
+
|
|
32
|
+
frames_dict = {}
|
|
33
|
+
for frame_id, variant in variants_with_id:
|
|
34
|
+
self.__register_frame(frames_dict, self.__frames_list, frame_id)
|
|
35
|
+
|
|
36
|
+
if variant in self.__variants:
|
|
37
|
+
if raise_error_on_existed_variant:
|
|
38
|
+
raise Exception("Variant '{variant}' already registered".format(variant=variant))
|
|
39
|
+
if not overwrite_existed_variant:
|
|
40
|
+
continue
|
|
41
|
+
|
|
42
|
+
self.__variants[variant] = FrameVariant(terms=variant.split(), frame_id=frame_id)
|
|
43
|
+
|
|
44
|
+
def get_frame_by_index(self, index):
|
|
45
|
+
return self.__frames_list[index]
|
|
46
|
+
|
|
47
|
+
def get_variant_by_value(self, value):
|
|
48
|
+
return self.__variants[value] if value in self.__variants else None
|
|
49
|
+
|
|
50
|
+
def has_variant(self, value):
|
|
51
|
+
return value in self.__variants
|
|
52
|
+
|
|
53
|
+
def iter_variants(self):
|
|
54
|
+
for value, variant in self.__variants.items():
|
|
55
|
+
yield value, variant
|
|
56
|
+
|
|
57
|
+
# endregion
|
|
58
|
+
|
|
59
|
+
def __len__(self):
|
|
60
|
+
return len(self.__variants)
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class Label(object):
|
|
2
|
+
|
|
3
|
+
def __eq__(self, other):
|
|
4
|
+
assert(isinstance(other, Label))
|
|
5
|
+
return type(self) == type(other)
|
|
6
|
+
|
|
7
|
+
def __ne__(self, other):
|
|
8
|
+
assert(isinstance(other, Label))
|
|
9
|
+
return type(self) != type(other)
|
|
10
|
+
|
|
11
|
+
def __hash__(self):
|
|
12
|
+
return hash(self.to_class_str())
|
|
13
|
+
|
|
14
|
+
def to_class_str(self):
|
|
15
|
+
return self.__class__.__name__
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class NoLabel(Label):
|
|
19
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from arekit.common.labels.provider.base import BasePairLabelProvider
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ConstantLabelProvider(BasePairLabelProvider):
|
|
5
|
+
""" Providing a predefined label instance irrespective
|
|
6
|
+
from the source and target entity parameters.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
def __init__(self, label_instance):
|
|
10
|
+
super(ConstantLabelProvider, self).__init__()
|
|
11
|
+
self.__label_instance = label_instance
|
|
12
|
+
|
|
13
|
+
def provide(self, source, target):
|
|
14
|
+
return self.__label_instance
|
|
File without changes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
from collections import OrderedDict
|
|
2
|
+
|
|
3
|
+
from arekit.common.labels.base import NoLabel, Label
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BaseLabelScaler(object):
|
|
7
|
+
""" NOTE:
|
|
8
|
+
Scaler -- set up conversion from int/uint to label and vice versa.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, uint_dict, int_dict):
|
|
12
|
+
assert(isinstance(uint_dict, OrderedDict))
|
|
13
|
+
assert(isinstance(int_dict, OrderedDict))
|
|
14
|
+
assert(len(uint_dict) == len(int_dict))
|
|
15
|
+
|
|
16
|
+
self.__uint_dict = uint_dict
|
|
17
|
+
self.__int_dict = int_dict
|
|
18
|
+
|
|
19
|
+
self.__ordered_labels = list(uint_dict.keys())
|
|
20
|
+
self.__no_label_instance = self.__find_no_label_instance(iter(uint_dict.keys()))
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def LabelsCount(self):
|
|
24
|
+
return len(self.__uint_dict)
|
|
25
|
+
|
|
26
|
+
def ordered_suppoted_labels(self):
|
|
27
|
+
return self.__ordered_labels
|
|
28
|
+
|
|
29
|
+
def get_no_label_instance(self):
|
|
30
|
+
if self.__no_label_instance is None:
|
|
31
|
+
raise Exception("NoLabel does no supported by this scaler")
|
|
32
|
+
|
|
33
|
+
return self.__no_label_instance
|
|
34
|
+
|
|
35
|
+
# region private methods
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def __find_no_label_instance(labels_it):
|
|
39
|
+
for label in labels_it:
|
|
40
|
+
if isinstance(label, NoLabel):
|
|
41
|
+
return label
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
@staticmethod
|
|
45
|
+
def __ltoi(label, d):
|
|
46
|
+
assert(isinstance(label, Label))
|
|
47
|
+
assert(isinstance(d, OrderedDict))
|
|
48
|
+
return d[label]
|
|
49
|
+
|
|
50
|
+
@staticmethod
|
|
51
|
+
def __itol(value, d):
|
|
52
|
+
assert(isinstance(value, int))
|
|
53
|
+
assert(isinstance(d, OrderedDict))
|
|
54
|
+
for label, v in d.items():
|
|
55
|
+
if v == value:
|
|
56
|
+
return label
|
|
57
|
+
|
|
58
|
+
@staticmethod
|
|
59
|
+
def __has_value(value, d):
|
|
60
|
+
assert(isinstance(value, int))
|
|
61
|
+
assert(isinstance(d, OrderedDict))
|
|
62
|
+
for label, v in d.items():
|
|
63
|
+
if v == value:
|
|
64
|
+
return True
|
|
65
|
+
return False
|
|
66
|
+
|
|
67
|
+
# endregion
|
|
68
|
+
|
|
69
|
+
def classes_count(self):
|
|
70
|
+
return len(self.__uint_dict)
|
|
71
|
+
|
|
72
|
+
def label_to_uint(self, label):
|
|
73
|
+
return self.__ltoi(label, self.__uint_dict)
|
|
74
|
+
|
|
75
|
+
def label_to_int(self, label):
|
|
76
|
+
return self.__ltoi(label, self.__int_dict)
|
|
77
|
+
|
|
78
|
+
def uint_to_label(self, value):
|
|
79
|
+
return self.__itol(value, self.__uint_dict)
|
|
80
|
+
|
|
81
|
+
def int_to_label(self, value):
|
|
82
|
+
return self.__itol(value, self.__int_dict)
|
|
83
|
+
|
|
84
|
+
def support_int_value(self, value):
|
|
85
|
+
return self.__has_value(value, self.__int_dict)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from collections import OrderedDict
|
|
2
|
+
|
|
3
|
+
from arekit.common.labels.scaler.base import BaseLabelScaler
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SingleLabelScaler(BaseLabelScaler):
|
|
7
|
+
|
|
8
|
+
def __init__(self, label, uint_label=0):
|
|
9
|
+
d = OrderedDict([(label, uint_label)])
|
|
10
|
+
super(SingleLabelScaler, self).__init__(uint_dict=d, int_dict=d)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from arekit.common.labels.base import Label
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# TODO. This should be moded into formatter.py
|
|
5
|
+
class StringLabelsFormatter(object):
|
|
6
|
+
""" NOTE:
|
|
7
|
+
Set up convertion from string into label instance.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
def __init__(self, stol):
|
|
11
|
+
""" stol: string to label dictionary
|
|
12
|
+
dictionary: string -> label_type
|
|
13
|
+
"""
|
|
14
|
+
assert(isinstance(stol, dict))
|
|
15
|
+
|
|
16
|
+
for key, value in stol.items():
|
|
17
|
+
# Perfom parameters check.
|
|
18
|
+
assert(isinstance(key, str))
|
|
19
|
+
assert(issubclass(value, Label))
|
|
20
|
+
|
|
21
|
+
self._stol = stol
|
|
22
|
+
self.__supported_label_types = set(self._stol.values())
|
|
23
|
+
|
|
24
|
+
def __is_label_type_supported(self, label):
|
|
25
|
+
return label in self.__supported_label_types
|
|
26
|
+
|
|
27
|
+
def str_to_label(self, value):
|
|
28
|
+
assert(isinstance(value, str))
|
|
29
|
+
|
|
30
|
+
if not value in self._stol:
|
|
31
|
+
raise Exception("Label value `{}` is not supported.".format(value))
|
|
32
|
+
|
|
33
|
+
label_type = self._stol[value]
|
|
34
|
+
return label_type()
|
|
35
|
+
|
|
36
|
+
def label_to_str(self, label):
|
|
37
|
+
assert(isinstance(label, Label))
|
|
38
|
+
|
|
39
|
+
label_type = type(label)
|
|
40
|
+
|
|
41
|
+
if not self.__is_label_type_supported(label_type):
|
|
42
|
+
raise Exception("Label type {label} is not supported. Supported labels: [{values}]".format(
|
|
43
|
+
label=label_type, values=self.__supported_label_types))
|
|
44
|
+
|
|
45
|
+
for value, supported_label_type in self._stol.items():
|
|
46
|
+
if supported_label_type == label_type:
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
def supports_label(self, label):
|
|
50
|
+
return type(label) in self.__supported_label_types
|
|
51
|
+
|
|
52
|
+
def supports_value(self, value):
|
|
53
|
+
assert(isinstance(value, str))
|
|
54
|
+
return value in self._stol
|
|
55
|
+
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from collections.abc import Iterable
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class LinkedDataWrapper(object):
|
|
5
|
+
|
|
6
|
+
def __init__(self, linked_data):
|
|
7
|
+
assert(isinstance(linked_data, Iterable))
|
|
8
|
+
self.__linked_data = list(linked_data)
|
|
9
|
+
self.__tag = None
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
def RelatedDocID(self):
|
|
13
|
+
""" Linked data is limited to the particular document.
|
|
14
|
+
"""
|
|
15
|
+
raise NotImplementedError()
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def First(self):
|
|
19
|
+
return self[0]
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def Tag(self):
|
|
23
|
+
return self.__tag
|
|
24
|
+
|
|
25
|
+
def set_tag(self, value):
|
|
26
|
+
self.__tag = value
|
|
27
|
+
|
|
28
|
+
def _get_data_label(self, item):
|
|
29
|
+
raise NotImplementedError()
|
|
30
|
+
|
|
31
|
+
def iter_labels(self):
|
|
32
|
+
for item in self.__linked_data:
|
|
33
|
+
yield self._get_data_label(item)
|
|
34
|
+
|
|
35
|
+
def __getitem__(self, item):
|
|
36
|
+
assert(isinstance(item, int))
|
|
37
|
+
return self.__linked_data[item]
|
|
38
|
+
|
|
39
|
+
def __iter__(self):
|
|
40
|
+
for data in self.__linked_data:
|
|
41
|
+
yield data
|
|
42
|
+
|
|
43
|
+
def __len__(self):
|
|
44
|
+
return len(self.__linked_data)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from arekit.common.linkage.base import LinkedDataWrapper
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class MetaEmptyLinkedDataWrapper(LinkedDataWrapper):
|
|
5
|
+
""" This is a placeholder data-wrapper utilized for passing system information
|
|
6
|
+
while iterating through the data pipelines.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
def __init__(self, doc_id, meta_data=None):
|
|
10
|
+
""" meta_data:
|
|
11
|
+
optional parameter which serves any information need in further.
|
|
12
|
+
"""
|
|
13
|
+
super(MetaEmptyLinkedDataWrapper, self).__init__([])
|
|
14
|
+
self.__doc_id = doc_id
|
|
15
|
+
self.__meta_data = meta_data
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def RelatedDocID(self):
|
|
19
|
+
return self.__doc_id
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def MetaData(self):
|
|
23
|
+
return self.__meta_data
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from arekit.common.linkage.base import LinkedDataWrapper
|
|
2
|
+
from arekit.common.text_opinions.base import TextOpinion
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class TextOpinionsLinkage(LinkedDataWrapper):
|
|
6
|
+
|
|
7
|
+
@property
|
|
8
|
+
def First(self):
|
|
9
|
+
first = super(TextOpinionsLinkage, self).First
|
|
10
|
+
assert(isinstance(first, TextOpinion))
|
|
11
|
+
return first
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def RelatedDocID(self):
|
|
15
|
+
return self.First.DocID
|
|
16
|
+
|
|
17
|
+
def get_linked_label(self):
|
|
18
|
+
return self.First.Label
|
|
19
|
+
|
|
20
|
+
def _get_data_label(self, item):
|
|
21
|
+
assert(isinstance(item, TextOpinion))
|
|
22
|
+
return item.Label
|