Exemplo n.º 1
0
    def fextract(self):
        """Extract features"""

        self.load_char_dicts()

        for dirname, char_dict in (("eval", self.eval_char_dict),
                                   ("train", self.train_char_dict)):
            
            for char_code, char_list in char_dict.items():
                output_dir = os.path.join(self.FEATURES_ROOT, dirname)

                if not os.path.exists(output_dir):
                    os.makedirs(output_dir)

                sequence_set = []

                for character in char_list:

                    writing = character.get_writing()

                    char_features = self.get_feature_vectors(writing)

                    sequence_set.append(char_features)

                output_file = os.path.join(output_dir,
                                           str(char_code) + ".sset")

                self.print_verbose(output_file + " (%d chars)" % \
                                       len(sequence_set))

                sset = SequenceSet(sequence_set)
                sset.write(output_file)
Exemplo n.º 2
0
    def fextract(self):
        """Extract features"""

        self.load_char_dicts()

        for dirname, char_dict in (("eval", self.eval_char_dict),
                                   ("train", self.train_char_dict)):

            for char_code, char_list in char_dict.items():
                output_dir = os.path.join(self.FEATURES_ROOT, dirname)

                if not os.path.exists(output_dir):
                    os.makedirs(output_dir)

                sequence_set = []

                for character in char_list:

                    writing = character.get_writing()

                    char_features = self.get_feature_vectors(writing)

                    sequence_set.append(char_features)

                output_file = os.path.join(output_dir,
                                           str(char_code) + ".sset")

                self.print_verbose(output_file + " (%d chars)" % \
                                       len(sequence_set))

                sset = SequenceSet(sequence_set)
                sset.write(output_file)
Exemplo n.º 3
0
 def get_sequence_set(self, file_path):
     return SequenceSet.from_file(file_path)
Exemplo n.º 4
0
 def get_sequence_set(self, file_path):
     return SequenceSet.from_file(file_path)