python_code
stringlengths
0
187k
repo_name
stringlengths
8
46
file_path
stringlengths
6
135
from allennlp_demo.atis_parser.api import AtisParserModelEndpoint from allennlp_demo.common.testing import ModelEndpointTestCase class TestAtisParserModelEndpoint(ModelEndpointTestCase): endpoint = AtisParserModelEndpoint() predict_input = {"utterance": "show me the flights from detroit to westchester county"...
allennlp-demo-main
api/allennlp_demo/atis_parser/test_api.py
allennlp-demo-main
api/allennlp_demo/roberta_snli/__init__.py
import os from allennlp_demo.common import config, http class RobertaSnliModelEndpoint(http.ModelEndpoint): def __init__(self): c = config.Model.from_file(os.path.join(os.path.dirname(__file__), "model.json")) super().__init__(c) if __name__ == "__main__": endpoint = RobertaSnliModelEndpoin...
allennlp-demo-main
api/allennlp_demo/roberta_snli/api.py
from allennlp_demo.common.testing import ModelEndpointTestCase from allennlp_demo.roberta_snli.api import RobertaSnliModelEndpoint class TestRobertaSnliModelEndpoint(ModelEndpointTestCase): endpoint = RobertaSnliModelEndpoint() predict_input = { "hypothesis": "Two women are sitting on a blanket near s...
allennlp-demo-main
api/allennlp_demo/roberta_snli/test_api.py
allennlp-demo-main
api/allennlp_demo/nmn_drop/__init__.py
import os from allennlp.common.util import import_submodules from allennlp_demo.common import config, http class NMNDropModelEndpoint(http.ModelEndpoint): def __init__(self): import_submodules("semqa") c = config.Model.from_file(os.path.join(os.path.dirname(__file__), "model.json")) supe...
allennlp-demo-main
api/allennlp_demo/nmn_drop/api.py
from overrides import overrides from allennlp_demo.nmn_drop.api import NMNDropModelEndpoint from allennlp_demo.common.testing import RcModelEndpointTestCase class TestNMNDropModelEndpoint(RcModelEndpointTestCase): endpoint = NMNDropModelEndpoint() @overrides def check_predict_result(self, result): ...
allennlp-demo-main
api/allennlp_demo/nmn_drop/test_api.py
allennlp-demo-main
api/allennlp_demo/vilbert_vqa/__init__.py
import os import tempfile from base64 import standard_b64decode from allennlp.common.util import JsonDict from allennlp_demo.common import config, http class VilbertVqaModelEndpoint(http.ModelEndpoint): def __init__(self): c = config.Model.from_file(os.path.join(os.path.dirname(__file__), "model.json")...
allennlp-demo-main
api/allennlp_demo/vilbert_vqa/api.py
from overrides import overrides from allennlp_demo.common.testing import RcModelEndpointTestCase from allennlp_demo.vilbert_vqa.api import VilbertVqaModelEndpoint class TestVilbertVqaModelEndpoint(RcModelEndpointTestCase): endpoint = VilbertVqaModelEndpoint() predict_input = { "question": "What game...
allennlp-demo-main
api/allennlp_demo/vilbert_vqa/test_api.py
allennlp-demo-main
api/allennlp_demo/binary_gender_bias_mitigated_roberta_snli/__init__.py
import os from allennlp_demo.common import config, http class BinaryGenderBiasMitigatedRobertaSnliModelEndpoint(http.ModelEndpoint): def __init__(self): c = config.Model.from_file(os.path.join(os.path.dirname(__file__), "model.json")) super().__init__(c) if __name__ == "__main__": endpoint ...
allennlp-demo-main
api/allennlp_demo/binary_gender_bias_mitigated_roberta_snli/api.py
from allennlp_demo.common.testing import ModelEndpointTestCase from allennlp_demo.binary_gender_bias_mitigated_roberta_snli.api import ( BinaryGenderBiasMitigatedRobertaSnliModelEndpoint, ) class TestBinaryGenderBiasMitigatedRobertaSnliModelEndpoint(ModelEndpointTestCase): endpoint = BinaryGenderBiasMitigated...
allennlp-demo-main
api/allennlp_demo/binary_gender_bias_mitigated_roberta_snli/test_api.py
allennlp-demo-main
api/allennlp_demo/coref/__init__.py
import os from allennlp_demo.common import config, http class CorefModelEndpoint(http.ModelEndpoint): def __init__(self): c = config.Model.from_file(os.path.join(os.path.dirname(__file__), "model.json")) super().__init__(c) if __name__ == "__main__": endpoint = CorefModelEndpoint() endp...
allennlp-demo-main
api/allennlp_demo/coref/api.py
from allennlp_demo.common.testing import ModelEndpointTestCase from allennlp_demo.coref.api import CorefModelEndpoint class TestCorefModelEndpoint(ModelEndpointTestCase): endpoint = CorefModelEndpoint() predict_input = {"document": "The woman reading a newspaper sat on the bench with her dog."}
allennlp-demo-main
api/allennlp_demo/coref/test_api.py
""" Script to verify that all demo models are covered by CI in our GitHub Actions workflow. """ import yaml import os import logging from typing import Iterable WORKFLOW_FILE_PATH = ".github/workflows/api_ci.yml" logging.basicConfig() # These are endpoints we have tests for that aren't models. This script skips thes...
allennlp-demo-main
dev/check_models_ci.py
from setuptools import setup, find_packages import os # PEP0440 compatible formatted version, see: # https://www.python.org/dev/peps/pep-0440/ # # release markers: # X.Y # X.Y.Z # For bugfix releases # # pre-release markers: # X.YaN # Alpha release # X.YbN # Beta release # X.YrcN # Release Candidate #...
allennlp-semparse-master
setup.py
from .semparse_test_case import SemparseTestCase, ModelTestCase
allennlp-semparse-master
tests/__init__.py
import pathlib from allennlp.common.testing import AllenNlpTestCase, ModelTestCase as AllenNlpModelTestCase # These imports are to get all of the items registered that we need. from allennlp_semparse import models, dataset_readers, predictors ROOT = (pathlib.Path(__file__).parent / "..").resolve() class SemparseTe...
allennlp-semparse-master
tests/semparse_test_case.py
from .. import SemparseTestCase from allennlp_semparse.dataset_readers import NlvrDatasetReader from allennlp_semparse.domain_languages import NlvrLanguage class TestNlvrDatasetReader(SemparseTestCase): def test_reader_reads_ungrouped_data(self): test_file = str(self.FIXTURES_ROOT / "data" / "nlvr" / "sa...
allennlp-semparse-master
tests/dataset_readers/nlvr_test.py
from allennlp.common.file_utils import cached_path from allennlp_semparse.dataset_readers import AtisDatasetReader from .. import SemparseTestCase from allennlp_semparse.parsimonious_languages.worlds import AtisWorld class TestAtisReader(SemparseTestCase): def test_atis_keep_unparseable(self): database_f...
allennlp-semparse-master
tests/dataset_readers/atis_test.py
allennlp-semparse-master
tests/dataset_readers/__init__.py
import pytest from .. import SemparseTestCase from allennlp_semparse.dataset_readers.grammar_based_text2sql import ( GrammarBasedText2SqlDatasetReader, ) @pytest.mark.skip(reason="Mark will fix in a nearby PR.") class TestGrammarBasedText2SqlDatasetReader(SemparseTestCase): def setup_method(self): s...
allennlp-semparse-master
tests/dataset_readers/grammar_based_text2sql_test.py
from allennlp.common import Params from .. import SemparseTestCase from allennlp_semparse.dataset_readers import WikiTablesDatasetReader from allennlp_semparse.domain_languages import WikiTablesLanguage def assert_dataset_correct(dataset): instances = list(dataset) assert len(instances) == 2 instance = i...
allennlp-semparse-master
tests/dataset_readers/wikitables_test.py
from allennlp.common.util import ensure_list from .. import SemparseTestCase from allennlp_semparse.dataset_readers import TemplateText2SqlDatasetReader class TestTemplateText2SqlDatasetReader(SemparseTestCase): def test_reader(self): reader = TemplateText2SqlDatasetReader() instances = reader.r...
allennlp-semparse-master
tests/dataset_readers/template_text2sql_test.py
allennlp-semparse-master
tests/parsimonious_languages/__init__.py
allennlp-semparse-master
tests/parsimonious_languages/contexts/__init__.py
allennlp-semparse-master
tests/parsimonious_languages/worlds/__init__.py
from datetime import datetime import json from parsimonious.expressions import Literal, Sequence from allennlp.common.file_utils import cached_path from ... import SemparseTestCase from allennlp_semparse.parsimonious_languages.contexts.atis_tables import ( get_approximate_times, pm_map_match_to_query_value, ...
allennlp-semparse-master
tests/parsimonious_languages/worlds/atis_world_test.py
import sqlite3 from parsimonious import Grammar, ParseError import pytest from ... import SemparseTestCase from allennlp_semparse.parsimonious_languages.worlds.text2sql_world import Text2SqlWorld from allennlp_semparse.parsimonious_languages.contexts.sql_context_utils import ( format_grammar_string, ) from allen...
allennlp-semparse-master
tests/parsimonious_languages/worlds/text2sql_world_test.py
allennlp-semparse-master
tests/parsimonious_languages/executors/__init__.py
from ... import SemparseTestCase from allennlp_semparse.parsimonious_languages.executors import SqlExecutor class TestSqlExecutor(SemparseTestCase): def setup_method(self): super().setup_method() self._database_file = "https://allennlp.s3.amazonaws.com/datasets/atis/atis.db" def test_sql_acc...
allennlp-semparse-master
tests/parsimonious_languages/executors/sql_executor_test.py
import json import os from .. import SemparseTestCase from allennlp.models.archival import load_archive from allennlp.predictors import Predictor class TestNlvrParserPredictor(SemparseTestCase): def setup_method(self): super().setup_method() self.inputs = { "worlds": [ ...
allennlp-semparse-master
tests/predictors/nlvr_parser_test.py
allennlp-semparse-master
tests/predictors/__init__.py
import pytest from .. import SemparseTestCase from allennlp.models.archival import load_archive from allennlp.predictors import Predictor class TestWikiTablesParserPredictor(SemparseTestCase): def test_uses_named_inputs(self): inputs = {"question": "names", "table": "name\tdate\nmatt\t2017\npradeep\t2018...
allennlp-semparse-master
tests/predictors/wikitables_parser_test.py
from flaky import flaky from .. import SemparseTestCase from allennlp.models.archival import load_archive from allennlp.predictors import Predictor class TestAtisParserPredictor(SemparseTestCase): @flaky def test_atis_parser_uses_named_inputs(self): inputs = {"utterance": "show me the flights to seat...
allennlp-semparse-master
tests/predictors/atis_parser_test.py
from .. import ModelTestCase from allennlp_semparse.state_machines.states import GrammarStatelet from allennlp_semparse.models.text2sql_parser import Text2SqlParser from allennlp_semparse.parsimonious_languages.worlds.text2sql_world import Text2SqlWorld class TestText2SqlParser(ModelTestCase): def setup_method(s...
allennlp-semparse-master
tests/models/text2sql_parser_test.py
allennlp-semparse-master
tests/models/__init__.py
from flaky import flaky from ... import ModelTestCase class TestWikiTablesVariableFreeErm(ModelTestCase): def setup_method(self): super().setup_method() config_path = self.FIXTURES_ROOT / "wikitables" / "experiment-erm.json" data_path = self.FIXTURES_ROOT / "data" / "wikitables" / "sample...
allennlp-semparse-master
tests/models/wikitables/wikitables_erm_semantic_parser_test.py
allennlp-semparse-master
tests/models/wikitables/__init__.py
from collections import namedtuple from flaky import flaky from numpy.testing import assert_almost_equal import torch from allennlp.common import Params from ... import ModelTestCase class TestWikiTablesMmlSemanticParser(ModelTestCase): def setup_method(self): super().setup_method() print(self.FI...
allennlp-semparse-master
tests/models/wikitables/wikitables_mml_semantic_parser_test.py
allennlp-semparse-master
tests/models/nlvr/__init__.py
from ... import ModelTestCase class TestNlvrDirectSemanticParser(ModelTestCase): def setup_method(self): super().setup_method() self.set_up_model( self.FIXTURES_ROOT / "nlvr_direct_semantic_parser" / "experiment.json", self.FIXTURES_ROOT / "data" / "nlvr" / "sample_processe...
allennlp-semparse-master
tests/models/nlvr/nlvr_direct_semantic_parser_test.py
from numpy.testing import assert_almost_equal import torch import pytest from allennlp.common import Params from ... import ModelTestCase from allennlp.data import Vocabulary from allennlp.models import Model from allennlp.models.archival import load_archive class TestNlvrCoverageSemanticParser(ModelTestCase): d...
allennlp-semparse-master
tests/models/nlvr/nlvr_coverage_semantic_parser_test.py
from numpy.testing import assert_almost_equal import torch from allennlp.common import Params from allennlp_semparse.models.atis.atis_semantic_parser import AtisSemanticParser from allennlp_semparse.parsimonious_languages.worlds import AtisWorld from allennlp_semparse.state_machines.states import GrammarStatelet from...
allennlp-semparse-master
tests/models/atis/atis_grammar_statelet_test.py
allennlp-semparse-master
tests/models/atis/__init__.py
from flaky import flaky from ... import ModelTestCase from allennlp_semparse.parsimonious_languages.contexts.sql_context_utils import ( action_sequence_to_sql, ) class TestAtisSemanticParser(ModelTestCase): def setup_method(self): super().setup_method() self.set_up_model( str(self...
allennlp-semparse-master
tests/models/atis/atis_semantic_parser_test.py
allennlp-semparse-master
tests/models/quarel/__init__.py
""" We define a simple deterministic decoder here, that takes steps to add integers to list. At each step, the decoder takes the last integer in the list, and adds either 1 or 2 to produce the next element that will be added to the list. We initialize the list with the value 0 (or whatever you pick), and we say that a ...
allennlp-semparse-master
tests/state_machines/simple_transition_system.py
import torch from .. import SemparseTestCase from allennlp_semparse.state_machines import ConstrainedBeamSearch from .simple_transition_system import SimpleState, SimpleTransitionFunction class TestConstrainedBeamSearch(SemparseTestCase): def test_search(self): # The simple transition system starts at s...
allennlp-semparse-master
tests/state_machines/constrained_beam_search_test.py
allennlp-semparse-master
tests/state_machines/__init__.py
import torch from .. import SemparseTestCase from allennlp_semparse.state_machines import util class TestStateMachinesUtil(SemparseTestCase): def test_create_allowed_transitions(self): targets = torch.Tensor( [[[2, 3, 4], [1, 3, 4], [1, 2, 4]], [[3, 4, 0], [2, 3, 4], [0, 0, 0]]] ) ...
allennlp-semparse-master
tests/state_machines/util_test.py
import torch from allennlp.common import Params from .. import SemparseTestCase from allennlp_semparse.state_machines import BeamSearch from .simple_transition_system import SimpleState, SimpleTransitionFunction class TestBeamSearch(SemparseTestCase): def test_search(self): beam_search = BeamSearch.from...
allennlp-semparse-master
tests/state_machines/beam_search_test.py
allennlp-semparse-master
tests/state_machines/trainers/__init__.py
import math from numpy.testing import assert_almost_equal import torch from ... import SemparseTestCase from allennlp_semparse.state_machines.trainers import MaximumMarginalLikelihood from ..simple_transition_system import SimpleState, SimpleTransitionFunction class TestMaximumMarginalLikelihood(SemparseTestCase):...
allennlp-semparse-master
tests/state_machines/trainers/maximum_marginal_likelihood_test.py
import torch import numpy as np from numpy.testing import assert_almost_equal from ... import SemparseTestCase from allennlp_semparse.state_machines.trainers import ExpectedRiskMinimization from ..simple_transition_system import SimpleState, SimpleTransitionFunction class TestExpectedRiskMinimization(SemparseTestCa...
allennlp-semparse-master
tests/state_machines/trainers/expected_risk_minimization_test.py
from numpy.testing import assert_almost_equal import torch from ... import SemparseTestCase from allennlp.modules import Attention from allennlp_semparse.nltk_languages.type_declarations.type_declaration import is_nonterminal from allennlp_semparse.state_machines.states import GrammarBasedState, GrammarStatelet, RnnS...
allennlp-semparse-master
tests/state_machines/transition_functions/basic_transition_function_test.py
allennlp-semparse-master
tests/state_machines/transition_functions/__init__.py
import pytest from ... import SemparseTestCase from allennlp_semparse.state_machines.states import GrammarStatelet def is_nonterminal(symbol: str) -> bool: if symbol == "identity": return False if "lambda " in symbol: return False if symbol in {"x", "y", "z"}: return False re...
allennlp-semparse-master
tests/state_machines/states/grammar_statelet_test.py
allennlp-semparse-master
tests/state_machines/states/__init__.py
import pytest import torch from numpy.testing import assert_almost_equal from ... import SemparseTestCase from allennlp_semparse.state_machines.states import LambdaGrammarStatelet def is_nonterminal(symbol: str) -> bool: if symbol == "identity": return False if "lambda " in symbol: return Fa...
allennlp-semparse-master
tests/state_machines/states/lambda_grammar_statelet_test.py
from typing import Set from .. import SemparseTestCase from allennlp_semparse import DomainLanguage, ActionSpaceWalker, predicate class Object: pass class FakeLanguageWithAssertions(DomainLanguage): @predicate def object_exists(self, items: Set[Object]) -> bool: return True @predicate ...
allennlp-semparse-master
tests/common/action_space_walker_test.py
allennlp-semparse-master
tests/common/__init__.py
from .. import SemparseTestCase from allennlp_semparse.common import util class TestSemparseUtil(SemparseTestCase): def test_lisp_to_nested_expression(self): logical_form = "((reverse fb:row.row.year) (fb:row.row.league fb:cell.usl_a_league))" expression = util.lisp_to_nested_expression(logical_f...
allennlp-semparse-master
tests/common/util_test.py
import pytest from .. import SemparseTestCase from allennlp_semparse.common import Date, ExecutionError class TestDate(SemparseTestCase): def test_date_comparison_works(self): assert Date(2013, 12, 31) > Date(2013, 12, 30) assert Date(2013, 12, 31) == Date(2013, 12, -1) assert Date(2013,...
allennlp-semparse-master
tests/common/date_test.py
allennlp-semparse-master
tests/common/wikitables/__init__.py
from ... import SemparseTestCase from allennlp.data.tokenizers import SpacyTokenizer from allennlp_semparse.common import Date from allennlp_semparse.common.wikitables import TableQuestionContext class TestTableQuestionContext(SemparseTestCase): def setup_method(self): super().setup_method() self...
allennlp-semparse-master
tests/common/wikitables/table_question_context_test.py
allennlp-semparse-master
tests/common/sql/__init__.py
import json from ... import SemparseTestCase from allennlp_semparse.common.sql import text2sql_utils class TestText2SqlUtils(SemparseTestCase): def setup_method(self): super().setup_method() self.data = self.FIXTURES_ROOT / "data" / "text2sql" / "restaurants_tiny.json" def test_process_sql_d...
allennlp-semparse-master
tests/common/sql/text2sql_utils_test.py
from typing import List import pytest from .. import SemparseTestCase from allennlp.data.tokenizers import Token from allennlp.data.tokenizers import SpacyTokenizer from allennlp_semparse.common import Date, ExecutionError from allennlp_semparse.common.wikitables import TableQuestionContext from allennlp_semparse.do...
allennlp-semparse-master
tests/domain_languages/wikitables_language_test.py
from typing import Callable, List import pytest from .. import SemparseTestCase from allennlp_semparse.common import ExecutionError, ParsingError from allennlp_semparse import DomainLanguage, predicate, predicate_with_side_args class Arithmetic(DomainLanguage): def __init__( self, allow_function_curryi...
allennlp-semparse-master
tests/domain_languages/domain_language_test.py
allennlp-semparse-master
tests/domain_languages/__init__.py
import json from .. import SemparseTestCase from allennlp_semparse.domain_languages import NlvrLanguage from allennlp_semparse.domain_languages.nlvr_language import Box class TestNlvrLanguage(SemparseTestCase): def setup_method(self): super().setup_method() test_filename = self.FIXTURES_ROOT / "...
allennlp-semparse-master
tests/domain_languages/nlvr_language_test.py
allennlp-semparse-master
tests/fields/__init__.py
from collections import defaultdict from numpy.testing import assert_almost_equal from .. import SemparseTestCase from allennlp.data import Vocabulary from allennlp.data.fields import ListField from allennlp_semparse.fields import ProductionRuleField class TestProductionRuleField(SemparseTestCase): def setup_m...
allennlp-semparse-master
tests/fields/production_rule_field_test.py
from collections import defaultdict import pytest from numpy.testing import assert_almost_equal import torch from .. import SemparseTestCase from allennlp.common.checks import ConfigurationError from allennlp.data import Vocabulary from allennlp.data.token_indexers import SingleIdTokenIndexer, TokenCharactersIndexer ...
allennlp-semparse-master
tests/fields/knowledge_graph_field_test.py
allennlp-semparse-master
tests/nltk_languages/__init__.py
allennlp-semparse-master
tests/nltk_languages/contexts/__init__.py
from ... import SemparseTestCase from allennlp_semparse.nltk_languages.worlds.world import World class FakeWorldWithoutRecursion(World): def all_possible_actions(self): # The logical forms this grammar allows are # (unary_function argument) # (binary_function argument argument) act...
allennlp-semparse-master
tests/nltk_languages/worlds/world_test.py
allennlp-semparse-master
tests/nltk_languages/worlds/__init__.py
allennlp-semparse-master
tests/nltk_languages/type_declarations/__init__.py
from ... import SemparseTestCase from allennlp_semparse.nltk_languages.type_declarations import type_declaration as types from allennlp_semparse.nltk_languages.type_declarations.type_declaration import ( ANY_TYPE, BinaryOpType, ComplexType, NamedBasicType, UnaryOpType, ) ROW_TYPE = NamedBasicType...
allennlp-semparse-master
tests/nltk_languages/type_declarations/type_declaration_test.py
_MAJOR = "0" _MINOR = "0" _REVISION = "4" VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR) VERSION = "{0}.{1}.{2}".format(_MAJOR, _MINOR, _REVISION)
allennlp-semparse-master
allennlp_semparse/version.py
from allennlp_semparse.common.action_space_walker import ActionSpaceWalker from allennlp_semparse.domain_languages.domain_language import ( DomainLanguage, predicate, predicate_with_side_args, )
allennlp-semparse-master
allennlp_semparse/__init__.py
""" Reader for WikitableQuestions (https://github.com/ppasupat/WikiTableQuestions/releases/tag/v1.0.2). """ import logging from typing import Dict, List, Any import os import gzip import tarfile from allennlp.data import DatasetReader from allennlp.data.fields import Field, TextField, MetadataField, ListField, Index...
allennlp-semparse-master
allennlp_semparse/dataset_readers/wikitables.py
import json from typing import Dict, List import logging from copy import deepcopy from parsimonious.exceptions import ParseError from allennlp.common.file_utils import cached_path from allennlp.data import DatasetReader from allennlp.data.fields import Field, ArrayField, ListField, IndexField, TextField, MetadataFi...
allennlp-semparse-master
allennlp_semparse/dataset_readers/atis.py
from typing import Any, Dict, List import json import logging from allennlp.common.util import JsonDict from allennlp.data import DatasetReader from allennlp.data.fields import Field, TextField, ListField, IndexField, LabelField, MetadataField from allennlp.data.instance import Instance from allennlp.data.token_index...
allennlp-semparse-master
allennlp_semparse/dataset_readers/nlvr.py
from allennlp_semparse.dataset_readers.atis import AtisDatasetReader from allennlp_semparse.dataset_readers.grammar_based_text2sql import ( GrammarBasedText2SqlDatasetReader, ) from allennlp_semparse.dataset_readers.nlvr import NlvrDatasetReader from allennlp_semparse.dataset_readers.template_text2sql import Templa...
allennlp-semparse-master
allennlp_semparse/dataset_readers/__init__.py
from typing import Dict, List import logging import json import glob import os import sqlite3 from allennlp.common.file_utils import cached_path from allennlp.common.checks import ConfigurationError from allennlp.data import DatasetReader from allennlp.data.fields import TextField, Field, ListField, IndexField from a...
allennlp-semparse-master
allennlp_semparse/dataset_readers/grammar_based_text2sql.py
from typing import Dict, List import logging import json import glob import os from allennlp.common.file_utils import cached_path from allennlp.data import DatasetReader from allennlp.data.fields import TextField, Field, SequenceLabelField, LabelField from allennlp.data.instance import Instance from allennlp.data.tok...
allennlp-semparse-master
allennlp_semparse/dataset_readers/template_text2sql.py
allennlp-semparse-master
allennlp_semparse/parsimonious_languages/__init__.py
from typing import List, Dict, Callable, Set from datetime import datetime, timedelta import re from collections import defaultdict from nltk import ngrams from allennlp.data.tokenizers import Token TWELVE_TO_TWENTY_FOUR = 1200 HOUR_TO_TWENTY_FOUR = 100 HOURS_IN_DAY = 2400 AROUND_RANGE = 30 MINS_IN_HOUR = 60 APPROX_...
allennlp-semparse-master
allennlp_semparse/parsimonious_languages/contexts/atis_tables.py
from allennlp_semparse.parsimonious_languages.contexts.atis_sql_table_context import ( AtisSqlTableContext, )
allennlp-semparse-master
allennlp_semparse/parsimonious_languages/contexts/__init__.py
""" An ``AtisSqlTableContext`` represents the SQL context in which an utterance appears for the Atis dataset, with the grammar and the valid actions. """ from typing import List, Dict, Tuple import sqlite3 from copy import deepcopy from parsimonious.grammar import Grammar from allennlp.common.file_utils import cached...
allennlp-semparse-master
allennlp_semparse/parsimonious_languages/contexts/atis_sql_table_context.py
""" A ``Text2SqlTableContext`` represents the SQL context in which an utterance appears for the any of the text2sql datasets, with the grammar and the valid actions. """ from typing import List, Dict from sqlite3 import Cursor from allennlp_semparse.common.sql.text2sql_utils import TableColumn from allennlp_semparse....
allennlp-semparse-master
allennlp_semparse/parsimonious_languages/contexts/text2sql_table_context.py
import re from typing import List, Dict, Set from collections import defaultdict from sys import exc_info from six import reraise from parsimonious.expressions import Literal, OneOf, Sequence from parsimonious.nodes import Node, NodeVisitor from parsimonious.grammar import Grammar from parsimonious.exceptions import ...
allennlp-semparse-master
allennlp_semparse/parsimonious_languages/contexts/sql_context_utils.py
from typing import List, Dict, Tuple, Set, Callable from collections import defaultdict from copy import copy import numpy from nltk import ngrams, bigrams from parsimonious.grammar import Grammar from parsimonious.expressions import Expression, OneOf, Sequence, Literal from allennlp.data.tokenizers import Token, Tok...
allennlp-semparse-master
allennlp_semparse/parsimonious_languages/worlds/atis_world.py
from allennlp_semparse.parsimonious_languages.worlds.atis_world import AtisWorld
allennlp-semparse-master
allennlp_semparse/parsimonious_languages/worlds/__init__.py
from typing import List, Tuple, Dict from copy import deepcopy from sqlite3 import Cursor import os from parsimonious import Grammar from parsimonious.exceptions import ParseError from allennlp.common.checks import ConfigurationError from allennlp_semparse.common.sql.text2sql_utils import read_dataset_schema from al...
allennlp-semparse-master
allennlp_semparse/parsimonious_languages/worlds/text2sql_world.py