def test_basic_types_conflict_on_names(self): type_a = NamedBasicType("A") type_b = NamedBasicType("B") assert type_a.resolve(type_b) is None
""" Defines all types in the variable-free language for the WikiTablesQuestions dataset defined in the following paper by Liang et al. (2018) Memory Augmented Policy Optimization for Program Synthesis with Generalization. """ from allennlp.semparse.type_declarations.type_declaration import Type, NamedBasicType, ComplexType # Basic types # Note that there aren't cell types and part types in this gramamr. They are all of type string. The # constants will still come from the `TableQuestionKnowledgeGraph`, and are identified as parts and # cells, and the executor can process them accordingly, but the grammar does not differentiate # between them. Also note that columns are basic types in this grammar. ROW_TYPE = NamedBasicType("ROW") # TODO(pradeep): Add different column types for string, number, and date columns, and may be a # generic column type. # "LCOLUMN" to ensure the signature will be "l", to avoid confusion with cell. I decided to omit the # cell type eventually, and the decision to call this "LCOLUMN" is not relevant any more. But I'm # not changing it for now, because I might end up adding the cell type back later. COLUMN_TYPE = NamedBasicType("LCOLUMN") NUMBER_TYPE = NamedBasicType("NUMBER") DATE_TYPE = NamedBasicType("DATE") STRING_TYPE = NamedBasicType("STRING") BASIC_TYPES = {ROW_TYPE, COLUMN_TYPE, NUMBER_TYPE, DATE_TYPE, STRING_TYPE} STARTING_TYPES = {NUMBER_TYPE, DATE_TYPE, STRING_TYPE} # Complex types # Type for selecting the value in a column in a set of rows. "select" and "mode" functions.