Sentence and Token objects
Sentence and Token objects can be regarded as the most common objects in Flair syntax. The former is used for representing sentences or any other text fragments such as paragraphs. They are essentially lists of Token
objects and their corresponding label assignments.
If you are wondering what objects, classes, and methods mean, this simply suggests that you're not particularly familiar with object-oriented programming (OOP). Luckily, OOP is super easy to get a grasp of in Python. In OOP, pieces of code that store and/or process data are organized into blueprints called classes. An example of a class could be the Word
class, which can store and process a single word. Classes in OOP can include several procedures called methods. An example of a Word
class method could be get_length()
, which would simply return a word's length. Classes can also contain a special type of method called a constructor, which gets called when the class is instantiated...