(self, parameters, **kwargs)
An object class to access the webquestion dataset. The path to the dataset should point to a folder that
        contains a preprocessed dataset.

        :param path_to_dataset: path to the data set location
An object class to access the webquestion dataset. The path to the dataset should point to a folder that
        contains a preprocessed dataset.
An object class to access the webquestion dataset . The path to the dataset should point to a folder that contains a preprocessed dataset .
def __init__(self, parameters, **kwargs):
        """
        An object class to access the webquestion dataset. The path to the dataset should point to a folder that
        contains a preprocessed dataset.

        :param path_to_dataset: path to the data set location
        """
        super(WebQuestions, self).__init__(**kwargs)
        self._p = parameters
        path_to_dataset = self._p["path.to.dataset"]
        self.logger.debug("Loading data")
        # Load the tagged version. This part should be always present.
        # with open(path_to_dataset["train_tagged"]) as f:
        #     self._dataset_tagged = json.load_word_embeddings(f)
        # self.logger.debug("Tagged: {}".format(len(self._dataset_tagged)))
        # if self._p.get("no.ne.tags", False):
        #     self._dataset_tagged = [[(w, 'O', t) for w, _, t in s] for s in self._dataset_tagged]

        self._questions_train = []
        self._questions_val = []
        self._silver_graphs = []

        # Load the train questions
        if "train_train" in path_to_dataset:
            with open(path_to_dataset["train_train"]) as f:
                self._questions_train = json.load(f)
            self.logger.debug("Train: {}".format(len(self._questions_train)))
        # Load the validation questions
        if "train_validation" in path_to_dataset:
            with open(path_to_dataset["train_validation"]) as f:
                self._questions_val = json.load(f)
            self.logger.debug("Val: {}".format(len(self._questions_val)))
        # Load the generated graphs
        if "train_silvergraphs" in path_to_dataset:
            with open(path_to_dataset["train_silvergraphs"]) as f:
                self._silver_graphs = json.load(f)
            self.logger.debug("Silver: {}".format(len(self._silver_graphs)))

        if len(self._silver_graphs) > 0:
            self.logger.debug("Average number of choices per question: {}".format(np.mean([len(graphs) for graphs in self._silver_graphs])))
            self._silver_graphs = [graph_set if any(len(g) == 3 and type(g[1]) is list and len(g[1]) == 3 and g[1][2] > 0.0 for g in graph_set) else [] for graph_set in self._silver_graphs ]
            self.logger.debug("Real average number of choices per question: {}".format(np.mean([len(graphs) for graphs in self._silver_graphs])))
def __init__ ( self , parameters , * * kwargs ) : super ( WebQuestions , self ) . __init__ ( * * kwargs ) self . _p = parameters path_to_dataset = self . _p [ "path.to.dataset" ] self . logger . debug ( "Loading data" ) # Load the tagged version. This part should be always present. # with open(path_to_dataset["train_tagged"]) as f: #     self._dataset_tagged = json.load_word_embeddings(f) # self.logger.debug("Tagged: {}".format(len(self._dataset_tagged))) # if self._p.get("no.ne.tags", False): #     self._dataset_tagged = [[(w, 'O', t) for w, _, t in s] for s in self._dataset_tagged] self . _questions_train = [ ] self . _questions_val = [ ] self . _silver_graphs = [ ] # Load the train questions if "train_train" in path_to_dataset : with open ( path_to_dataset [ "train_train" ] ) as f : self . _questions_train = json . load ( f ) self . logger . debug ( "Train: {}" . format ( len ( self . _questions_train ) ) ) # Load the validation questions if "train_validation" in path_to_dataset : with open ( path_to_dataset [ "train_validation" ] ) as f : self . _questions_val = json . load ( f ) self . logger . debug ( "Val: {}" . format ( len ( self . _questions_val ) ) ) # Load the generated graphs if "train_silvergraphs" in path_to_dataset : with open ( path_to_dataset [ "train_silvergraphs" ] ) as f : self . _silver_graphs = json . load ( f ) self . logger . debug ( "Silver: {}" . format ( len ( self . _silver_graphs ) ) ) if len ( self . _silver_graphs ) > 0 : self . logger . debug ( "Average number of choices per question: {}" . format ( np . mean ( [ len ( graphs ) for graphs in self . _silver_graphs ] ) ) ) self . _silver_graphs = [ graph_set if any ( len ( g ) == 3 and type ( g [ 1 ] ) is list and len ( g [ 1 ] ) == 3 and g [ 1 ] [ 2 ] > 0.0 for g in graph_set ) else [ ] for graph_set in self . _silver_graphs ] self . logger . debug ( "Real average number of choices per question: {}" . format ( np . mean ( [ len ( graphs ) for graphs in self . _silver_graphs ] ) ) )