Skip to content

Commit

Permalink
#478 simplified API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r committed May 22, 2023
1 parent 07bc73c commit a1bac39
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def nolabel_annotator(synonyms, terms_per_context, dist_in_sentences=0, no_label
dist_in_terms_bound=terms_per_context,
label_provider=ConstantLabelProvider(no_label)),
create_empty_collection_func=lambda: OpinionCollection(
opinions=[], synonyms=synonyms, error_on_duplicates=True, error_on_synonym_end_missed=False),
synonyms=synonyms, error_on_duplicates=True, error_on_synonym_end_missed=False),
value_to_group_id_func=lambda value:
SynonymsCollectionValuesGroupingProviders.provide_existed_value(synonyms=synonyms, value=value))

Expand All @@ -83,7 +83,7 @@ def predefined_annotator(synonyms, labels_fmt):
annot_algo=PredefinedOpinionAnnotationAlgorithm(
lambda doc_id: __get_document_opinions(doc_id=doc_id, synonyms=synonyms, labels_fmt=labels_fmt)),
create_empty_collection_func=lambda: OpinionCollection(
opinions=[], synonyms=synonyms, error_on_duplicates=True, error_on_synonym_end_missed=False),
synonyms=synonyms, error_on_duplicates=True, error_on_synonym_end_missed=False),
value_to_group_id_func=lambda value:
SynonymsCollectionValuesGroupingProviders.provide_existed_value(synonyms=synonyms, value=value))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def create_nolabel_text_opinion_annotator(terms_per_context, dist_in_sents=0, sy
dist_in_terms_bound=terms_per_context,
label_provider=ConstantLabelProvider(NoLabel())),
create_empty_collection_func=lambda: OpinionCollection(
opinions=[],
synonyms=synonyms,
error_on_duplicates=True,
error_on_synonym_end_missed=False))
Expand Down
3 changes: 1 addition & 2 deletions tests/contrib/utils/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ def optional_test_output_formatter(self):
opinion_view = BaseOpinionStorageView(opinion_storage)

converter_part = text_opinion_linkages_to_opinion_collections_pipeline_part(
create_opinion_collection_func=lambda: OpinionCollection(opinions=[],
synonyms=synonyms,
create_opinion_collection_func=lambda: OpinionCollection(synonyms=synonyms,
error_on_duplicates=True,
error_on_synonym_end_missed=True),
doc_ids_set={1},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test(self):
dist_in_terms_bound=50,
label_provider=ConstantLabelProvider(NoLabel())),
create_empty_collection_func=lambda: OpinionCollection(
opinions=[], synonyms=synonyms, error_on_duplicates=True, error_on_synonym_end_missed=False),
synonyms=synonyms, error_on_duplicates=True, error_on_synonym_end_missed=False),
value_to_group_id_func=lambda value:
SynonymsCollectionValuesGroupingProviders.provide_existed_or_register_missed_value(
synonyms=synonyms, value=value))
Expand Down

0 comments on commit a1bac39

Please sign in to comment.