def __init__(self, is_title, text, sentence_opins, objects_list, sentence_index): assert(isinstance(is_title, bool)) assert(isinstance(sentence_opins, list)) assert(isinstance(objects_list, list)) assert(isinstance(sentence_index, int)) super(RuAttitudesSentence, self).__init__(text=split_by_whitespaces(text)) self.__is_title = is_title self.__sentence_opins = sentence_opins self.__objects = objects_list self.__sentence_index = sentence_index self.__owner = None
return __process_indices_list(value) parse_value = { const.ID: lambda value: value, const.S_IND: lambda value: int(value), const.T_IND: lambda value: int(value), network_input_const.FrameVariantIndices: lambda value: __process_indices_list(value) if isinstance(value, str) else empty_list, network_input_const.FrameConnotations: lambda value: __process_indices_list(value) if isinstance(value, str) else empty_list, network_input_const.SynonymObject: lambda value: __process_indices_list(value), network_input_const.SynonymSubject: lambda value: __process_indices_list(value), network_input_const.Entities: lambda value: __process_indices_list(value), network_input_const.PosTags: lambda value: __process_int_values_list(value), "text_a": lambda value: filter_whitespaces([term for term in split_by_whitespaces(value)]) } class ParsedSampleRow(object): """ Provides a parsed information for a sample row. TODO. Use this class as API """ def __init__(self, row): assert(isinstance(row, pd.Series)) self.__uint_label = None self.__params = {}
def __iter_processed_part(self, part): for word in split_by_whitespaces(part): for term in self.__process_word(word): yield term
def __calculate_terms_in_line(line): assert (isinstance(line, str)) return len(split_by_whitespaces(line))
def apply(self, pipeline_ctx): assert (isinstance(pipeline_ctx, PipelineContext)) return pipeline_ctx.update(param="src", value=split_by_whitespaces( pipeline_ctx.provide("src")))