functions.predict module#

functions.predict.predict_rel(sc_model, rel_model, text)#

Predicts spans and the relations between them contained in given text determined by the given span categorization and relation extraction model.

Parameters:
  • sc_model (str) – File path of span categorization model to be used.

  • rel_model (str) – File path of relation extraction model to be used.

  • text (str) – Text content to predict spans and relations within.

Returns:

Dictionary with each key being a tuple of span labels for which a relation exists, and each value being a list of tuples containing a tuple of the related span texts and prediction confidence score of that relation.

Return type:

dict

functions.predict.predict_span(sc_model, text)#

Predicts spans contained in given text determined by the given span categorization model.

Parameters:
  • sc_model (str) – File path of span categorization model to be used.

  • text (str) – Text content to predict spans within.

Returns:

Dictionary with each key corresponding to a span label, and each value being a list of tuples containing the span text and prediction confidence score of that label.

Return type:

dict