allennlp.tools.wikitables_evaluator

This is the official evaluator taken from the original dataset. I made minimal changes to make it Python 3 compatible, and conform to our style guidelines.

class allennlp.tools.wikitables_evaluator.DateValue(year, month, day, original_string=None)[source]

Bases: allennlp.tools.wikitables_evaluator.Value

match(other)[source]
static parse(text)[source]

Try to parse into a date.

Return:
tuple (year, month, date) if successful; otherwise None.
ymd
class allennlp.tools.wikitables_evaluator.NumberValue(amount, original_string=None)[source]

Bases: allennlp.tools.wikitables_evaluator.Value

amount
match(other)[source]
static parse(text)[source]

Try to parse into a number.

Return:
the number (int or float) if successful; otherwise None.
class allennlp.tools.wikitables_evaluator.StringValue(content)[source]

Bases: allennlp.tools.wikitables_evaluator.Value

match(other)[source]
class allennlp.tools.wikitables_evaluator.Value[source]

Bases: object

match(other)[source]

Return True if the value matches the other value.

Args:
other (Value)
Returns:
a boolean
normalized
allennlp.tools.wikitables_evaluator.check_denotation(target_values, predicted_values)[source]

Return True if the predicted denotation is correct.

Args:
target_values (list[Value]) predicted_values (list[Value])
Returns:
bool
allennlp.tools.wikitables_evaluator.main()[source]
allennlp.tools.wikitables_evaluator.normalize(x)[source]
allennlp.tools.wikitables_evaluator.to_value(original_string, corenlp_value=None)[source]

Convert the string to Value object.

Args:
original_string (basestring): Original string corenlp_value (basestring): Optional value returned from CoreNLP
Returns:
Value
allennlp.tools.wikitables_evaluator.to_value_list(original_strings, corenlp_values=None)[source]

Convert a list of strings to a list of Values

Args:
original_strings (list[basestring]) corenlp_values (list[basestring or None])
Returns:
list[Value]
allennlp.tools.wikitables_evaluator.tsv_unescape(x)[source]

Unescape strings in the TSV file. Escaped characters include: - newline (0x10) -> backslash + n - vertical bar (0x7C) -> backslash + p - backslash (0x5C) -> backslash + backslash

Parameters:
x : str
Returns:
``str``
allennlp.tools.wikitables_evaluator.tsv_unescape_list(x)[source]

Unescape a list in the TSV file. List items are joined with vertical bars (0x5C)

Args:
x (str or unicode)
Returns:
a list of unicodes