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

List of all members.

Static Public Member Functions

static boolean isNonterminal (String token)
static String cleanNonterminal (String nt)
static String cleanIndexedNonterminal (String nt)
static String stripNt (String nt)
static int getNonterminalIndex (String nt)
static String markup (String nt)
static String markup (String nt, int index)
static boolean isNumber (String string)
static boolean useUTF8 ()

Static Package Functions

 [static initializer]

Static Private Attributes

static Map< String, String > cache

Detailed Description

Utility class for format issues.

Author:
Juri Ganitkevitch
Lane Schwartz

Member Function Documentation

joshua.util.FormatUtils.[static initializer] ( ) [static, package]
static String joshua.util.FormatUtils.cleanIndexedNonterminal ( String  nt) [static]

Here is the caller graph for this function:

static String joshua.util.FormatUtils.cleanNonterminal ( String  nt) [static]

Nonterminals are stored in the vocabulary in square brackets. This removes them when you just want the raw nonterminal word.

Parameters:
ntthe nonterminal, e.g., "[GOAL]"
Returns:
the cleaned nonterminal, e.g., "GOAL"

Here is the call graph for this function:

Here is the caller graph for this function:

static int joshua.util.FormatUtils.getNonterminalIndex ( String  nt) [static]

Here is the caller graph for this function:

static boolean joshua.util.FormatUtils.isNonterminal ( String  token) [static]

Determines whether the string is a nonterminal by checking that the first character is [ and the last character is ].

Parameters:
token
Returns:
true if it's a nonterminal symbol, false otherwise

Here is the caller graph for this function:

static boolean joshua.util.FormatUtils.isNumber ( String  string) [static]

Returns true if the String parameter represents a valid number.

The body of this method is taken from the Javadoc documentation for the Java Double class.

Parameters:
string
See also:
java.lang.Double
Returns:
true if the string represents a valid number, false otherwise
static String joshua.util.FormatUtils.markup ( String  nt) [static]

Ensures that a string looks like what the system considers a nonterminal to be.

Parameters:
ntthe nonterminal string
Returns:
the nonterminal string surrounded in square brackets (if not already)

Here is the call graph for this function:

Here is the caller graph for this function:

static String joshua.util.FormatUtils.markup ( String  nt,
int  index 
) [static]
static String joshua.util.FormatUtils.stripNt ( String  nt) [static]

Here is the call graph for this function:

Here is the caller graph for this function:

static boolean joshua.util.FormatUtils.useUTF8 ( ) [static]

Set System.out and System.err to use the UTF8 character encoding.

Returns:
true if both System.out and System.err were successfully set to use UTF8, false otherwise.

Here is the caller graph for this function:


Member Data Documentation

Map<String, String> joshua.util.FormatUtils.cache [static, private]