Overview
package wittgenstein_rebel_extractor
Wittgenstein REBEL Relation Extractor Library.
Provides parsers and pipeline wrappers to extract structured Knowledge Graph triplets using REBEL.
Classes
-
KGTriplet — Pydantic model representing a Knowledge Graph triplet extracted from text.
-
RebelExtractor — Wraps HuggingFace seq2seq pipeline for local relation extraction using REBEL.
Functions
-
parse_rebel_triplets — Parse raw decoded sequence output from the REBEL model into structured KGTriplet models.
wittgenstein_rebel_extractor.parse_rebel_triplets
mkapi_definition_mkapi parse_rebel_triplets(decoded_text: str) → List[KGTriplet]
Parse raw decoded sequence output from the REBEL model into structured KGTriplet models.
The expected format is
wittgenstein_rebel_extractor.KGTriplet
mkapi_definition_mkapi class KGTriplet()
Bases : BaseModel
Pydantic model representing a Knowledge Graph triplet extracted from text.
wittgenstein_rebel_extractor.RebelExtractor
mkapi_definition_mkapi class RebelExtractor(model_name: str = 'Babelscape/rebel-large', device: str = 'cpu')
Wraps HuggingFace seq2seq pipeline for local relation extraction using REBEL.
Methods
-
extract_relations — Extract structured relation triplets from text using REBEL.
wittgenstein_rebel_extractor.RebelExtractor.extract_relations
mkapi_definition_mkapi method RebelExtractor.extract_relations(text: str, max_length: int = 256, length_penalty: float = 0.1, num_beams: int = 3) → List[KGTriplet]
Extract structured relation triplets from text using REBEL.