Parsing Engine

danbikel.parser
Interface DecoderServerRemote

All Superinterfaces:
Remote, Server, SwitchboardUser
All Known Implementing Classes:
CachingDecoderServer, DecoderServer

public interface DecoderServerRemote
extends Server

Specifies all methods necessary for a decoder client to get its settings and top-level probabilities from a server object.


Field Summary
 
Fields inherited from interface danbikel.switchboard.Server
acceptUnlimitedClients
 
Method Summary
 Sexp convertUnknownWord(Symbol originalWord, int index)
          Returns either the specified word untouched, or a 3-element list as would be created by convertUnknownWords(SexpList).
 SexpList convertUnknownWords(SexpList sentence)
          Replaces all unknown words in the specified sentence with three-element lists.
 Map headToParentMap()
          A mapping from head labels to possible parent labels.
 Map leftSubcatMap()
          A mapping from left subcat-prediction conditioning contexts (typically parent and head nonterminal labels) to all possible left subcat frames.
 ProbabilityStructure leftSubcatProbStructure()
          The probability structure for the submodel that generates subcats on the left-hand side of head constituents.
 double logPrior(int id, TrainerEvent event)
          Returns the prior probability of generating the nonterminal contained in the specified HeadEvent.
 double logProbGap(int id, TrainerEvent event)
          Returns the log of the probability of generating a gap.
 double logProbHead(int id, TrainerEvent event)
          Returns the log of the probability of generating a head child in the context of a particular parent (both the head to be generated and the parent are contained in the specified TrainerEvent object).
 double logProbHeadWithSubcats(int id, TrainerEvent event)
          Returns the log of the probability of generating a new head and its left and right subcat frames.
 double logProbLeftSubcat(int id, TrainerEvent event)
          Returns the log of the probability of generating a left subcat in the context of a particular parent and head (the subcat to be generated, the head and parent are all contained in the specified TrainerEvent object).
 double logProbMod(int id, TrainerEvent event)
          Returns the log of the probability of generating a fully-lexicalized modifying nonterminal given a particular parent, head and other components of the syntactic context.
 double logProbModNT(int id, TrainerEvent event)
          Returns the log of the probability of generating a partially-lexicalized modifying nonterminal given a particular parent, head and other components of the syntactic context.
 double logProbRightSubcat(int id, TrainerEvent event)
          Returns the log of the probability of generating a right subcat in the context of a particular parent and head (the subcat to be generated, the head and parent are all contained in the specified TrainerEvent object).
 double logProbSubcat(int id, TrainerEvent event, boolean side)
          Invokes logProbLeftSubcat(int, TrainerEvent) or logProbRightSubcat(int, TrainerEvent) depending on the value of side.
 double logProbTop(int id, TrainerEvent event)
          Returns the log of the probability of generating the head nonterminal of an entire sentence.
 Map modNonterminalMap()
          A map of events from the last back-off level of the modifier nonterminal–generation submodel to the set of possible futures (typically, a future is a modifier label and its head word's part-of-speech tag).
 ProbabilityStructure modNonterminalProbStructure()
          The probability structure for the submodel that generates modifiers of head constituents.
 CountsTable nonterminals()
          A counts table of unlexicalized nonterminals, i.e., a map of unlexicalized nonterminals to their respective frequencies in the training data.
 Map posMap()
          Returns the map of vocabulary items to possible parts of speech, contained in the internal ModelCollection object.
 double probHead(int id, TrainerEvent event)
          Returns the probability of generating a head child in the context of a particular parent (both the head to be generated and the parent are contained in the specified TrainerEvent object).
 double probLeftSubcat(int id, TrainerEvent event)
          Returns the probability of generating a left subcat in the context of a particular parent and head (the subcat to be generated, the head and parent are all contained in the specified TrainerEvent object).
 double probMod(int id, TrainerEvent event)
          Returns the probability of generating a fully-lexicalized modifying nonterminal given a particular parent, head and other components of the syntactic context.
 double probRightSubcat(int id, TrainerEvent event)
          Returns the probability of generating a right subcat in the context of a particular parent and head (the subcat to be generated, the head and parent are all contained in the specified TrainerEvent object).
 double probTop(int id, TrainerEvent event)
          Returns the probability of generating the head nonterminal of an entire sentence.
 Set prunedPreterms()
          A set of Sexp objects representing preterminals that were pruned during training.
 Set prunedPunctuation()
          Returns the set of preterminals (Sexp objects) that were punctuation elements that were “raised away” because they were either at the beginning or end of a sentence.
 Map rightSubcatMap()
          A mapping from right subcat-prediction conditioning contexts (typically parent and head nonterminal labels) to all possible right subcat frames.
 ProbabilityStructure rightSubcatProbStructure()
          The probability structure for the submodel that generates subcats on the right-hand side of head constituents.
 Map simpleModNonterminalMap()
          A map from unlexicalized parent-head-side triples to all possible partially-lexicalized modifying nonterminals.
 double testProb()
          Returns a test probability (for debugging purposes).
 
Methods inherited from interface danbikel.switchboard.Server
acceptClientsOnlyByRequest, id, maxClients
 
Methods inherited from interface danbikel.switchboard.SwitchboardUser
alive, die, host
 

Method Detail

posMap

public Map posMap()
           throws RemoteException
Returns the map of vocabulary items to possible parts of speech, contained in the internal ModelCollection object. This map is needed when decoding.

Throws:
RemoteException

headToParentMap

public Map headToParentMap()
                    throws RemoteException
A mapping from head labels to possible parent labels. The keys of this map are Symbol obects, and the values are Set objects containing Symbol objects.

Returns:
a mapping from head labels to possible parent labels
Throws:
RemoteException

leftSubcatMap

public Map leftSubcatMap()
                  throws RemoteException
A mapping from left subcat-prediction conditioning contexts (typically parent and head nonterminal labels) to all possible left subcat frames. The keys should represent the conditioning contexts that are the last back-off level of the subcat-prediction models. The keys of this map are Event objects, and the values are Set objects containing Subcat objects.

Throws:
RemoteException

rightSubcatMap

public Map rightSubcatMap()
                   throws RemoteException
A mapping from right subcat-prediction conditioning contexts (typically parent and head nonterminal labels) to all possible right subcat frames. The keys should represent the conditioning contexts that are the last back-off level of the subcat-prediction models. The keys of this map are Event objects, and the values are Set objects containing Subcat objects.

Throws:
RemoteException

modNonterminalMap

public Map modNonterminalMap()
                      throws RemoteException
A map of events from the last back-off level of the modifier nonterminal–generation submodel to the set of possible futures (typically, a future is a modifier label and its head word's part-of-speech tag). The keys are instances of Event, and the values are Set instances containing Event objects.

Throws:
RemoteException

simpleModNonterminalMap

public Map simpleModNonterminalMap()
                            throws RemoteException
A map from unlexicalized parent-head-side triples to all possible partially-lexicalized modifying nonterminals. This map provides a simpler mechanism for determining whether a given modifier is possible in the current parent-head context than is provided by modNonterminalMap().

The keys are SexpList objects containing exactly three Symbol elements representing the following in a production:

  1. an unlexicalized parent nonterminal
  2. an unlexicalized head nonterminal
  3. the direction of modification, either Constants.LEFT or Constants.RIGHT.

The values consist of Set objects containing SexpList objects that contain exactly two Symbol elements representing a partially-lexicalized modifying nonterminal:

  1. the unlexicalized modifying nonterminal
  2. the part-of-speech tag of the modifying nonterminal's head word.

An example of a partially-lexicalized nonterminal in the Penn Treebank is NP(NNP), which is a noun phrase headed by a singular proper noun.

Throws:
RemoteException
See Also:
Settings.useSimpleModNonterminalMap

nonterminals

public CountsTable nonterminals()
                         throws RemoteException
A counts table of unlexicalized nonterminals, i.e., a map of unlexicalized nonterminals to their respective frequencies in the training data.

Returns:
a counts table of unlexicalized nonterminals
Throws:
RemoteException

prunedPreterms

public Set prunedPreterms()
                   throws RemoteException
A set of Sexp objects representing preterminals that were pruned during training.

Returns:
a set of Sexp objects representing preterminals that were pruned during training.
Throws:
RemoteException
See Also:
Training.prune(Sexp), Treebank.isPreterminal(Sexp)

prunedPunctuation

public Set prunedPunctuation()
                      throws RemoteException
Returns the set of preterminals (Sexp objects) that were punctuation elements that were “raised away” because they were either at the beginning or end of a sentence.

Throws:
RemoteException
See Also:
Training.raisePunctuation(Sexp), Treebank.isPuncToRaise(Sexp)

convertUnknownWord

public Sexp convertUnknownWord(Symbol originalWord,
                               int index)
                        throws RemoteException
Returns either the specified word untouched, or a 3-element list as would be created by convertUnknownWords(SexpList).

Parameters:
originalWord - the original word to be (potentially) converted
index - the index of the specified word
Returns:
if the specified word is unknown, a 3-element list is returned, as described in convertUnknownWords(SexpList), or, if the specified word is not unknown, then it is returned untouched
Throws:
RemoteException

convertUnknownWords

public SexpList convertUnknownWords(SexpList sentence)
                             throws RemoteException
Replaces all unknown words in the specified sentence with three-element lists. Each element is a symbol, and, in order, these three symbols represent

Parameters:
sentence - a list of symbols representing a sentence to be parsed
Throws:
RemoteException

leftSubcatProbStructure

public ProbabilityStructure leftSubcatProbStructure()
                                             throws RemoteException
The probability structure for the submodel that generates subcats on the left-hand side of head constituents. This structure is needed to derive most-general contexts (using the last level of back-off) in order to determine all possible left-side subcat frames for a given context, using the leftSubcatMap().

Throws:
RemoteException

rightSubcatProbStructure

public ProbabilityStructure rightSubcatProbStructure()
                                              throws RemoteException
The probability structure for the submodel that generates subcats on the right-hand side of head constituents. This structure is needed to derive most-general contexts (using the last level of back-off) in order to determine all possible left-side subcat frames for a given context, using the rightSubcatMap().

Throws:
RemoteException

modNonterminalProbStructure

public ProbabilityStructure modNonterminalProbStructure()
                                                 throws RemoteException
The probability structure for the submodel that generates modifiers of head constituents. This structure is needed to derive most-general contexts (using the last level of back-off) in order to determine all possible modifiers for a given context, using the modNonterminalMap().

Throws:
RemoteException

testProb

public double testProb()
                throws RemoteException
Returns a test probability (for debugging purposes).

Throws:
RemoteException

logPrior

public double logPrior(int id,
                       TrainerEvent event)
                throws RemoteException
Returns the prior probability of generating the nonterminal contained in the specified HeadEvent.

Throws:
RemoteException

logProbHeadWithSubcats

public double logProbHeadWithSubcats(int id,
                                     TrainerEvent event)
                              throws RemoteException
Returns the log of the probability of generating a new head and its left and right subcat frames.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the log of the probability of generating a new head and its left and right subcat frames
Throws:
RemoteException

logProbHead

public double logProbHead(int id,
                          TrainerEvent event)
                   throws RemoteException
Returns the log of the probability of generating a head child in the context of a particular parent (both the head to be generated and the parent are contained in the specified TrainerEvent object).

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the log of the probability of generating the new head
Throws:
RemoteException

logProbLeftSubcat

public double logProbLeftSubcat(int id,
                                TrainerEvent event)
                         throws RemoteException
Returns the log of the probability of generating a left subcat in the context of a particular parent and head (the subcat to be generated, the head and parent are all contained in the specified TrainerEvent object).

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the log of the probability of generating the left subcat
Throws:
RemoteException

logProbRightSubcat

public double logProbRightSubcat(int id,
                                 TrainerEvent event)
                          throws RemoteException
Returns the log of the probability of generating a right subcat in the context of a particular parent and head (the subcat to be generated, the head and parent are all contained in the specified TrainerEvent object).

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the log of the probability of generating the right subcat
Throws:
RemoteException

logProbSubcat

public double logProbSubcat(int id,
                            TrainerEvent event,
                            boolean side)
                     throws RemoteException
Invokes logProbLeftSubcat(int, TrainerEvent) or logProbRightSubcat(int, TrainerEvent) depending on the value of side.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
side - either Constants.LEFT or Constants.RIGHT
Returns:
the value of logProbLeftSubcat(int, TrainerEvent) or logProbRightSubcat(int, TrainerEvent)
Throws:
RemoteException

logProbTop

public double logProbTop(int id,
                         TrainerEvent event)
                  throws RemoteException
Returns the log of the probability of generating the head nonterminal of an entire sentence.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the log of the probability of generating the head nonterminal of an entire sentence
Throws:
RemoteException

logProbMod

public double logProbMod(int id,
                         TrainerEvent event)
                  throws RemoteException
Returns the log of the probability of generating a fully-lexicalized modifying nonterminal given a particular parent, head and other components of the syntactic context.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the log of the probability of generating the lexicalized modifying nonterminal
Throws:
RemoteException

logProbModNT

public double logProbModNT(int id,
                           TrainerEvent event)
                    throws RemoteException
Returns the log of the probability of generating a partially-lexicalized modifying nonterminal given a particular parent, head and other components of the syntactic context.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the log of the probability of generating a partially-lexicalized modifying nonterminal
Throws:
RemoteException

logProbGap

public double logProbGap(int id,
                         TrainerEvent event)
                  throws RemoteException
Returns the log of the probability of generating a gap.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the log of the probability of generating a gap
Throws:
RemoteException

probHead

public double probHead(int id,
                       TrainerEvent event)
                throws RemoteException
Returns the probability of generating a head child in the context of a particular parent (both the head to be generated and the parent are contained in the specified TrainerEvent object).

N.B.: This method is unsupported when Settings.precomputeProbs is true.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the probability of generating the new head
Throws:
RemoteException

probMod

public double probMod(int id,
                      TrainerEvent event)
               throws RemoteException
Returns the probability of generating a fully-lexicalized modifying nonterminal given a particular parent, head and other components of the syntactic context.

N.B.: This method is unsupported when Settings.precomputeProbs is true.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the probability of generating the lexicalized modifying nonterminal
Throws:
RemoteException

probLeftSubcat

public double probLeftSubcat(int id,
                             TrainerEvent event)
                      throws RemoteException
Returns the probability of generating a left subcat in the context of a particular parent and head (the subcat to be generated, the head and parent are all contained in the specified TrainerEvent object).

N.B.: This method is unsupported when Settings.precomputeProbs is true.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the probability of generating the left subcat
Throws:
RemoteException

probRightSubcat

public double probRightSubcat(int id,
                              TrainerEvent event)
                       throws RemoteException
Returns the probability of generating a right subcat in the context of a particular parent and head (the subcat to be generated, the head and parent are all contained in the specified TrainerEvent object).

N.B.: This method is unsupported when Settings.precomputeProbs is true.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the probability of generating the right subcat
Throws:
RemoteException

probTop

public double probTop(int id,
                      TrainerEvent event)
               throws RemoteException
Returns the probability of generating the head nonterminal of an entire sentence.

N.B.: This method is unsupported when Settings.precomputeProbs is true.

Parameters:
id - the unique id of the client invoking the method
event - the top-level TrainerEvent, containing the complete context needed to compute the requested probability
Returns:
the probability of generating the head nonterminal of an entire sentence
Throws:
RemoteException

Parsing Engine

Author: Dan Bikel.