Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Python wrapper for the FrameNet library.

branch: master

1.5 xsd python bindings

latest commit 88336b6af3
Dustin Smith authored April 15, 2011
Octocat-spinner-32 1.5 1.5 xsd python bindings April 15, 2011
Octocat-spinner-32 framenet tag March 31, 2011
Octocat-spinner-32 test tag March 31, 2011
Octocat-spinner-32 COPYING loads lexemes as defined by lexical units September 16, 2010
Octocat-spinner-32 README.md readme September 14, 2010
Octocat-spinner-32 setup.py tag March 31, 2011
README.md

FrameNet in Python

I'm now maintaining Patrick Ye's Python library for accessing FrameNet data. This version works with FrameNet version 1.3.

Getting Started

First you must obtain and install the FrameNet XML files, which are free for non-commerical and require an application. Then, you can obtain the Python Library and run:

python setup.py build
sudo python setup.py install

Second, you should set your FRAMENET_HOME environment variable to point to where you installed and uncompressed FrameNet's XML files. (Alternatively you can edit the FRAMENET_PATH constant in framenet/settings.py).

Then you can test your installation by running python test/importer.py or by opening a Python shell and typing:

import framenet
fn = framenet.FrameNet()

The first time you instantiate the FrameNet class, it will parse all of the XML files and save pickle objects. You should see:

Loading the frames ... Framenet not initialized, doing it now
Loading xml for frames ...

The first time you do this it will take a while, so go have a coffee or celebrate your next birthday.

Common Functions

  • FrameNet.lookupLexicalUnit(text, part_of_speech)

You can look up frames by the lexical units (e.g., words) and their parts of speech. For example:

buy = fn.lookupLexicalUnit('buy','v')
  • FrameNet.lookupFrame(frame)

Also, you can look up FrameNet frames by their name:

commerce_frame = fn.lookupFrame('Commerce_buy')
Something went wrong with that request. Please try again.