Frame Semantic Transformer#

Frame-based semantic parsing library trained on FrameNet 1.7 and built on HuggingFace’s T5 Transformer

PyPI Build Status

Live Demo: chanind.github.io/frame-semantic-transformer

Installation#

Frame Semantic Transformer releases are hosted on PyPI, and can be installed using pip as below:

pip install frame-semantic-transformer

Basic usage#

The main entry to interacting with the library is the FrameSemanticTransformer class, as shown below. For inference the detect_frames() method is likely all that is needed to perform frame parsing.

from frame_semantic_transformer import FrameSemanticTransformer

frame_transformer = FrameSemanticTransformer()

result = frame_transformer.detect_frames("The hallway smelt of boiled cabbage and old rag mats.")

print(f"Results found in: {result.sentence}")
for frame in result.frames:
    print(f"FRAME: {frame.name}")
    for element in frame.frame_elements:
        print(f"{element.name}: {element.text}")

Project Links