Skip to content

Commit

Permalink
Support prefix, which is similar to SamplesIO API. (similar to #503 b…
Browse files Browse the repository at this point in the history
…ut for prefixes, and for embedding)
  • Loading branch information
nicolay-r committed Oct 31, 2023
1 parent 3e3af5b commit a9bbbfe
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions arekit/contrib/utils/io_utils/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class NpEmbeddingIO(BaseEmbeddingIO):
- embedding vocabulary.
"""

TERM_EMBEDDING_FILENAME_TEMPLATE = 'term_embedding'
VOCABULARY_FILENAME_TEMPLATE = "vocab.txt"

def __init__(self, target_dir):
def __init__(self, target_dir, prefix_name="sample"):
assert(isinstance(target_dir, str))

self.__target_dir = target_dir
self.__term_emb_fn_template = "-".join([prefix_name, "term_embedding"])
self.__vocab_fn_template = "-".join([prefix_name, "term_embedding"])

# region Embedding-related data

Expand Down Expand Up @@ -64,9 +64,9 @@ def __get_term_embedding_source(self):
return self.__get_default_embedding_filepath()

def __get_default_vocab_filepath(self):
return join(self.__target_dir, self.VOCABULARY_FILENAME_TEMPLATE)
return join(self.__target_dir, self.__vocab_fn_template)

def __get_default_embedding_filepath(self):
return join(self.__target_dir, self.TERM_EMBEDDING_FILENAME_TEMPLATE)
return join(self.__target_dir, self.__term_emb_fn_template)

# endregion

0 comments on commit a9bbbfe

Please sign in to comment.