se.lth.cs.nlp.nlputils.framenet
Class FrameNet

java.lang.Object
  extended by se.lth.cs.nlp.nlputils.framenet.FrameNet

public class FrameNet
extends Object

An interface to the FrameNet database.

Author:
Richard Johansson (richard@cs.lth.se)

Constructor Summary
FrameNet(String frames, String frRel)
          Creates a FrameNet from the database files.
FrameNet(String frames, String frRel, boolean use_all)
          Creates a FrameNet from the database files.
FrameNet(String frames, String frRel, boolean use_all, String filterFile)
          Creates a FrameNet from the database files.
FrameNet(String frames, String frRel, String filterFile)
          Creates a FrameNet from the database files.
 
Method Summary
 void dumpFrames(PrintWriter out)
           
 Set<String> getAllLemmas()
          Returns the set of all FrameNet lemmas.
 String getConvertedLemma(String fnLemma)
          Converts an unstandardized lemma to a standardized.
 Set<Pair<String,String>> getExcludes(String frame)
          Returns the list of Excludes pairs for the given frame.
 String getFNLemma(String converted)
          Converts a standardized lemma to an unstandardized.
 List<String> getFrameElementNames(String frame)
          Looks up the list of frame element names for a frame.
 List<FrameElement> getFrameElements(String frame)
          Looks up the list of frame elements for a frame.
 List<String> getFramesByLemma(String lemma)
          Looks up a list of frames given a lemma.
 List<Pair<String,String>> getLemmasByHeadPos(String lem, String pos)
          Looks up a list of lemma-frame pairs given a single-word lemma and its POS (which must be N, V, or A).
 Set<Pair<String,String>> getRequires(String frame)
          Returns the set of Requires pairs for the given frame.
 String simpleDisambiguation(List<String> frames, Collection<String> labels)
          Returns the set of possible frames, given a set of assigned FEs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FrameNet

public FrameNet(String frames,
                String frRel,
                boolean use_all,
                String filterFile)
Creates a FrameNet from the database files.

Parameters:
frames - the name of the FrameNet file.
frRel - the name of the relation file.
use_all - whether all frames, or just those with non-empty annotation sets, should be used.
filterFile - the name of a file with the list of used frames. May be null.

FrameNet

public FrameNet(String frames,
                String frRel)
Creates a FrameNet from the database files.

Parameters:
frames - the name of the FrameNet file.
frRel - the name of the relation file.

FrameNet

public FrameNet(String frames,
                String frRel,
                boolean use_all)
Creates a FrameNet from the database files.

Parameters:
frames - the name of the FrameNet file.
frRel - the name of the relation file.
use_all - whether all frames, or just those with non-empty annotation sets, should be used.

FrameNet

public FrameNet(String frames,
                String frRel,
                String filterFile)
Creates a FrameNet from the database files.

Parameters:
frames - the name of the FrameNet file.
frRel - the name of the relation file.
filterFile - the name of a file with the list of used frames. May be null.
Method Detail

getFramesByLemma

public List<String> getFramesByLemma(String lemma)
Looks up a list of frames given a lemma. For instance: "play.v" -> [Performers_and_roles, Cause_to_make_noise, Competition]

Parameters:
lemma - the lemma.
Returns:
the list of frames for that lemma.

getLemmasByHeadPos

public List<Pair<String,String>> getLemmasByHeadPos(String lem,
                                                    String pos)
Looks up a list of lemma-frame pairs given a single-word lemma and its POS (which must be N, V, or A). For instance: ("hand", "V") -> [("hand.v", ...), ("hand over.v", ...), ...]

Parameters:
lem - the single-word lemma.
pos - the pos of the lemma.
Returns:
the list of lemma-frame pairs.

getFrameElements

public List<FrameElement> getFrameElements(String frame)
Looks up the list of frame elements for a frame. For instance: Impact -> [(Impactor, Imp, Core, ...) , (Impactee, ...)]

Parameters:
frame - the frame.
Returns:
the list of frame elements.

getFrameElementNames

public List<String> getFrameElementNames(String frame)
Looks up the list of frame element names for a frame.

Parameters:
frame - the frame.
Returns:
the list of frame element names.

getConvertedLemma

public String getConvertedLemma(String fnLemma)
Converts an unstandardized lemma to a standardized.

Parameters:
fnLemma - the lemma in unstandardized FrameNet form.
Returns:
the standardized lemma.

getFNLemma

public String getFNLemma(String converted)
Converts a standardized lemma to an unstandardized.

Parameters:
converted - the standardized lemma.
Returns:
the unstandardized.

simpleDisambiguation

public String simpleDisambiguation(List<String> frames,
                                   Collection<String> labels)
Returns the set of possible frames, given a set of assigned FEs. If more than one frame is possible, the frames are returned in a string separated by '#'. If no frame is possible, the string "ILLEGAL" is returned.

Parameters:
frames - the list of all possible frames.
labels - the assigned FEs.
Returns:
the frame string as described above.

getAllLemmas

public Set<String> getAllLemmas()
Returns the set of all FrameNet lemmas.

Returns:
the set of lemmas.

getExcludes

public Set<Pair<String,String>> getExcludes(String frame)
Returns the list of Excludes pairs for the given frame.

Parameters:
frame - the frame.
Returns:
the list of Excludes pairs.

getRequires

public Set<Pair<String,String>> getRequires(String frame)
Returns the set of Requires pairs for the given frame.

Parameters:
frame - the frame.
Returns:
the list of Requires pairs.

dumpFrames

public void dumpFrames(PrintWriter out)