Skip to content

Lf

LFBase

Bases: ABC

Abstract labelling function. Uses to annotate

Source code in src/annotation/lf.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class LFBase(ABC):
    """
    Abstract labelling function. Uses to annotate
    """
    def __init__(self, taxonomy: TaxonomyBase):
        """
        Taxonomy containing labels to annotate the examples with.
        :param taxonomy:
        """
        self.taxonomy = taxonomy
        self.content = True

    def annotate(self, name: str, content: str) -> np.array:
        """
        Annotate an example given the file name and it's content.
        :param name: Source file name
        :param content: Content of the file (usually identifiers)
        :return:
        """
        pass

__init__(taxonomy)

Taxonomy containing labels to annotate the examples with.

Parameters:

Name Type Description Default
taxonomy TaxonomyBase
required
Source code in src/annotation/lf.py
12
13
14
15
16
17
18
def __init__(self, taxonomy: TaxonomyBase):
    """
    Taxonomy containing labels to annotate the examples with.
    :param taxonomy:
    """
    self.taxonomy = taxonomy
    self.content = True

annotate(name, content)

Annotate an example given the file name and it's content.

Parameters:

Name Type Description Default
name str

Source file name

required
content str

Content of the file (usually identifiers)

required

Returns:

Type Description
array
Source code in src/annotation/lf.py
20
21
22
23
24
25
26
27
def annotate(self, name: str, content: str) -> np.array:
    """
    Annotate an example given the file name and it's content.
    :param name: Source file name
    :param content: Content of the file (usually identifiers)
    :return:
    """
    pass