Models¶
Named Entity Recognizer¶
-
class
forte.models.ner.conditional_random_field.
ConditionalRandomField
(num_tags, constraints=None, include_start_end_transitions=True)[source]¶ This module uses the “forward-backward” algorithm to compute the log-likelihood of its inputs assuming a conditional random field model.
See, e.g. http://www.cs.columbia.edu/~mcollins/fb.pdf
- Parameters
num_tags (
int
) – The number of tags.constraints (
Optional
[List
[Tuple
[int
,int
]]]) – An optional list of allowed transitions (from_tag_id, to_tag_id). These are applied toviterbi_tags()
but do not affectforward()
. These should be derived from allowed_transitions so that the start and end transitions are handled correctly for your tag type.include_start_end_transitions (
bool
) – Whether to include the start and end transition parameters.
Semantic Role Labeling¶
-
class
forte.models.srl.model.
LabeledSpanGraphNetwork
(word_vocab, char_vocab, hparams=None)[source]¶ -
property
output_size
¶ This module is supposed to be the last layer so we will not return an informative output_size Returns:
-
static
default_hparams
()[source]¶ Returns a dict of hyperparameters of the module with default values. Used to replace the missing values of input hparams during module construction.
{ "name": "module" }
-
forward
(inputs)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type
-
property