Skip to content

Commit

Permalink
Test example
Browse files Browse the repository at this point in the history
  • Loading branch information
alanakbik committed Dec 2, 2024
1 parent b6f9206 commit 314d59d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions flair/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def has_metadata(self, key: str) -> bool:
return key in self._metadata

def add_label(self, typename: str, value: str, score: float = 1.0, **metadata) -> "DataPoint":
"""Adds a label to the DataPoint by internally creating a Label object.
"""Adds a label to the DataPoint by internally creating a :class:`Label` object.
Args:
typename: A string that identifies the layer of annotation, such as "ner" for named entity labels or "sentiment" for sentiment labels
Expand All @@ -356,10 +356,11 @@ def add_label(self, typename: str, value: str, score: float = 1.0, **metadata) -
**metadata: Additional metadata information.
Examples:
Examples should be written in doctest format, and should illustrate how
to use the function.
>>> print([i for i in example_generator(4)])
[0, 1, 2, 3]
>>> add(2, 3)
5
>>> add(-1, 1)
0
Returns:
A pointer to itself (DataPoint object, now with an added label).
Expand Down

0 comments on commit 314d59d

Please sign in to comment.