LsrPreprocessor

class LsrPreprocessor(rel2id_path: str, word2id_path: str, ner2id_path: str, output_file_prefix: str = 'dev', output_dir: Optional[str] = None, config: Optional[sgnlp.models.lsr.config.LsrConfig] = None, max_node_num: int = 200, max_node_per_sent: int = 40, max_sent_num: int = 30, max_sent_len: int = 200, max_entity_num: int = 100, h_t_limit: int = 1800, is_train: bool = False, device=None)[source]

Class for preprocessing a DocRED-like data batch to a tensor batch for LsrModel to predict on.

__call__(data_batch, save_output=False)[source]

Call self as a function.

extract_mdp_node(data, sdp_pos, sdp_num, sentence_start_idx)[source]

Extract meta dependency paths (MDP) node for each document