sgnlp.models.span_extraction.utils.truncate_to_max_length

truncate_to_max_length(feature: List[transformers.data.processors.squad.SquadFeatures], max_length: int)List[transformers.data.processors.squad.SquadFeatures][source]

Truncate length of SquadFeatures’ attributes

Parameters
  • feature (List[SquadFeatures]) – list of SquadFeatures

  • max_length (int) – set maximum length of tokens

Returns

list of truncated SquadFeatures

Return type

List[SquadFeatures]