NEED HELP IMPLEMENTING THE FOLLOWING FUNCTION: from typing import…

Question Answered step-by-step NEED HELP IMPLEMENTING THE FOLLOWING FUNCTION: from typing import… NEED HELP IMPLEMENTING THE FOLLOWING FUNCTION:from typing import Iterator, Sequence, Text, Tuple, Unionimport numpy as npfrom scipy.sparse import spmatrixNDArray = Union[np.ndarray, spmatrix]TokenSeq = Sequence[Text]PosSeq = Sequence[Text] class Classifier(object):    def predict(self, tokens: TokenSeq) -> PosSeq:    “””Predicts part-of-speech tags for the sequence of tokens.    This method delegates to either `predict_greedy` or `predict_viterbi`.    The implementer may decide which one to delegate to.    :param tokens: A sequence of tokens representing a sentence.    :return: A sequence of part-of-speech tags, one for each token.    “””        _, pos_tags = self.predict_greedy(tokens)        # _, _, pos_tags = self.predict_viterbi(tokens)        return pos_tags     def predict_greedy(self, tokens: TokenSeq) -> Tuple[NDArray, PosSeq]:    “””Predicts part-of-speech tags for the sequence of tokens using a    greedy algorithm, and returns the feature matrix and predicted tags.    Each part-of-speech tag is predicted one at a time, and each prediction    is considered a hard decision, that is, when predicting the    part-of-speech tag for token i, the model will assume that its    prediction for token i-1 is correct and unchangeable.   The feature matrix should have one row per input token, and be formatted   in the same way as the feature matrix in `train`.   :param tokens: A sequence of tokens representing a sentence.   :return: The feature matrix and the sequence of predicted part-of-speech   tags (one for each input token).   “”” LINK HAS THE FILE WITH THE TEST CASES AND TRAIN, TEST, DEV FILES: https://drive.google.com/drive/folders/1N5Fgj-5WUcNGkGC3F7W78k-XjKvesCKN?usp=sharing python – please help asap Computer Science Engineering & Technology Python Programming CSC 439 Share QuestionEmailCopy link Comments (0)