Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
joshua.corpus.AbstractPhrase Class Reference
Inheritance diagram for joshua.corpus.AbstractPhrase:
[legend]
Collaboration diagram for joshua.corpus.AbstractPhrase:
[legend]

List of all members.

Public Member Functions

int hashCode ()
boolean equals (Object o)
int compareTo (Phrase other)
String toString ()

Static Public Attributes

static final int HASH_SEED = 17
static final int HASH_OFFSET = 37

Protected Member Functions

int[] splitSentence (String sentence)

Detailed Description

This class provides a skeletal implementation of the base methods likely to be common to most or all implementations of the Phrase interface.

Author:
Lane Schwartz
Chris Callison-Burch

Member Function Documentation

Compares the two strings based on the lexicographic order of words defined in the Vocabulary.

Parameters:
otherthe object to compare to
Returns:
-1 if this object is less than the parameter, 0 if equals, 1 if greater
Exceptions:
ClassCastExceptionif the passed object is not of type Phrase

Implements joshua.corpus.Phrase.

Here is the call graph for this function:

boolean joshua.corpus.AbstractPhrase.equals ( Object  o)

Two phrases are their word IDs are the same. Note that this could give a false positive if their Vocabularies were different but their IDs were somehow the same.

Here is the call graph for this function:

Uses the standard java approach of calculating hashCode. Start with a seed, add in every value multiplying the exsiting hash times an offset.

Returns:
int hashCode for the list

Here is the call graph for this function:

int [] joshua.corpus.AbstractPhrase.splitSentence ( String  sentence) [protected]

Splits a sentence (on white space), then looks up the integer representations of each word using the supplied symbol table.

Parameters:
sentenceWhite-space separated String of words.
Returns:
Array of integers corresponding to the words in the sentence.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns a string representation of the phrase.

Returns:
a space-delimited string of the words in the phrase.

Implements joshua.corpus.Phrase.

Reimplemented in joshua.corpus.BasicPhrase.

Here is the call graph for this function:


Member Data Documentation

offset used in has code generation

final int joshua.corpus.AbstractPhrase.HASH_SEED = 17 [static]

seed used in hash code generation