Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Resolve word2vec issue concerning multiple targets capabilities #543

Merged
merged 3 commits into from
Jun 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/analyzers/word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ def _add_doc_and_target_sentences_to_batch(self,
- number of document not added to batch
"""
for target_sentence in target_sentences:
flattened_target_sentence = helpers.utils.flatten_sentence(target_sentence, sep_str='')
# Remove escape character '\' that escapes regex special characters.
# This escape character may be present into the regex expression contained in separators.
separators_without_special_char = re.sub(r'\\(.)', r'\1', self.model_settings["separators"])
flattened_target_sentence = helpers.utils.flatten_sentence(target_sentence,
sep_str=separators_without_special_char)

for aggregator_sentence in aggr_sentences:
flattened_aggregator_sentence = helpers.utils.flatten_sentence(aggregator_sentence)
Expand Down