ch.uzh.ifi.attempto.base
Interface PredictiveParser

All Known Implementing Classes:
ChartParser, GFPredictiveParser

public interface PredictiveParser

This interface describes an incremental parser capable of predicting the possible next tokens.

Author:
Tobias Kuhn

Method Summary
 void addToken(java.lang.String token)
          Adds the token to the end of the token sequence.
 void addTokens(java.util.List<java.lang.String> tokens)
          Adds the tokens to the token list.
 NextTokenOptions getNextTokenOptions()
          This method returns the options for the next token to be added at the end.
 int getReference()
          This method should return the token number to which the last token refers, if it is a reference like "it".
 int getTokenCount()
          Returns the number of tokens of the current (partial) text.
 java.util.List<java.lang.String> getTokens()
          Returns the current token sequence.
 boolean isComplete()
          Returns true if the current token sequence is a complete statement.
 boolean isPossibleNextToken(java.lang.String token)
          Returns whether the given token is a possible next token.
 void removeAllTokens()
          Removes all tokens in the current token sequence.
 void removeToken()
          Removes the last token.
 void setTokens(java.util.List<java.lang.String> tokens)
          Sets the given tokens.
 

Method Detail

addToken

void addToken(java.lang.String token)
Adds the token to the end of the token sequence.

Parameters:
token - The new token to be added.

addTokens

void addTokens(java.util.List<java.lang.String> tokens)
Adds the tokens to the token list.

Parameters:
tokens - The tokens to be added.

removeToken

void removeToken()
Removes the last token.


removeAllTokens

void removeAllTokens()
Removes all tokens in the current token sequence.


setTokens

void setTokens(java.util.List<java.lang.String> tokens)
Sets the given tokens. Existing tokens are removed.

Parameters:
tokens - The tokens.

getTokens

java.util.List<java.lang.String> getTokens()
Returns the current token sequence.

Returns:
The current token sequence.

getTokenCount

int getTokenCount()
Returns the number of tokens of the current (partial) text.

Returns:
The number of tokens.

getNextTokenOptions

NextTokenOptions getNextTokenOptions()
This method returns the options for the next token to be added at the end.

Returns:
The options describing the possible next tokens.

isPossibleNextToken

boolean isPossibleNextToken(java.lang.String token)
Returns whether the given token is a possible next token.

Parameters:
token - The token.
Returns:
true if the token is a possible next token.

isComplete

boolean isComplete()
Returns true if the current token sequence is a complete statement.

Returns:
true if the current token sequence is complete.

getReference

int getReference()
This method should return the token number to which the last token refers, if it is a reference like "it". -1 should be returned if the last token is not a reference, or if reference resolution is not implemented.

Returns:
The token number to which the last token refers.


Copyright 2008-2012, AceWiki developers