File size: 586 Bytes
259afe6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from typing import List

import os

import fasttext.util

class PreTrainedPipeline():

    def __init__(self, path=""):

        """

        Initialize model

        """

        self.model = fasttext.load_model(os.path.join(path, 'debate2vec.bin'))

    def __call__(self, inputs: str) -> List[float]:

        """

        Args:

            inputs (:obj:`str`):

                a string to get the features of.

        Return:

            A :obj:`list` of floats: The features computed by the model.

        """

        return self.model.get_sentence_vector(inputs).tolist()