def create_all_relations_and_features(self):
        """Creating all possible relations between all entities.

        Creating features here for performance.
        """
        all_relations = []

        feature = None

        for source in self.events + self.timex:
            for target in self.events + self.timex:
                for i, time in enumerate(RelationType()):
                    new_relation = Relation("all", self, source, target, time)

                    # We don't have the feature yet
                    if i == 0:
                        f = Feature(new_relation)
                        feature = f.get_feature()

                    if new_relation in self.relations:
                        continue
                    else:
                        new_relation.set_feature(feature)
                        all_relations.append(new_relation)

                feature = None

        self.relations = self.relations + all_relations
    def _get_feature(self, text_obj):
        """Get feature data for a whole text object."""
        try:
            for relation in text_obj.relations:
                if relation.is_event_event():
                    f = Feature(relation, strings_cache_g, nlp_persistence_obj_g, duration_cache_g, discourse_cache_g, features_event_event_g)
                    feature = f.get_feature()
                    relation.set_feature(feature)

                elif relation.is_event_timex():
                    f = Feature(relation, strings_cache_g, nlp_persistence_obj_g, duration_cache_g, discourse_cache_g, features_event_timex_g)
                    feature = f.get_feature()
                    relation.set_feature(feature)

                # Append feature to relation in text_obj.relations_plain if existant
                if relation.is_event_event() or relation.is_event_timex():
                    if relation in text_obj.relations_plain:
                        # Search for relation
                        for rel in text_obj.relations_plain:
                            if rel == relation:
                                rel.set_feature(feature)
                                break

            # Print progress
            with _counter_lock:
                _counter.value += 1

                sys.stdout.write("\r%d%%" % int(_counter.value*100/(_length - 1)))
                sys.stdout.flush()

            return text_obj

        except Exception as e:
            # Print progress
            with _counter_lock:
                _counter.value += 1

                sys.stdout.write("\r%d%%" % int(_counter.value*100/(_length - 1)))
                sys.stdout.flush()

            print e
            print traceback.format_exc()