コード例 #1
0
    def id_to_string(self, string_id, encoded_from=None, train=None):
        """Returns decoded string from int id."""

        string = self.strings[string_id]

        # Special strings are not encoded
        if string in ["<pad>", "<unk>", "<none>", "<root>", "<anchor>"]:
            return string
        else:
            # Decode string with lemma rule
            if self.is_encoded == None or self.is_encoded == True:
                return Lemmatizer.apply_lemma_rule(encoded_from, string)
            else:
                return string