<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _sentence_to_features(self, sentence: list):
 # type: (List[Tuple[Text, Text, Text, Text]]) -> List[Dict[Text, Any]] """Convert a word into discrete features in self.crf_features, including word before and word after."""


        sentence_features = []
        prefixes = ('-1', '0', '+1')

        for word_idx in range(len(sentence)):
            # word before(-1), current word(0), next word(+1)
            word_features = {}
            for i in range(3):
                if word_idx == len(sentence) - 1 and i == 2:
                    word_features['EOS'] = True
                    # End Of Sentence
                elif word_idx == 0 and i == 0:
                    word_features['BOS'] = True
                    # Beginning Of Sentence
                else:
                    word = sentence[word_idx - 1 + i]
                    prefix = prefixes[i]
                    features = self.crf_features[i]
                    for feature in features:
                        # append each feature to a feature vector
                        value = self.function_dict[feature](word)
                        word_features[prefix + ":" + feature] = value
            sentence_features.append(word_features)
        return sentence_features