Skip to content

Commit

Permalink
Merge pull request #900 from PrimozGodec/shared-cv-remove-var
Browse files Browse the repository at this point in the history
[FIX] VectorizationComputeValue - remove wrongly set "original" variable
  • Loading branch information
markotoplak authored Sep 2, 2022
2 parents 339ad59 + e85e2c7 commit 01544ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 0 additions & 2 deletions orangecontrib/text/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,6 @@ def _rename_features(additional_names: List) -> Tuple[List, List, List]:
else:
var = ContinuousVariable(f, compute_value=cv)
var.sparse = sparse # don't pass this to constructor so this works with Orange < 3.8.0
if cv is not None: # set original variable for cv
cv.variable = var
if isinstance(var_attrs, dict):
var.attributes.update(var_attrs)
additional_attributes.append(var)
Expand Down
6 changes: 2 additions & 4 deletions orangecontrib/text/vectorization/bagofwords.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,8 @@ def _transform(self, corpus, source_dict=None, callback=dummy_callback):
callback(0.9)

# set compute values
shared_cv = SharedTransform(self, corpus.used_preprocessor,
source_dict=dic)
cv = [VectorizationComputeValue(shared_cv, dic[i])
for i in range(len(dic))]
shared_cv = SharedTransform(self, corpus.used_preprocessor, source_dict=dic)
cv = [VectorizationComputeValue(shared_cv, dic[i]) for i in range(len(dic))]

corpus = self.add_features(corpus, X, dic, cv, var_attrs={'bow-feature': True})
callback(1)
Expand Down

0 comments on commit 01544ed

Please sign in to comment.