-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#282 related. Removing usage and serialization of opinions
- Loading branch information
Showing
11 changed files
with
82 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class BaseSamplesIO(object): | ||
""" Represents base experiment utils for input/output for: | ||
samples -- data that utilized for experiments; | ||
results -- evaluation of experiments. | ||
""" | ||
|
||
def create_view(self, data_type, data_folding): | ||
""" For viewing/reading | ||
""" | ||
raise NotImplementedError() | ||
|
||
def create_writer(self): | ||
""" For serialization | ||
""" | ||
raise NotImplementedError() | ||
|
||
def create_target(self, data_type, data_folding): | ||
""" Path for reaiding/viewing | ||
""" | ||
raise NotImplementedError() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from os.path import join | ||
|
||
from arekit.common.data.storages.base import BaseRowsStorage | ||
from arekit.contrib.utils.data.views.opinions import BaseOpinionStorageView | ||
from arekit.contrib.utils.io_utils.utils import filename_template | ||
|
||
|
||
class OpinionsIOUtils(object): | ||
|
||
def __init__(self, target_dir, target_extension=".tsv.gz"): | ||
self.__target_dir = target_dir | ||
self.__target_extension = target_extension | ||
|
||
def create_view(self, target): | ||
storage = BaseRowsStorage.from_tsv(filepath=target) | ||
return BaseOpinionStorageView(storage) | ||
|
||
def create_writer_target(self, data_type, data_folding): | ||
return self.__get_input_opinions_target(data_type, data_folding=data_folding) | ||
|
||
def __get_input_opinions_target(self, data_type, data_folding): | ||
template = filename_template(data_type=data_type, data_folding=data_folding) | ||
return self.__get_filepath(out_dir=self.__target_dir, | ||
template=template, | ||
prefix="opinion", | ||
extension=self.__target_extension) | ||
|
||
@staticmethod | ||
def __get_filepath(out_dir, template, prefix, extension): | ||
assert(isinstance(template, str)) | ||
assert(isinstance(prefix, str)) | ||
assert(isinstance(extension, str)) | ||
return join(out_dir, "{prefix}-{template}{extension}".format( | ||
prefix=prefix, template=template, extension=extension)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters