From fd9b7bca8a10a57dd24370f50824bb4a4594d800 Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Wed, 23 Jan 2019 14:50:45 +0100 Subject: [PATCH 01/43] removed future imports and six --- alt_requirements/requirements_bare.txt | 1 - rasa_nlu/__init__.py | 5 -- rasa_nlu/classifiers/__init__.py | 4 -- .../embedding_intent_classifier.py | 4 -- .../classifiers/keyword_intent_classifier.py | 4 -- .../classifiers/mitie_intent_classifier.py | 4 -- .../classifiers/sklearn_intent_classifier.py | 10 +-- rasa_nlu/components.py | 11 +--- rasa_nlu/config.py | 13 ++-- rasa_nlu/convert.py | 4 -- rasa_nlu/data_router.py | 63 +++++-------------- rasa_nlu/emulators/__init__.py | 4 -- rasa_nlu/emulators/dialogflow.py | 4 -- rasa_nlu/emulators/luis.py | 4 -- rasa_nlu/emulators/wit.py | 4 -- rasa_nlu/evaluate.py | 4 -- rasa_nlu/extractors/__init__.py | 4 -- rasa_nlu/extractors/crf_entity_extractor.py | 4 -- .../extractors/duckling_http_extractor.py | 4 -- rasa_nlu/extractors/entity_synonyms.py | 10 +-- rasa_nlu/extractors/mitie_entity_extractor.py | 4 -- rasa_nlu/extractors/spacy_entity_extractor.py | 4 -- rasa_nlu/featurizers/__init__.py | 4 -- .../featurizers/count_vectors_featurizer.py | 4 -- rasa_nlu/featurizers/mitie_featurizer.py | 4 -- rasa_nlu/featurizers/ngram_featurizer.py | 4 -- rasa_nlu/featurizers/regex_featurizer.py | 4 -- rasa_nlu/featurizers/spacy_featurizer.py | 4 -- rasa_nlu/model.py | 4 -- rasa_nlu/persistor.py | 12 ++-- rasa_nlu/project.py | 32 ++++------ rasa_nlu/registry.py | 4 -- rasa_nlu/run.py | 8 --- rasa_nlu/server.py | 12 +--- rasa_nlu/tokenizers/__init__.py | 4 -- rasa_nlu/tokenizers/jieba_tokenizer.py | 4 -- rasa_nlu/tokenizers/mitie_tokenizer.py | 4 -- rasa_nlu/tokenizers/spacy_tokenizer.py | 4 -- rasa_nlu/tokenizers/whitespace_tokenizer.py | 4 -- rasa_nlu/train.py | 4 -- rasa_nlu/training_data/__init__.py | 4 -- rasa_nlu/training_data/formats/__init__.py | 4 -- rasa_nlu/training_data/formats/dialogflow.py | 4 -- rasa_nlu/training_data/formats/luis.py | 4 -- rasa_nlu/training_data/formats/markdown.py | 4 -- rasa_nlu/training_data/formats/rasa.py | 16 ++--- .../training_data/formats/readerwriter.py | 4 -- rasa_nlu/training_data/formats/wit.py | 4 -- rasa_nlu/training_data/loading.py | 4 -- rasa_nlu/training_data/message.py | 4 -- rasa_nlu/training_data/training_data.py | 4 -- rasa_nlu/training_data/util.py | 4 -- rasa_nlu/utils/__init__.py | 15 +---- rasa_nlu/utils/mitie_utils.py | 4 -- rasa_nlu/utils/spacy_utils.py | 4 -- rasa_nlu/version.py | 4 -- setup.py | 2 - tests/base/test_components.py | 4 -- tests/base/test_config.py | 4 -- tests/base/test_data_router.py | 4 -- tests/base/test_emulators.py | 4 -- tests/base/test_evaluation.py | 4 -- tests/base/test_extractors.py | 4 -- tests/base/test_featurizers.py | 4 -- tests/base/test_interpreter.py | 4 -- tests/base/test_multitenancy.py | 4 -- tests/base/test_persistor.py | 4 -- tests/base/test_project.py | 4 -- tests/base/test_server.py | 4 -- tests/base/test_synonyms.py | 4 -- tests/base/test_tokenizers.py | 4 -- tests/base/test_training_data.py | 4 -- tests/base/test_utils.py | 4 -- tests/conftest.py | 4 -- tests/example_component.py | 4 -- tests/training/test_train.py | 4 -- tests/utilities.py | 4 -- 77 files changed, 53 insertions(+), 409 deletions(-) diff --git a/alt_requirements/requirements_bare.txt b/alt_requirements/requirements_bare.txt index fb09d9fbe547..ae1e037ef57e 100644 --- a/alt_requirements/requirements_bare.txt +++ b/alt_requirements/requirements_bare.txt @@ -3,7 +3,6 @@ klein==17.10.0 hyperlink==17.3.1 typing==3.6.2 future==0.16.0 -six==1.11.0 jsonschema==2.6.0 matplotlib==2.1.0 requests==2.20.0 diff --git a/rasa_nlu/__init__.py b/rasa_nlu/__init__.py index 1dcf6be86494..02dee4d28c72 100644 --- a/rasa_nlu/__init__.py +++ b/rasa_nlu/__init__.py @@ -1,8 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import logging import rasa_nlu.version diff --git a/rasa_nlu/classifiers/__init__.py b/rasa_nlu/classifiers/__init__.py index 7518b96f49c8..5c2657fb17b0 100644 --- a/rasa_nlu/classifiers/__init__.py +++ b/rasa_nlu/classifiers/__init__.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals # How many intents are at max put into the output intent # ranking, everything else will be cut off diff --git a/rasa_nlu/classifiers/embedding_intent_classifier.py b/rasa_nlu/classifiers/embedding_intent_classifier.py index c89e3af29600..07d7f183e7eb 100644 --- a/rasa_nlu/classifiers/embedding_intent_classifier.py +++ b/rasa_nlu/classifiers/embedding_intent_classifier.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import io import copy diff --git a/rasa_nlu/classifiers/keyword_intent_classifier.py b/rasa_nlu/classifiers/keyword_intent_classifier.py index e29cfedb92bb..f9790daaf994 100644 --- a/rasa_nlu/classifiers/keyword_intent_classifier.py +++ b/rasa_nlu/classifiers/keyword_intent_classifier.py @@ -1,7 +1,3 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import from builtins import map from typing import Any from typing import Dict diff --git a/rasa_nlu/classifiers/mitie_intent_classifier.py b/rasa_nlu/classifiers/mitie_intent_classifier.py index eb3118cea8fc..14c21242b7c2 100644 --- a/rasa_nlu/classifiers/mitie_intent_classifier.py +++ b/rasa_nlu/classifiers/mitie_intent_classifier.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import os diff --git a/rasa_nlu/classifiers/sklearn_intent_classifier.py b/rasa_nlu/classifiers/sklearn_intent_classifier.py index ff958d52ab71..25093dc28f02 100644 --- a/rasa_nlu/classifiers/sklearn_intent_classifier.py +++ b/rasa_nlu/classifiers/sklearn_intent_classifier.py @@ -1,7 +1,3 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import import logging import typing @@ -124,9 +120,9 @@ def train(self, training_data, cfg, **kwargs): for e in training_data.intent_examples] if len(set(labels)) < 2: - logger.warn("Can not train an intent classifier. " - "Need at least 2 different classes. " - "Skipping training of intent classifier.") + logger.warning("Can not train an intent classifier. " + "Need at least 2 different classes. " + "Skipping training of intent classifier.") else: y = self.transform_labels_str2num(labels) X = np.stack([example.get("text_features") diff --git a/rasa_nlu/components.py b/rasa_nlu/components.py index 9ae5b66750af..072beb77f174 100644 --- a/rasa_nlu/components.py +++ b/rasa_nlu/components.py @@ -1,8 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import logging import typing @@ -43,7 +38,7 @@ def find_unavailable_packages(package_names): def validate_requirements(component_names): - # type: (List[Text], Text) -> None + # type: (List[Text]) -> None """Ensures that all required python packages are installed to instantiate and used the passed components.""" from rasa_nlu import registry @@ -206,7 +201,7 @@ def load(cls, model_dir=None, # type: Optional[Text] model_metadata=None, # type: Optional[Metadata] cached_component=None, # type: Optional[Component] - **kwargs # type: **Any + **kwargs # type: Any ): # type: (...) -> Component """Load this component from file. @@ -370,7 +365,6 @@ def __get_cached_component(self, component_name, model_metadata): Returns the component, if found, and the cache key.""" from rasa_nlu import registry - from rasa_nlu.model import Metadata component_class = registry.get_component_class(component_name) cache_key = component_class.cache_key(model_metadata) @@ -409,7 +403,6 @@ def load_component(self, Component: the loaded component. """ from rasa_nlu import registry - from rasa_nlu.model import Metadata try: cached_component, cache_key = self.__get_cached_component( diff --git a/rasa_nlu/config.py b/rasa_nlu/config.py index 3501bc8f2f1f..432aac2a5a23 100644 --- a/rasa_nlu/config.py +++ b/rasa_nlu/config.py @@ -1,13 +1,7 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import copy import logging import os -import six import ruamel.yaml as yaml from builtins import object # Describes where to search for the config file if no location is specified @@ -118,7 +112,7 @@ def __init__(self, configuration_values=None): self.override(DEFAULT_CONFIG) self.override(configuration_values) - if isinstance(self.__dict__['pipeline'], six.string_types): + if isinstance(self.__dict__['pipeline'], str): from rasa_nlu import registry template_name = self.__dict__['pipeline'] @@ -188,8 +182,9 @@ def set_component_attr(self, name, **kwargs): if c.get("name") == name: c.update(kwargs) else: - logger.warn("Tried to set configuration value for component '{}' " - "which is not part of the pipeline.".format(name)) + logger.warning("Tried to set configuration value for component " + "'{}' which is not part of the pipeline." + "".format(name)) def override(self, config): if config: diff --git a/rasa_nlu/convert.py b/rasa_nlu/convert.py index 872f7491b70c..67a08b077cc8 100644 --- a/rasa_nlu/convert.py +++ b/rasa_nlu/convert.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import argparse diff --git a/rasa_nlu/data_router.py b/rasa_nlu/data_router.py index a01040725c9c..f30367e62058 100644 --- a/rasa_nlu/data_router.py +++ b/rasa_nlu/data_router.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import datetime import io @@ -11,7 +7,6 @@ from concurrent.futures import ProcessPoolExecutor as ProcessPool from typing import Text, Dict, Any, Optional -import six from builtins import object from twisted.internet import reactor from twisted.internet.defer import Deferred @@ -109,11 +104,10 @@ def __init__(self, self.project_store = self._create_project_store(project_dir) - if six.PY3: - # tensorflow sessions are not fork-safe, - # and training processes have to be spawned instead of forked. - # See https://github.com/tensorflow/tensorflow/issues/5448#issuecomment-258934405 - multiprocessing.set_start_method('spawn', force=True) + # tensorflow sessions are not fork-safe, + # and training processes have to be spawned instead of forked. See + # https://github.com/tensorflow/tensorflow/issues/5448#issuecomment-258934405 + multiprocessing.set_start_method('spawn', force=True) self.pool = ProcessPool(self._training_processes) @@ -349,43 +343,18 @@ def training_errback(failure): self._current_training_processes += 1 self.project_store[project].current_training_processes += 1 - # tensorflow training is not executed in a separate thread on python 2, - # as this may cause training to freeze - if six.PY2 and self._tf_in_pipeline(train_config): - try: - logger.warning("Training a pipeline with a tensorflow " - "component. This blocks the server during " - "training.") - model_path = do_train_in_worker( - train_config, - data_file, - path=self.project_dir, - project=project, - fixed_model_name=model_name, - storage=self.remote_storage) - model_dir = os.path.basename(os.path.normpath(model_path)) - training_callback(model_dir) - return model_dir - except TrainingException as e: - logger.warning(e) - target_project = self.project_store.get( - e.failed_target_project) - if target_project: - target_project.status = STATUS_READY - raise e - else: - result = self.pool.submit(do_train_in_worker, - train_config, - data_file, - path=self.project_dir, - project=project, - fixed_model_name=model_name, - storage=self.remote_storage) - result = deferred_from_future(result) - result.addCallback(training_callback) - result.addErrback(training_errback) - - return result + result = self.pool.submit(do_train_in_worker, + train_config, + data_file, + path=self.project_dir, + project=project, + fixed_model_name=model_name, + storage=self.remote_storage) + result = deferred_from_future(result) + result.addCallback(training_callback) + result.addErrback(training_errback) + + return result def evaluate(self, data, project=None, model=None): # type: (Text, Optional[Text], Optional[Text]) -> Dict[Text, Any] diff --git a/rasa_nlu/emulators/__init__.py b/rasa_nlu/emulators/__init__.py index c26268525066..fa1b96a96652 100644 --- a/rasa_nlu/emulators/__init__.py +++ b/rasa_nlu/emulators/__init__.py @@ -1,7 +1,3 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import from builtins import object from typing import Any from typing import Dict diff --git a/rasa_nlu/emulators/dialogflow.py b/rasa_nlu/emulators/dialogflow.py index 8e4e88e4f9f4..786b08627555 100644 --- a/rasa_nlu/emulators/dialogflow.py +++ b/rasa_nlu/emulators/dialogflow.py @@ -1,7 +1,3 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import from builtins import str import uuid from datetime import datetime diff --git a/rasa_nlu/emulators/luis.py b/rasa_nlu/emulators/luis.py index aaec084dc860..989e0ac8496f 100644 --- a/rasa_nlu/emulators/luis.py +++ b/rasa_nlu/emulators/luis.py @@ -1,7 +1,3 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import from typing import Any from typing import Dict diff --git a/rasa_nlu/emulators/wit.py b/rasa_nlu/emulators/wit.py index 3abb8f5f9c4a..b972dbb05da2 100644 --- a/rasa_nlu/emulators/wit.py +++ b/rasa_nlu/emulators/wit.py @@ -1,7 +1,3 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import from typing import Any from typing import Dict diff --git a/rasa_nlu/evaluate.py b/rasa_nlu/evaluate.py index 9097f400960c..86b3f152a938 100644 --- a/rasa_nlu/evaluate.py +++ b/rasa_nlu/evaluate.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import itertools import json diff --git a/rasa_nlu/extractors/__init__.py b/rasa_nlu/extractors/__init__.py index 436b5a00d89a..09d3ff561e1f 100644 --- a/rasa_nlu/extractors/__init__.py +++ b/rasa_nlu/extractors/__init__.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals from typing import Any from typing import Dict diff --git a/rasa_nlu/extractors/crf_entity_extractor.py b/rasa_nlu/extractors/crf_entity_extractor.py index f51b6fa5155e..86940a2a4381 100644 --- a/rasa_nlu/extractors/crf_entity_extractor.py +++ b/rasa_nlu/extractors/crf_entity_extractor.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging import os diff --git a/rasa_nlu/extractors/duckling_http_extractor.py b/rasa_nlu/extractors/duckling_http_extractor.py index 25faa1fefc07..5a3fdfc7254d 100644 --- a/rasa_nlu/extractors/duckling_http_extractor.py +++ b/rasa_nlu/extractors/duckling_http_extractor.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging import os diff --git a/rasa_nlu/extractors/entity_synonyms.py b/rasa_nlu/extractors/entity_synonyms.py index 64922b2f56b6..32e731989d44 100644 --- a/rasa_nlu/extractors/entity_synonyms.py +++ b/rasa_nlu/extractors/entity_synonyms.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import os import warnings @@ -70,7 +66,7 @@ def load(cls, model_dir=None, # type: Optional[Text] model_metadata=None, # type: Optional[Metadata] cached_component=None, # type: Optional[EntitySynonymMapper] - **kwargs # type: **Any + **kwargs # type: Any ): # type: (...) -> EntitySynonymMapper @@ -99,8 +95,8 @@ def replace_synonyms(self, entities): def add_entities_if_synonyms(self, entity_a, entity_b): if entity_b is not None: - original = utils.as_text_type(entity_a) - replacement = utils.as_text_type(entity_b) + original = str(entity_a) + replacement = str(entity_b) if original != replacement: original = original.lower() diff --git a/rasa_nlu/extractors/mitie_entity_extractor.py b/rasa_nlu/extractors/mitie_entity_extractor.py index a20b10bf1f6d..35c7f39de228 100644 --- a/rasa_nlu/extractors/mitie_entity_extractor.py +++ b/rasa_nlu/extractors/mitie_entity_extractor.py @@ -1,7 +1,3 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import from builtins import range, str import logging diff --git a/rasa_nlu/extractors/spacy_entity_extractor.py b/rasa_nlu/extractors/spacy_entity_extractor.py index 705691bc8815..6145fee7ecbc 100644 --- a/rasa_nlu/extractors/spacy_entity_extractor.py +++ b/rasa_nlu/extractors/spacy_entity_extractor.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import typing from typing import Any diff --git a/rasa_nlu/featurizers/__init__.py b/rasa_nlu/featurizers/__init__.py index cb90ca030367..d317545fc54a 100644 --- a/rasa_nlu/featurizers/__init__.py +++ b/rasa_nlu/featurizers/__init__.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import numpy as np diff --git a/rasa_nlu/featurizers/count_vectors_featurizer.py b/rasa_nlu/featurizers/count_vectors_featurizer.py index 73878a8ac874..bfb58102bfc6 100644 --- a/rasa_nlu/featurizers/count_vectors_featurizer.py +++ b/rasa_nlu/featurizers/count_vectors_featurizer.py @@ -1,7 +1,3 @@ -from __future__ import division -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import absolute_import import logging import os diff --git a/rasa_nlu/featurizers/mitie_featurizer.py b/rasa_nlu/featurizers/mitie_featurizer.py index 592204bc3f88..95d27514fc70 100644 --- a/rasa_nlu/featurizers/mitie_featurizer.py +++ b/rasa_nlu/featurizers/mitie_featurizer.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import numpy as np import typing diff --git a/rasa_nlu/featurizers/ngram_featurizer.py b/rasa_nlu/featurizers/ngram_featurizer.py index 6cc225ba6be0..b8406004ce47 100644 --- a/rasa_nlu/featurizers/ngram_featurizer.py +++ b/rasa_nlu/featurizers/ngram_featurizer.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging import os diff --git a/rasa_nlu/featurizers/regex_featurizer.py b/rasa_nlu/featurizers/regex_featurizer.py index dc5071721e44..fb5d53138949 100644 --- a/rasa_nlu/featurizers/regex_featurizer.py +++ b/rasa_nlu/featurizers/regex_featurizer.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging import os diff --git a/rasa_nlu/featurizers/spacy_featurizer.py b/rasa_nlu/featurizers/spacy_featurizer.py index 77109714d25a..f0f7d7c4115c 100644 --- a/rasa_nlu/featurizers/spacy_featurizer.py +++ b/rasa_nlu/featurizers/spacy_featurizer.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import numpy as np import typing diff --git a/rasa_nlu/model.py b/rasa_nlu/model.py index bf86eb230fb6..dc3283c552da 100644 --- a/rasa_nlu/model.py +++ b/rasa_nlu/model.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import copy import datetime diff --git a/rasa_nlu/persistor.py b/rasa_nlu/persistor.py index 374621af57dc..22d58ecdb68f 100644 --- a/rasa_nlu/persistor.py +++ b/rasa_nlu/persistor.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import io import logging @@ -155,8 +151,8 @@ def list_models(self, project): return [self._project_and_model_from_filename(obj.key)[1] for obj in self.bucket.objects.filter(Prefix=prefix)] except Exception as e: - logger.warn("Failed to list models for project {} in " - "AWS. {}".format(project, e)) + logger.warning("Failed to list models for project {} in " + "AWS. {}".format(project, e)) return [] def list_projects(self): @@ -222,8 +218,8 @@ def list_models(self, project): return [self._project_and_model_from_filename(b.name)[1] for b in blob_iterator] except Exception as e: - logger.warn("Failed to list models for project {} in " - "google cloud storage. {}".format(project, e)) + logger.warning("Failed to list models for project {} in " + "google cloud storage. {}".format(project, e)) return [] def list_projects(self): diff --git a/rasa_nlu/project.py b/rasa_nlu/project.py index 7ef5b69f8461..e749e8941d69 100644 --- a/rasa_nlu/project.py +++ b/rasa_nlu/project.py @@ -1,20 +1,15 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals +import time +from builtins import object import datetime import logging import os import tempfile import zipfile -from threading import Lock, Thread -from typing import Text, List - -import six -import time -from builtins import object +from io import BytesIO as IOReader from requests.exceptions import InvalidURL, RequestException +from threading import Lock, Thread +from typing import Text, List, Optional from rasa_nlu import utils from rasa_nlu.classifiers.keyword_intent_classifier import \ @@ -22,11 +17,6 @@ from rasa_nlu.model import Metadata, Interpreter from rasa_nlu.utils import is_url, EndpointConfig -if six.PY2: - from StringIO import StringIO as IOReader -else: - from io import BytesIO as IOReader - logger = logging.getLogger(__name__) MODEL_NAME_PREFIX = "model_" @@ -129,7 +119,7 @@ def _pull_model_and_fingerprint(model_server, model_directory, fingerprint): "and tag combination yet.") return None, None elif response.status_code != 200: - logger.warn("Tried to fetch model from server, but server response " + logger.warning("Tried to fetch model from server, but server response " "status code is {}. We'll retry later..." "".format(response.status_code)) return None, None @@ -251,7 +241,7 @@ def _dynamic_load_model(self, requested_model_name=None): return local_model # still not found user specified model - logger.warn("Invalid model requested. Using default") + logger.warning("Invalid model requested. Using default") return self._latest_project_model() def parse(self, text, time=None, requested_model_name=None): @@ -419,8 +409,8 @@ def _list_models_in_cloud(self): else: return [] except Exception as e: - logger.warn("Failed to list models of project {}. " - "{}".format(self._project, e)) + logger.warning("Failed to list models of project {}. " + "{}".format(self._project, e)) return [] def _load_model_from_cloud(self, model_name, target_path): @@ -432,8 +422,8 @@ def _load_model_from_cloud(self, model_name, target_path): else: raise RuntimeError("Unable to initialize persistor") except Exception as e: - logger.warn("Using default interpreter, couldn't fetch " - "model: {}".format(e)) + logger.warning("Using default interpreter, couldn't fetch " + "model: {}".format(e)) raise # re-raise this exception because nothing we can do now @staticmethod diff --git a/rasa_nlu/registry.py b/rasa_nlu/registry.py index fa6722adf6d8..32829de047f1 100644 --- a/rasa_nlu/registry.py +++ b/rasa_nlu/registry.py @@ -3,10 +3,6 @@ Hence, it imports all of the components. To avoid cycles, no component should import this in module scope.""" -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import import typing from rasa_nlu import utils diff --git a/rasa_nlu/run.py b/rasa_nlu/run.py index 2e8d363fef3d..47802c860225 100644 --- a/rasa_nlu/run.py +++ b/rasa_nlu/run.py @@ -1,12 +1,7 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import json import logging -import six from builtins import input from rasa_nlu import utils @@ -36,9 +31,6 @@ def run_cmdline(model_path, component_builder=None): "press enter to parse it.") while True: text = input().strip() - if six.PY2: - # in python 2 input doesn't return unicode values - text = text.decode("utf-8") r = interpreter.parse(text) print(json.dumps(r, indent=2)) logger.info("Next message:") diff --git a/rasa_nlu/server.py b/rasa_nlu/server.py index 87c6d699deb5..656ef1a5299a 100644 --- a/rasa_nlu/server.py +++ b/rasa_nlu/server.py @@ -1,14 +1,9 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import argparse import logging from functools import wraps import simplejson -import six from builtins import str from klein import Klein from twisted.internet import reactor, threads @@ -146,10 +141,7 @@ def requires_auth(f): def decorated(*args, **kwargs): self = args[0] request = args[1] - if six.PY3: - token = request.args.get(b'token', [b''])[0].decode("utf8") - else: - token = str(request.args.get('token', [''])[0]) + token = request.args.get(b'token', [b''])[0].decode("utf8") if self.access_token is None or token == self.access_token: return f(*args, **kwargs) request.setResponseCode(401) @@ -175,7 +167,7 @@ def parameter_or_default(request, name, default=None): def dump_to_data_file(data): - if isinstance(data, six.string_types): + if isinstance(data, str): data_string = data else: data_string = utils.json_to_string(data) diff --git a/rasa_nlu/tokenizers/__init__.py b/rasa_nlu/tokenizers/__init__.py index 2aadc6f2aeb1..9800ddd4fca7 100644 --- a/rasa_nlu/tokenizers/__init__.py +++ b/rasa_nlu/tokenizers/__init__.py @@ -1,7 +1,3 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import from builtins import object diff --git a/rasa_nlu/tokenizers/jieba_tokenizer.py b/rasa_nlu/tokenizers/jieba_tokenizer.py index 7e2f3dfa67ab..efabc2ce203a 100644 --- a/rasa_nlu/tokenizers/jieba_tokenizer.py +++ b/rasa_nlu/tokenizers/jieba_tokenizer.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import glob import logging diff --git a/rasa_nlu/tokenizers/mitie_tokenizer.py b/rasa_nlu/tokenizers/mitie_tokenizer.py index 61ee558a9f72..9821d8905481 100644 --- a/rasa_nlu/tokenizers/mitie_tokenizer.py +++ b/rasa_nlu/tokenizers/mitie_tokenizer.py @@ -1,7 +1,3 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import from builtins import str import re diff --git a/rasa_nlu/tokenizers/spacy_tokenizer.py b/rasa_nlu/tokenizers/spacy_tokenizer.py index 0d450534589a..c752dfd0fdf6 100644 --- a/rasa_nlu/tokenizers/spacy_tokenizer.py +++ b/rasa_nlu/tokenizers/spacy_tokenizer.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import typing from typing import Any, List diff --git a/rasa_nlu/tokenizers/whitespace_tokenizer.py b/rasa_nlu/tokenizers/whitespace_tokenizer.py index e35990b44a58..b70130d3a320 100644 --- a/rasa_nlu/tokenizers/whitespace_tokenizer.py +++ b/rasa_nlu/tokenizers/whitespace_tokenizer.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import re from typing import Any, List, Text diff --git a/rasa_nlu/train.py b/rasa_nlu/train.py index 9ad5823c5650..8579d268d856 100644 --- a/rasa_nlu/train.py +++ b/rasa_nlu/train.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import argparse import logging diff --git a/rasa_nlu/training_data/__init__.py b/rasa_nlu/training_data/__init__.py index 6342be406990..94cc015a41f1 100644 --- a/rasa_nlu/training_data/__init__.py +++ b/rasa_nlu/training_data/__init__.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals from rasa_nlu.training_data.message import Message from rasa_nlu.training_data.training_data import TrainingData diff --git a/rasa_nlu/training_data/formats/__init__.py b/rasa_nlu/training_data/formats/__init__.py index bc5de54100a9..842d5ae86346 100644 --- a/rasa_nlu/training_data/formats/__init__.py +++ b/rasa_nlu/training_data/formats/__init__.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals from rasa_nlu.training_data.formats.dialogflow import DialogflowReader from rasa_nlu.training_data.formats.luis import LuisReader diff --git a/rasa_nlu/training_data/formats/dialogflow.py b/rasa_nlu/training_data/formats/dialogflow.py index b0fb4261161f..baa5aaad18d9 100644 --- a/rasa_nlu/training_data/formats/dialogflow.py +++ b/rasa_nlu/training_data/formats/dialogflow.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging import os diff --git a/rasa_nlu/training_data/formats/luis.py b/rasa_nlu/training_data/formats/luis.py index 7be6420eec87..a6dddbdf0015 100644 --- a/rasa_nlu/training_data/formats/luis.py +++ b/rasa_nlu/training_data/formats/luis.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging diff --git a/rasa_nlu/training_data/formats/markdown.py b/rasa_nlu/training_data/formats/markdown.py index 253b7a8c7100..6d38bf5c4f0f 100644 --- a/rasa_nlu/training_data/formats/markdown.py +++ b/rasa_nlu/training_data/formats/markdown.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import re import logging diff --git a/rasa_nlu/training_data/formats/rasa.py b/rasa_nlu/training_data/formats/rasa.py index d9d7b06aeed9..6563fe07e22d 100644 --- a/rasa_nlu/training_data/formats/rasa.py +++ b/rasa_nlu/training_data/formats/rasa.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging from collections import defaultdict @@ -32,12 +28,12 @@ def read_from_json(self, js, **kwargs): entity_synonyms = transform_entity_synonyms(entity_synonyms) if intent_examples or entity_examples: - logger.warn("DEPRECATION warning: your rasa data " - "contains 'intent_examples' " - "or 'entity_examples' which will be " - "removed in the future. Consider " - "putting all your examples " - "into the 'common_examples' section.") + logger.warning("DEPRECATION warning: your rasa data " + "contains 'intent_examples' " + "or 'entity_examples' which will be " + "removed in the future. Consider " + "putting all your examples " + "into the 'common_examples' section.") all_examples = common_examples + intent_examples + entity_examples training_examples = [] diff --git a/rasa_nlu/training_data/formats/readerwriter.py b/rasa_nlu/training_data/formats/readerwriter.py index 9593e164397d..8b8040689d26 100644 --- a/rasa_nlu/training_data/formats/readerwriter.py +++ b/rasa_nlu/training_data/formats/readerwriter.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import json from rasa_nlu import utils diff --git a/rasa_nlu/training_data/formats/wit.py b/rasa_nlu/training_data/formats/wit.py index c0c1f28db233..b2b050cf26ba 100644 --- a/rasa_nlu/training_data/formats/wit.py +++ b/rasa_nlu/training_data/formats/wit.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging diff --git a/rasa_nlu/training_data/loading.py b/rasa_nlu/training_data/loading.py index bf904e5b3194..c9dd01cc3318 100644 --- a/rasa_nlu/training_data/loading.py +++ b/rasa_nlu/training_data/loading.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import json import logging diff --git a/rasa_nlu/training_data/message.py b/rasa_nlu/training_data/message.py index ca8a02c64bab..3943ddac476b 100644 --- a/rasa_nlu/training_data/message.py +++ b/rasa_nlu/training_data/message.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals from rasa_nlu.utils import ordered diff --git a/rasa_nlu/training_data/training_data.py b/rasa_nlu/training_data/training_data.py index bf3004ccb528..4453d30510ed 100644 --- a/rasa_nlu/training_data/training_data.py +++ b/rasa_nlu/training_data/training_data.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging import os diff --git a/rasa_nlu/training_data/util.py b/rasa_nlu/training_data/util.py index a895844986fc..b9525b0a24e9 100644 --- a/rasa_nlu/training_data/util.py +++ b/rasa_nlu/training_data/util.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging diff --git a/rasa_nlu/utils/__init__.py b/rasa_nlu/utils/__init__.py index e8cb5d541eea..54c36ed7a237 100644 --- a/rasa_nlu/utils/__init__.py +++ b/rasa_nlu/utils/__init__.py @@ -1,9 +1,6 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import errno + import glob import io import json @@ -18,7 +15,6 @@ import requests import simplejson -import six import ruamel.yaml as yaml from builtins import str from future.utils import PY3 @@ -90,7 +86,7 @@ def list_directory(path): If the path points to a file, returns the file. This is a recursive implementation returning files in any depth of the path.""" - if not isinstance(path, six.string_types): + if not isinstance(path, str): raise ValueError("Resourcename must be a string type") if os.path.isfile(path): @@ -334,13 +330,6 @@ def remove_model(model_dir): "directory".format(model_dir)) -def as_text_type(t): - if isinstance(t, six.text_type): - return t - else: - return six.text_type(t) - - def configure_colored_logging(loglevel): import coloredlogs field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy() diff --git a/rasa_nlu/utils/mitie_utils.py b/rasa_nlu/utils/mitie_utils.py index 6ae50ed9a827..53da784ae68e 100644 --- a/rasa_nlu/utils/mitie_utils.py +++ b/rasa_nlu/utils/mitie_utils.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import os diff --git a/rasa_nlu/utils/spacy_utils.py b/rasa_nlu/utils/spacy_utils.py index cac2064fd70b..bbf9341543e2 100644 --- a/rasa_nlu/utils/spacy_utils.py +++ b/rasa_nlu/utils/spacy_utils.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging diff --git a/rasa_nlu/version.py b/rasa_nlu/version.py index 4ed5a924b276..6bb9e7ab7f1e 100644 --- a/rasa_nlu/version.py +++ b/rasa_nlu/version.py @@ -1,6 +1,2 @@ -from __future__ import unicode_literals -from __future__ import print_function -from __future__ import division -from __future__ import absolute_import __version__ = '0.14.0' diff --git a/setup.py b/setup.py index bbb088ef2672..708c2a5043c1 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,6 @@ "packaging~=17.1", "typing~=3.6", "future~=0.16.0", - "six~=1.11", "tqdm~=4.19", "requests~=2.20", "jsonschema~=2.6", @@ -66,7 +65,6 @@ "License :: OSI Approved :: Apache Software License", # supported python versions "Programming Language :: Python", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries", diff --git a/tests/base/test_components.py b/tests/base/test_components.py index c41aa3f24d94..36e1b09076a7 100644 --- a/tests/base/test_components.py +++ b/tests/base/test_components.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import pytest diff --git a/tests/base/test_config.py b/tests/base/test_config.py index 043810255daf..3cf420f6aaf1 100644 --- a/tests/base/test_config.py +++ b/tests/base/test_config.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import tempfile diff --git a/tests/base/test_data_router.py b/tests/base/test_data_router.py index b791c0fc6726..5927ca7e049a 100644 --- a/tests/base/test_data_router.py +++ b/tests/base/test_data_router.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import mock diff --git a/tests/base/test_emulators.py b/tests/base/test_emulators.py index 379f5637dd47..1de3b60a7c34 100644 --- a/tests/base/test_emulators.py +++ b/tests/base/test_emulators.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals def test_luis_request(): diff --git a/tests/base/test_evaluation.py b/tests/base/test_evaluation.py index 93beaf306eb3..cef8e14787b5 100644 --- a/tests/base/test_evaluation.py +++ b/tests/base/test_evaluation.py @@ -1,8 +1,4 @@ # coding=utf-8 -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging diff --git a/tests/base/test_extractors.py b/tests/base/test_extractors.py index 0d28329012cd..32f6b8099a9e 100644 --- a/tests/base/test_extractors.py +++ b/tests/base/test_extractors.py @@ -1,8 +1,4 @@ # coding=utf-8 -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals from rasa_nlu.config import RasaNLUModelConfig from rasa_nlu.extractors.spacy_entity_extractor import SpacyEntityExtractor diff --git a/tests/base/test_featurizers.py b/tests/base/test_featurizers.py index d05e475e3057..e1f98fd49347 100644 --- a/tests/base/test_featurizers.py +++ b/tests/base/test_featurizers.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import os diff --git a/tests/base/test_interpreter.py b/tests/base/test_interpreter.py index 7f51c39f9678..91724da15b51 100644 --- a/tests/base/test_interpreter.py +++ b/tests/base/test_interpreter.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import rasa_nlu diff --git a/tests/base/test_multitenancy.py b/tests/base/test_multitenancy.py index f7295a49a03b..6841d5afa08d 100644 --- a/tests/base/test_multitenancy.py +++ b/tests/base/test_multitenancy.py @@ -1,8 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import os import tempfile diff --git a/tests/base/test_persistor.py b/tests/base/test_persistor.py index e262211f724c..c2440a5f6cae 100644 --- a/tests/base/test_persistor.py +++ b/tests/base/test_persistor.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import os diff --git a/tests/base/test_project.py b/tests/base/test_project.py index e62526b79380..438e1de2476b 100644 --- a/tests/base/test_project.py +++ b/tests/base/test_project.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import io diff --git a/tests/base/test_server.py b/tests/base/test_server.py index 07c922350713..43f495162749 100644 --- a/tests/base/test_server.py +++ b/tests/base/test_server.py @@ -1,8 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import io import json diff --git a/tests/base/test_synonyms.py b/tests/base/test_synonyms.py index 3c5b407c2ab8..15227858a0e8 100644 --- a/tests/base/test_synonyms.py +++ b/tests/base/test_synonyms.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals from rasa_nlu.extractors.entity_synonyms import EntitySynonymMapper from rasa_nlu.model import Metadata diff --git a/tests/base/test_tokenizers.py b/tests/base/test_tokenizers.py index 410525d172b8..7867c221aa74 100644 --- a/tests/base/test_tokenizers.py +++ b/tests/base/test_tokenizers.py @@ -1,8 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import mock diff --git a/tests/base/test_training_data.py b/tests/base/test_training_data.py index 0935863cbca1..d1642a8b7807 100644 --- a/tests/base/test_training_data.py +++ b/tests/base/test_training_data.py @@ -1,8 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import tempfile diff --git a/tests/base/test_utils.py b/tests/base/test_utils.py index 07364dad639d..5b5292eae128 100644 --- a/tests/base/test_utils.py +++ b/tests/base/test_utils.py @@ -1,8 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import io import json diff --git a/tests/conftest.py b/tests/conftest.py index 31f81932c498..cf830a84a0cd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import logging import os diff --git a/tests/example_component.py b/tests/example_component.py index 8cdcb709b3f7..7dcafe63235e 100644 --- a/tests/example_component.py +++ b/tests/example_component.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals from rasa_nlu.components import Component diff --git a/tests/training/test_train.py b/tests/training/test_train.py index fe6b418454c4..5c635d84f710 100644 --- a/tests/training/test_train.py +++ b/tests/training/test_train.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import os import pytest diff --git a/tests/utilities.py b/tests/utilities.py index 8a418106fb4c..103ca67b7572 100644 --- a/tests/utilities.py +++ b/tests/utilities.py @@ -1,7 +1,3 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals import tempfile From a59fe5d83b142b2e666323c1a359277084d60021 Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Wed, 23 Jan 2019 14:53:33 +0100 Subject: [PATCH 02/43] removed py2 from travis build --- .travis.yml | 1 - docs/faq.rst | 58 ++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a7ecbd48b37..7261d47ce998 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ cache: - $HOME/.cache/pip - /tmp/cached/ python: - - '2.7' - '3.5' - '3.6' env: diff --git a/docs/faq.rst b/docs/faq.rst index 0dc2cf457824..40d9fd8e2053 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -6,31 +6,41 @@ Frequently Asked Questions Which languages does the Rasa NLU support? ------------------------------------------ -Rasa NLU can be used to understand any language that can be tokenized (on whitespace or using a custom tokenizer), +Rasa NLU can be used to understand any language that can be +tokenized (on whitespace or using a custom tokenizer), but some backends are restricted to specific languages. -The ``tensorflow_embedding`` pipeline can be used for any language because it trains custom word embeddings for your domain using the data you provide in the NLU training examples. +The ``tensorflow_embedding`` pipeline can be used for any language +because it trains custom word embeddings for your domain using the +data you provide in the NLU training examples. -Other backends use pre-trained word vectors and therefore are restricted to languages which have pre-trained -vectors available. +Other backends use pre-trained word vectors and therefore are +restricted to languages which have pre-trained vectors available. -You can read more about the Rasa NLU supported languages in :ref:`section_languages`. +You can read more about the Rasa NLU supported languages in +:ref:`section_languages`. How many training examples do I need? ------------------------------------- Unfortunately, the answer is *it depends*. -A good starting point is to have 10 examples for each intent and build up from there. +A good starting point is to have 10 examples for each intent +and build up from there. -If you have intents that are easily confusable, you will need more training data. Accordingly, as you add more -intents, you also want to add more training examples for each intent. If you quickly write 20-30 unique expressions for +If you have intents that are easily confusable, you will need more +training data. Accordingly, as you add more +intents, you also want to add more training examples for each intent. +If you quickly write 20-30 unique expressions for each intent, you should be good for the beginning. -The same holds true for entities. the number of training examples you will need depends on how closely related your different entity types are and how clearly -entities are distinguishable from non-entities in your use case. +The same holds true for entities. the number of training examples you +will need depends on how closely related your different entity types +are and how clearly entities are distinguishable from non-entities in +your use case. -To assess your model's performance, use the :ref:`evaluation script `. +To assess your model's performance, use the +:ref:`evaluation script `. .. _section_faq_version: @@ -43,26 +53,38 @@ To find out which Rasa version you are running, you can execute python -c "import rasa_nlu; print(rasa_nlu.__version__);" -If you are using a virtual environment to run your python code, make sure you are using the correct python to execute the above code. +If you are using a virtual environment to run your python code, make sure +you are using the correct python to execute the above code. Why am I getting an ``UndefinedMetricWarning``? ----------------------------------------------- -The complete warning is: ``UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.`` -The warning is a result of a lack of training data. During the training the dataset will be splitted multiple times, if there are to few training samples for any of the intents, the splitting might result in splits that do not contain any examples for this intent. +The complete warning is: +``UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.`` +The warning is a result of a lack of training data. During the training +the dataset will be splitted multiple times, if there are to few training +samples for any of the intents, the splitting might result in splits that +do not contain any examples for this intent. -Hence, the solution is to add more training samples. As this is only a warning, training will still succeed, but the resulting models predictions might be weak on the intents where you are lacking training data.   +Hence, the solution is to add more training samples. As this is only a +warning, training will still succeed, but the resulting models predictions +might be weak on the intents where you are lacking training data.   I have an issue, can you help me? --------------------------------- -We'd love to help you. If you are unsure if your issue is related to your setup, you should state your problem in the `Rasa Community Forum `_. -If you found an issue with the framework, please file a report on `github issues `_ +We'd love to help you. If you are unsure if your issue is related to your +setup, you should state your problem in the +`Rasa Community Forum `_. +If you found an issue with the framework, please file a report on +`github issues `_ including all the information needed to reproduce the problem. Does it run with python 3? -------------------------- -Yes it does, Rasa NLU supports python 2.7 as well as python 3.5 and 3.6. If there are any issues with a specific python version, feel free to create an issue or directly provide a fix. +Yes it does, Rasa NLU supports python 3.5 and 3.6 (supported for python 2.7 +up until version 0.14). If there are any issues with a specific python version, +feel free to create an issue or directly provide a fix. .. include:: feedback.inc From 9181d339b6d298796324b54b5fa1915b37e2b931 Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Wed, 23 Jan 2019 14:58:06 +0100 Subject: [PATCH 03/43] added py3 note --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index da8cbdf622f4..363fb11fa9d6 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,13 @@ If you are new to Rasa NLU and want to create a bot, you should start with the [ - **I would like to contribute 🤗** [How to contribute](#how-to-contribute) +### Important Note + +Current github master version does NOT support python 2.7 anymore (neither +will the next major release). If you want to use Rasa NLU with python +2.7, please install the most recent version from pypi (0.14). + + # Quick Install For the full installation instructions, please head over to the documenation: [Installation](https://nlu.rasa.com/installation.html) From ba9f40c28c1f053d829b68f32cf21f3a9f407e9d Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Wed, 23 Jan 2019 15:02:22 +0100 Subject: [PATCH 04/43] removed py2 building of wheel --- README.md | 3 ++- rasa_nlu/server.py | 3 +-- rasa_nlu/utils/__init__.py | 6 +----- setup.cfg | 4 ---- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 363fb11fa9d6..0ee3ba12fa74 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Rasa NLU [![Join the forum at https://forum.rasa.com](https://img.shields.io/badge/forum-join%20discussions-brightgreen.svg)](https://forum.rasa.com/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![PyPI version](https://badge.fury.io/py/rasa_nlu.svg)](https://badge.fury.io/py/rasa_nlu) +[![Supported Python Versions](https://img.shields.io/pypi/pyversions/rasa_nlu.svg)](https://pypi.python.org/pypi/rasa_nlu) [![Build Status](https://travis-ci.com/RasaHQ/rasa_nlu.svg?branch=master)](https://travis-ci.com/RasaHQ/rasa_nlu) [![Coverage Status](https://coveralls.io/repos/github/RasaHQ/rasa_nlu/badge.svg?branch=master)](https://coveralls.io/github/RasaHQ/rasa_nlu?branch=master) -[![PyPI version](https://badge.fury.io/py/rasa_nlu.svg)](https://badge.fury.io/py/rasa_nlu) [![Documentation Status](https://img.shields.io/badge/docs-stable-brightgreen.svg)](https://nlu.rasa.com/) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FRasaHQ%2Frasa_nlu.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FRasaHQ%2Frasa_nlu?ref=badge_shield) diff --git a/rasa_nlu/server.py b/rasa_nlu/server.py index 656ef1a5299a..779b11e722ff 100644 --- a/rasa_nlu/server.py +++ b/rasa_nlu/server.py @@ -151,9 +151,8 @@ def decorated(*args, **kwargs): def decode_parameters(request): - """Make sure all the parameters have the same encoding. + """Make sure all the parameters have the same encoding.""" - Ensures py2 / py3 compatibility.""" return { key.decode('utf-8', 'strict'): value[0].decode('utf-8', 'strict') for key, value in request.args.items()} diff --git a/rasa_nlu/utils/__init__.py b/rasa_nlu/utils/__init__.py index 54c36ed7a237..f50ae0de295b 100644 --- a/rasa_nlu/utils/__init__.py +++ b/rasa_nlu/utils/__init__.py @@ -347,14 +347,10 @@ def configure_colored_logging(loglevel): def pycloud_unpickle(file_name): # type: (Text) -> Any """Unpickle an object from file using cloudpickle.""" - from future.utils import PY2 import cloudpickle with io.open(file_name, 'rb') as f: # pragma: no test - if PY2: - return cloudpickle.load(f) - else: - return cloudpickle.load(f, encoding="latin-1") + return cloudpickle.load(f, encoding="latin-1") def pycloud_pickle(file_name, obj): diff --git a/setup.cfg b/setup.cfg index 2fd21bce8e8f..b9054292530c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,7 +12,3 @@ pep8ignore = [metadata] description-file = README.md license_file = LICENSE.txt - -[bdist_wheel] -# this will create a universal wheel for all distributions and py2 & py3 -universal=1 From cd017f9bed663b45f50eb9897937f99c3d106c48 Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Wed, 23 Jan 2019 15:04:00 +0100 Subject: [PATCH 05/43] fixed docker container --- docker/Dockerfile_mitie | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile_mitie b/docker/Dockerfile_mitie index fae04c2ca0c5..ef8c17c1a3fc 100644 --- a/docker/Dockerfile_mitie +++ b/docker/Dockerfile_mitie @@ -1,4 +1,4 @@ -FROM python:2.7-slim +FROM python:3.6-slim ENV RASA_NLU_DOCKER="YES" \ RASA_NLU_HOME=/app \ From 1d3a46e04f086316ef5e807b47af87910de19495 Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Wed, 23 Jan 2019 15:06:36 +0100 Subject: [PATCH 06/43] added to changelog --- CHANGELOG.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f0ccae7418e3..3749ffd6e7e2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,22 @@ Change Log All notable changes to this project will be documented in this file. This project adheres to `Semantic Versioning`_ starting with version 0.7.0. +[Unreleased 0.15.0.aX] - `master`_ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Added +----- + +Changed +------- + +Removed +------- +- **removed python 2.7 support** + +Fixed +----- + .. _v0-14-0: [0.14.0] - 2018-01-23 From e96cb92e2ce97df977202ddaa9d19ddcbfc7359a Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Wed, 23 Jan 2019 15:10:34 +0100 Subject: [PATCH 07/43] increased version number --- rasa_nlu/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rasa_nlu/version.py b/rasa_nlu/version.py index 6bb9e7ab7f1e..aafb84424b26 100644 --- a/rasa_nlu/version.py +++ b/rasa_nlu/version.py @@ -1,2 +1,2 @@ -__version__ = '0.14.0' +__version__ = '0.15.0a1' From b647f32efb7e20fe7f317c49b7cafa0c54e631c7 Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Wed, 23 Jan 2019 15:22:03 +0100 Subject: [PATCH 08/43] fixed error --- rasa_nlu/training_data/formats/dialogflow.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rasa_nlu/training_data/formats/dialogflow.py b/rasa_nlu/training_data/formats/dialogflow.py index baa5aaad18d9..63e971c2188a 100644 --- a/rasa_nlu/training_data/formats/dialogflow.py +++ b/rasa_nlu/training_data/formats/dialogflow.py @@ -80,8 +80,13 @@ def _read_entities(self, examples_js): return TrainingData([], entity_synonyms) def _read_examples_js(self, fn, language, fformat): - """Infer and load the example file based on the root filename and root format.""" - examples_type = "usersays" if fformat == DIALOGFLOW_INTENT else "entries" + """Infer and load the example file based on the root + filename and root format.""" + + if fformat == DIALOGFLOW_INTENT: + examples_type = "usersays" + else: + examples_type = "entries" examples_fn_ending = "_{}_{}.json".format(examples_type, language) examples_fn = fn.replace(".json", examples_fn_ending) if os.path.isfile(examples_fn): From bba788452c3804ab789a289ecdbddcda4b02212f Mon Sep 17 00:00:00 2001 From: Tom Bocklisch Date: Wed, 23 Jan 2019 15:29:50 +0100 Subject: [PATCH 09/43] fixed pep8 --- rasa_nlu/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rasa_nlu/project.py b/rasa_nlu/project.py index e749e8941d69..628c2c96a70e 100644 --- a/rasa_nlu/project.py +++ b/rasa_nlu/project.py @@ -120,8 +120,8 @@ def _pull_model_and_fingerprint(model_server, model_directory, fingerprint): return None, None elif response.status_code != 200: logger.warning("Tried to fetch model from server, but server response " - "status code is {}. We'll retry later..." - "".format(response.status_code)) + "status code is {}. We'll retry later..." + "".format(response.status_code)) return None, None zip_ref = zipfile.ZipFile(IOReader(response.content)) From f9bef31a213ade6a20ea2e6d70e4731166438227 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:26:45 +0100 Subject: [PATCH 10/43] Update rasa_nlu/classifiers/__init__.py Co-Authored-By: tmbo --- rasa_nlu/classifiers/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/classifiers/__init__.py b/rasa_nlu/classifiers/__init__.py index 5c2657fb17b0..8302d4353217 100644 --- a/rasa_nlu/classifiers/__init__.py +++ b/rasa_nlu/classifiers/__init__.py @@ -1,4 +1,3 @@ - # How many intents are at max put into the output intent # ranking, everything else will be cut off INTENT_RANKING_LENGTH = 10 From f5f857c2e53ea924cc254adcc3483fe5aeaae668 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:26:54 +0100 Subject: [PATCH 11/43] Update rasa_nlu/classifiers/embedding_intent_classifier.py Co-Authored-By: tmbo --- rasa_nlu/classifiers/embedding_intent_classifier.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/classifiers/embedding_intent_classifier.py b/rasa_nlu/classifiers/embedding_intent_classifier.py index 07d7f183e7eb..e9eed11995bb 100644 --- a/rasa_nlu/classifiers/embedding_intent_classifier.py +++ b/rasa_nlu/classifiers/embedding_intent_classifier.py @@ -1,4 +1,3 @@ - import io import copy import logging From c16565a02e66f99dd7c208097641804e628da06f Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:27:07 +0100 Subject: [PATCH 12/43] Update rasa_nlu/classifiers/sklearn_intent_classifier.py Co-Authored-By: tmbo --- rasa_nlu/classifiers/sklearn_intent_classifier.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/classifiers/sklearn_intent_classifier.py b/rasa_nlu/classifiers/sklearn_intent_classifier.py index 25093dc28f02..881169c18dfa 100644 --- a/rasa_nlu/classifiers/sklearn_intent_classifier.py +++ b/rasa_nlu/classifiers/sklearn_intent_classifier.py @@ -1,4 +1,3 @@ - import logging import typing from builtins import zip From 7b21ed3645bdbe56cc60dab19695a0ffd419e6a5 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:27:29 +0100 Subject: [PATCH 13/43] Update rasa_nlu/classifiers/mitie_intent_classifier.py Co-Authored-By: tmbo --- rasa_nlu/classifiers/mitie_intent_classifier.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/classifiers/mitie_intent_classifier.py b/rasa_nlu/classifiers/mitie_intent_classifier.py index 14c21242b7c2..5356d2c653a2 100644 --- a/rasa_nlu/classifiers/mitie_intent_classifier.py +++ b/rasa_nlu/classifiers/mitie_intent_classifier.py @@ -1,4 +1,3 @@ - import os import typing From 579b0ccf3bdb4bb8a0a1d9b7d79081d5603436d1 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:27:40 +0100 Subject: [PATCH 14/43] Update rasa_nlu/convert.py Co-Authored-By: tmbo --- rasa_nlu/convert.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/convert.py b/rasa_nlu/convert.py index 67a08b077cc8..79311d86fd86 100644 --- a/rasa_nlu/convert.py +++ b/rasa_nlu/convert.py @@ -1,4 +1,3 @@ - import argparse from rasa_nlu import training_data From ee4af9ad45acd3bafcb6ead2226b9435bbed0d45 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:28:27 +0100 Subject: [PATCH 15/43] Update rasa_nlu/data_router.py Co-Authored-By: tmbo --- rasa_nlu/data_router.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/data_router.py b/rasa_nlu/data_router.py index f30367e62058..958c56a82048 100644 --- a/rasa_nlu/data_router.py +++ b/rasa_nlu/data_router.py @@ -1,4 +1,3 @@ - import datetime import io import logging From f4458017adc5b474dda16ac3355ae90ba6e5ea89 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:28:36 +0100 Subject: [PATCH 16/43] Update tests/base/test_synonyms.py Co-Authored-By: tmbo --- tests/base/test_synonyms.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/base/test_synonyms.py b/tests/base/test_synonyms.py index 15227858a0e8..caa4faca1248 100644 --- a/tests/base/test_synonyms.py +++ b/tests/base/test_synonyms.py @@ -1,4 +1,3 @@ - from rasa_nlu.extractors.entity_synonyms import EntitySynonymMapper from rasa_nlu.model import Metadata import pytest From 9a67c37dd5d55b010cc2264760ecc78624aa8192 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:28:42 +0100 Subject: [PATCH 17/43] Update tests/example_component.py Co-Authored-By: tmbo --- tests/example_component.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/example_component.py b/tests/example_component.py index 7dcafe63235e..010b99e81efb 100644 --- a/tests/example_component.py +++ b/tests/example_component.py @@ -1,4 +1,3 @@ - from rasa_nlu.components import Component From e5ac301142fda41ce7f62a06ced5db7752d059de Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:28:50 +0100 Subject: [PATCH 18/43] Update tests/training/test_train.py Co-Authored-By: tmbo --- tests/training/test_train.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/training/test_train.py b/tests/training/test_train.py index 5c635d84f710..7df8e98078b5 100644 --- a/tests/training/test_train.py +++ b/tests/training/test_train.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - import os import pytest from rasa_nlu.config import RasaNLUModelConfig From 614300ea308cc8c07f6ef68ce82432369695b799 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:28:58 +0100 Subject: [PATCH 19/43] Update tests/utilities.py Co-Authored-By: tmbo --- tests/utilities.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/utilities.py b/tests/utilities.py index 103ca67b7572..21955ce4b94a 100644 --- a/tests/utilities.py +++ b/tests/utilities.py @@ -1,4 +1,3 @@ - import tempfile import pytest From 6f3117d2e6ca43898833d705eb7ed7124aeed893 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:29:05 +0100 Subject: [PATCH 20/43] Update tests/conftest.py Co-Authored-By: tmbo --- tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index cf830a84a0cd..b9499a4f5fd1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,3 @@ - import logging import os From 37c1ec63f3bddf479bfdf6429e66ef80afa02f2d Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:29:20 +0100 Subject: [PATCH 21/43] Update rasa_nlu/emulators/luis.py Co-Authored-By: tmbo --- rasa_nlu/emulators/luis.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/emulators/luis.py b/rasa_nlu/emulators/luis.py index 989e0ac8496f..77ceee03dc3d 100644 --- a/rasa_nlu/emulators/luis.py +++ b/rasa_nlu/emulators/luis.py @@ -1,4 +1,3 @@ - from typing import Any from typing import Dict from typing import Text From 0003f8100366ca4a023defa6cc36fca7a59e7815 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:29:45 +0100 Subject: [PATCH 22/43] Update rasa_nlu/emulators/wit.py Co-Authored-By: tmbo --- rasa_nlu/emulators/wit.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/emulators/wit.py b/rasa_nlu/emulators/wit.py index b972dbb05da2..9034604b39f3 100644 --- a/rasa_nlu/emulators/wit.py +++ b/rasa_nlu/emulators/wit.py @@ -1,4 +1,3 @@ - from typing import Any from typing import Dict from typing import List From be6b27c6e1001667b24750e8b808b1c9a3ba995e Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:29:58 +0100 Subject: [PATCH 23/43] Update rasa_nlu/evaluate.py Co-Authored-By: tmbo --- rasa_nlu/evaluate.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/evaluate.py b/rasa_nlu/evaluate.py index 86b3f152a938..832f8d6d5392 100644 --- a/rasa_nlu/evaluate.py +++ b/rasa_nlu/evaluate.py @@ -1,4 +1,3 @@ - import itertools import json import logging From a63f49a0e3ff825a9e538d15575fdd313d51c3f6 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:30:09 +0100 Subject: [PATCH 24/43] Update rasa_nlu/extractors/crf_entity_extractor.py Co-Authored-By: tmbo --- rasa_nlu/extractors/crf_entity_extractor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/extractors/crf_entity_extractor.py b/rasa_nlu/extractors/crf_entity_extractor.py index 86940a2a4381..312342b11f40 100644 --- a/rasa_nlu/extractors/crf_entity_extractor.py +++ b/rasa_nlu/extractors/crf_entity_extractor.py @@ -1,4 +1,3 @@ - import logging import os From 3cf7b03d7f8b96dbd5a1114311bfd837f7668800 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:30:27 +0100 Subject: [PATCH 25/43] Update rasa_nlu/extractors/__init__.py Co-Authored-By: tmbo --- rasa_nlu/extractors/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/extractors/__init__.py b/rasa_nlu/extractors/__init__.py index 09d3ff561e1f..5a89979d0ed1 100644 --- a/rasa_nlu/extractors/__init__.py +++ b/rasa_nlu/extractors/__init__.py @@ -1,4 +1,3 @@ - from typing import Any from typing import Dict from typing import List From 8a7f51cd431e86f1967d670dfc6dc4fc18d0fcc6 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:30:43 +0100 Subject: [PATCH 26/43] Update rasa_nlu/extractors/duckling_http_extractor.py Co-Authored-By: tmbo --- rasa_nlu/extractors/duckling_http_extractor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/extractors/duckling_http_extractor.py b/rasa_nlu/extractors/duckling_http_extractor.py index 5a3fdfc7254d..8883c2cd4032 100644 --- a/rasa_nlu/extractors/duckling_http_extractor.py +++ b/rasa_nlu/extractors/duckling_http_extractor.py @@ -1,4 +1,3 @@ - import logging import os import time From 25cfdb901a0ac01b21c7bbdfe8405c4ceb3a1c22 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:31:00 +0100 Subject: [PATCH 27/43] Update rasa_nlu/server.py Co-Authored-By: tmbo --- rasa_nlu/server.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/server.py b/rasa_nlu/server.py index 779b11e722ff..79660c4f9a69 100644 --- a/rasa_nlu/server.py +++ b/rasa_nlu/server.py @@ -1,4 +1,3 @@ - import argparse import logging from functools import wraps From 1d568ab8eb36a2d13cc80ffdb6b091a205c20cdc Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:31:12 +0100 Subject: [PATCH 28/43] Update rasa_nlu/extractors/entity_synonyms.py Co-Authored-By: tmbo --- rasa_nlu/extractors/entity_synonyms.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/extractors/entity_synonyms.py b/rasa_nlu/extractors/entity_synonyms.py index 32e731989d44..b2aa622ad1a0 100644 --- a/rasa_nlu/extractors/entity_synonyms.py +++ b/rasa_nlu/extractors/entity_synonyms.py @@ -1,4 +1,3 @@ - import os import warnings From 2e0bcada294864355ebcf97a780e5bfa3740e247 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:31:23 +0100 Subject: [PATCH 29/43] Update rasa_nlu/extractors/mitie_entity_extractor.py Co-Authored-By: tmbo --- rasa_nlu/extractors/mitie_entity_extractor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/extractors/mitie_entity_extractor.py b/rasa_nlu/extractors/mitie_entity_extractor.py index 35c7f39de228..2ac6746384dc 100644 --- a/rasa_nlu/extractors/mitie_entity_extractor.py +++ b/rasa_nlu/extractors/mitie_entity_extractor.py @@ -1,4 +1,3 @@ - from builtins import range, str import logging import os From d5f89c2882e0e5add8b2c04cfcd8f6fabfca104b Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:31:37 +0100 Subject: [PATCH 30/43] Update rasa_nlu/extractors/spacy_entity_extractor.py Co-Authored-By: tmbo --- rasa_nlu/extractors/spacy_entity_extractor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/extractors/spacy_entity_extractor.py b/rasa_nlu/extractors/spacy_entity_extractor.py index 6145fee7ecbc..910c5512b76e 100644 --- a/rasa_nlu/extractors/spacy_entity_extractor.py +++ b/rasa_nlu/extractors/spacy_entity_extractor.py @@ -1,4 +1,3 @@ - import typing from typing import Any from typing import Dict From 415ddfe48459280390d2115340bfaf8afa94bdd1 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:31:49 +0100 Subject: [PATCH 31/43] Update rasa_nlu/featurizers/__init__.py Co-Authored-By: tmbo --- rasa_nlu/featurizers/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/featurizers/__init__.py b/rasa_nlu/featurizers/__init__.py index d317545fc54a..b6f9f7a17c30 100644 --- a/rasa_nlu/featurizers/__init__.py +++ b/rasa_nlu/featurizers/__init__.py @@ -1,4 +1,3 @@ - import numpy as np from rasa_nlu.components import Component From 5d8250cdfaec647c13453b87c09b15c95b80e0b6 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:31:59 +0100 Subject: [PATCH 32/43] Update rasa_nlu/featurizers/count_vectors_featurizer.py Co-Authored-By: tmbo --- rasa_nlu/featurizers/count_vectors_featurizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/featurizers/count_vectors_featurizer.py b/rasa_nlu/featurizers/count_vectors_featurizer.py index bfb58102bfc6..dff945f5471a 100644 --- a/rasa_nlu/featurizers/count_vectors_featurizer.py +++ b/rasa_nlu/featurizers/count_vectors_featurizer.py @@ -1,4 +1,3 @@ - import logging import os import re From 0e159b6f46b78de6f9d697c8a20896ea3eb443b3 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:32:11 +0100 Subject: [PATCH 33/43] Update rasa_nlu/featurizers/mitie_featurizer.py Co-Authored-By: tmbo --- rasa_nlu/featurizers/mitie_featurizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/featurizers/mitie_featurizer.py b/rasa_nlu/featurizers/mitie_featurizer.py index 95d27514fc70..ddb0fd46f3a8 100644 --- a/rasa_nlu/featurizers/mitie_featurizer.py +++ b/rasa_nlu/featurizers/mitie_featurizer.py @@ -1,4 +1,3 @@ - import numpy as np import typing from typing import Any From 96f01289d4bf548c8f388c262cecfe7add673148 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:32:23 +0100 Subject: [PATCH 34/43] Update rasa_nlu/featurizers/ngram_featurizer.py Co-Authored-By: tmbo --- rasa_nlu/featurizers/ngram_featurizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/featurizers/ngram_featurizer.py b/rasa_nlu/featurizers/ngram_featurizer.py index b8406004ce47..fc04c86f46c6 100644 --- a/rasa_nlu/featurizers/ngram_featurizer.py +++ b/rasa_nlu/featurizers/ngram_featurizer.py @@ -1,4 +1,3 @@ - import logging import os import time From 9502b16486b0631b979886a27ea942c0f79fa8e3 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:32:35 +0100 Subject: [PATCH 35/43] Update rasa_nlu/featurizers/regex_featurizer.py Co-Authored-By: tmbo --- rasa_nlu/featurizers/regex_featurizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/featurizers/regex_featurizer.py b/rasa_nlu/featurizers/regex_featurizer.py index fb5d53138949..24c73952850d 100644 --- a/rasa_nlu/featurizers/regex_featurizer.py +++ b/rasa_nlu/featurizers/regex_featurizer.py @@ -1,4 +1,3 @@ - import logging import os import re From 9c792285641d7f985e0f8a5bbc37c8bbddeaf0fe Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:32:50 +0100 Subject: [PATCH 36/43] Update rasa_nlu/featurizers/spacy_featurizer.py Co-Authored-By: tmbo --- rasa_nlu/featurizers/spacy_featurizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/featurizers/spacy_featurizer.py b/rasa_nlu/featurizers/spacy_featurizer.py index f0f7d7c4115c..c2bcd5638437 100644 --- a/rasa_nlu/featurizers/spacy_featurizer.py +++ b/rasa_nlu/featurizers/spacy_featurizer.py @@ -1,4 +1,3 @@ - import numpy as np import typing from typing import Any From b5cd057ed9d64ee71968e9c3af66c475a747e95a Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:33:02 +0100 Subject: [PATCH 37/43] Update rasa_nlu/model.py Co-Authored-By: tmbo --- rasa_nlu/model.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/model.py b/rasa_nlu/model.py index dc3283c552da..de2892990ac5 100644 --- a/rasa_nlu/model.py +++ b/rasa_nlu/model.py @@ -1,4 +1,3 @@ - import copy import datetime import logging From 1bbe5bac9457d9d1140671a0b2a9aeea13a49032 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:33:12 +0100 Subject: [PATCH 38/43] Update rasa_nlu/persistor.py Co-Authored-By: tmbo --- rasa_nlu/persistor.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/persistor.py b/rasa_nlu/persistor.py index 22d58ecdb68f..06cff2f6aea4 100644 --- a/rasa_nlu/persistor.py +++ b/rasa_nlu/persistor.py @@ -1,4 +1,3 @@ - import io import logging import os From ea40b865c591e8af3118084a387fb8562b265893 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:33:23 +0100 Subject: [PATCH 39/43] Update rasa_nlu/run.py Co-Authored-By: tmbo --- rasa_nlu/run.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/run.py b/rasa_nlu/run.py index 47802c860225..376e9259c409 100644 --- a/rasa_nlu/run.py +++ b/rasa_nlu/run.py @@ -1,4 +1,3 @@ - import json import logging From 4322642dcebb230fd27ea7681e6cab41ff2588f9 Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:33:38 +0100 Subject: [PATCH 40/43] Update rasa_nlu/tokenizers/jieba_tokenizer.py Co-Authored-By: tmbo --- rasa_nlu/tokenizers/jieba_tokenizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/tokenizers/jieba_tokenizer.py b/rasa_nlu/tokenizers/jieba_tokenizer.py index efabc2ce203a..0a414d39606a 100644 --- a/rasa_nlu/tokenizers/jieba_tokenizer.py +++ b/rasa_nlu/tokenizers/jieba_tokenizer.py @@ -1,4 +1,3 @@ - import glob import logging import os From 0fb895ee3b7a0e7c135d96b7433c5064241af81a Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:33:59 +0100 Subject: [PATCH 41/43] Update rasa_nlu/tokenizers/spacy_tokenizer.py Co-Authored-By: tmbo --- rasa_nlu/tokenizers/spacy_tokenizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/tokenizers/spacy_tokenizer.py b/rasa_nlu/tokenizers/spacy_tokenizer.py index c752dfd0fdf6..60fb603c7662 100644 --- a/rasa_nlu/tokenizers/spacy_tokenizer.py +++ b/rasa_nlu/tokenizers/spacy_tokenizer.py @@ -1,4 +1,3 @@ - import typing from typing import Any, List From 28738c6f3c9b17e7022c26662f967fe7998c9d0f Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:34:16 +0100 Subject: [PATCH 42/43] Update rasa_nlu/tokenizers/whitespace_tokenizer.py Co-Authored-By: tmbo --- rasa_nlu/tokenizers/whitespace_tokenizer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rasa_nlu/tokenizers/whitespace_tokenizer.py b/rasa_nlu/tokenizers/whitespace_tokenizer.py index b70130d3a320..67d4ab90f01c 100644 --- a/rasa_nlu/tokenizers/whitespace_tokenizer.py +++ b/rasa_nlu/tokenizers/whitespace_tokenizer.py @@ -1,4 +1,3 @@ - import re from typing import Any, List, Text From 2c6a48917483c0c2656c0c92ade46fc0e81d099f Mon Sep 17 00:00:00 2001 From: ricwo Date: Wed, 23 Jan 2019 18:35:49 +0100 Subject: [PATCH 43/43] Apply suggestions from code review Co-Authored-By: tmbo --- rasa_nlu/train.py | 1 - rasa_nlu/training_data/__init__.py | 1 - rasa_nlu/training_data/formats/__init__.py | 1 - rasa_nlu/training_data/formats/dialogflow.py | 1 - rasa_nlu/training_data/formats/luis.py | 1 - rasa_nlu/training_data/formats/markdown.py | 1 - rasa_nlu/training_data/formats/rasa.py | 1 - rasa_nlu/training_data/formats/readerwriter.py | 1 - rasa_nlu/training_data/formats/wit.py | 1 - rasa_nlu/training_data/loading.py | 1 - rasa_nlu/training_data/message.py | 1 - rasa_nlu/training_data/training_data.py | 1 - rasa_nlu/training_data/util.py | 1 - rasa_nlu/utils/__init__.py | 1 - rasa_nlu/utils/mitie_utils.py | 1 - rasa_nlu/utils/spacy_utils.py | 1 - rasa_nlu/version.py | 1 - tests/base/test_components.py | 1 - tests/base/test_config.py | 1 - tests/base/test_data_router.py | 1 - tests/base/test_emulators.py | 2 -- tests/base/test_featurizers.py | 1 - tests/base/test_interpreter.py | 1 - tests/base/test_multitenancy.py | 1 - tests/base/test_persistor.py | 1 - tests/base/test_project.py | 1 - tests/base/test_server.py | 1 - 27 files changed, 28 deletions(-) diff --git a/rasa_nlu/train.py b/rasa_nlu/train.py index 8579d268d856..323c8af43f11 100644 --- a/rasa_nlu/train.py +++ b/rasa_nlu/train.py @@ -1,4 +1,3 @@ - import argparse import logging import typing diff --git a/rasa_nlu/training_data/__init__.py b/rasa_nlu/training_data/__init__.py index 94cc015a41f1..298cd581e108 100644 --- a/rasa_nlu/training_data/__init__.py +++ b/rasa_nlu/training_data/__init__.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - from rasa_nlu.training_data.message import Message from rasa_nlu.training_data.training_data import TrainingData from rasa_nlu.training_data.loading import load_data diff --git a/rasa_nlu/training_data/formats/__init__.py b/rasa_nlu/training_data/formats/__init__.py index 842d5ae86346..f0876c87abb9 100644 --- a/rasa_nlu/training_data/formats/__init__.py +++ b/rasa_nlu/training_data/formats/__init__.py @@ -1,4 +1,3 @@ - from rasa_nlu.training_data.formats.dialogflow import DialogflowReader from rasa_nlu.training_data.formats.luis import LuisReader from rasa_nlu.training_data.formats.wit import WitReader diff --git a/rasa_nlu/training_data/formats/dialogflow.py b/rasa_nlu/training_data/formats/dialogflow.py index 63e971c2188a..c58cfebde3ce 100644 --- a/rasa_nlu/training_data/formats/dialogflow.py +++ b/rasa_nlu/training_data/formats/dialogflow.py @@ -1,4 +1,3 @@ - import logging import os diff --git a/rasa_nlu/training_data/formats/luis.py b/rasa_nlu/training_data/formats/luis.py index a6dddbdf0015..ceba015e2e1b 100644 --- a/rasa_nlu/training_data/formats/luis.py +++ b/rasa_nlu/training_data/formats/luis.py @@ -1,4 +1,3 @@ - import logging from rasa_nlu.training_data import Message, TrainingData diff --git a/rasa_nlu/training_data/formats/markdown.py b/rasa_nlu/training_data/formats/markdown.py index 6d38bf5c4f0f..33c0d1a76859 100644 --- a/rasa_nlu/training_data/formats/markdown.py +++ b/rasa_nlu/training_data/formats/markdown.py @@ -1,4 +1,3 @@ - import re import logging diff --git a/rasa_nlu/training_data/formats/rasa.py b/rasa_nlu/training_data/formats/rasa.py index 6563fe07e22d..4328f3251ced 100644 --- a/rasa_nlu/training_data/formats/rasa.py +++ b/rasa_nlu/training_data/formats/rasa.py @@ -1,4 +1,3 @@ - import logging from collections import defaultdict diff --git a/rasa_nlu/training_data/formats/readerwriter.py b/rasa_nlu/training_data/formats/readerwriter.py index 8b8040689d26..d0d386469169 100644 --- a/rasa_nlu/training_data/formats/readerwriter.py +++ b/rasa_nlu/training_data/formats/readerwriter.py @@ -1,4 +1,3 @@ - import json from rasa_nlu import utils diff --git a/rasa_nlu/training_data/formats/wit.py b/rasa_nlu/training_data/formats/wit.py index b2b050cf26ba..bd48103403eb 100644 --- a/rasa_nlu/training_data/formats/wit.py +++ b/rasa_nlu/training_data/formats/wit.py @@ -1,4 +1,3 @@ - import logging from rasa_nlu.training_data import Message, TrainingData diff --git a/rasa_nlu/training_data/loading.py b/rasa_nlu/training_data/loading.py index c9dd01cc3318..5940079b4086 100644 --- a/rasa_nlu/training_data/loading.py +++ b/rasa_nlu/training_data/loading.py @@ -1,4 +1,3 @@ - import json import logging diff --git a/rasa_nlu/training_data/message.py b/rasa_nlu/training_data/message.py index 3943ddac476b..5447fe15e2ac 100644 --- a/rasa_nlu/training_data/message.py +++ b/rasa_nlu/training_data/message.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - from rasa_nlu.utils import ordered diff --git a/rasa_nlu/training_data/training_data.py b/rasa_nlu/training_data/training_data.py index 4453d30510ed..b021dcbbeb54 100644 --- a/rasa_nlu/training_data/training_data.py +++ b/rasa_nlu/training_data/training_data.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - import logging import os import warnings diff --git a/rasa_nlu/training_data/util.py b/rasa_nlu/training_data/util.py index b9525b0a24e9..5b55a8dbaa3c 100644 --- a/rasa_nlu/training_data/util.py +++ b/rasa_nlu/training_data/util.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - import logging logger = logging.getLogger(__name__) diff --git a/rasa_nlu/utils/__init__.py b/rasa_nlu/utils/__init__.py index f50ae0de295b..173a845b68b0 100644 --- a/rasa_nlu/utils/__init__.py +++ b/rasa_nlu/utils/__init__.py @@ -1,4 +1,3 @@ - import errno import glob diff --git a/rasa_nlu/utils/mitie_utils.py b/rasa_nlu/utils/mitie_utils.py index 53da784ae68e..2f7a7e6e447e 100644 --- a/rasa_nlu/utils/mitie_utils.py +++ b/rasa_nlu/utils/mitie_utils.py @@ -1,4 +1,3 @@ - import os import typing diff --git a/rasa_nlu/utils/spacy_utils.py b/rasa_nlu/utils/spacy_utils.py index bbf9341543e2..251cd3bf00a8 100644 --- a/rasa_nlu/utils/spacy_utils.py +++ b/rasa_nlu/utils/spacy_utils.py @@ -1,4 +1,3 @@ - import logging import typing diff --git a/rasa_nlu/version.py b/rasa_nlu/version.py index aafb84424b26..182a4072f0c1 100644 --- a/rasa_nlu/version.py +++ b/rasa_nlu/version.py @@ -1,2 +1 @@ - __version__ = '0.15.0a1' diff --git a/tests/base/test_components.py b/tests/base/test_components.py index 36e1b09076a7..33cdb2a9f495 100644 --- a/tests/base/test_components.py +++ b/tests/base/test_components.py @@ -1,4 +1,3 @@ - import pytest from rasa_nlu import registry diff --git a/tests/base/test_config.py b/tests/base/test_config.py index 3cf420f6aaf1..7f38a5504166 100644 --- a/tests/base/test_config.py +++ b/tests/base/test_config.py @@ -1,4 +1,3 @@ - import tempfile import pytest diff --git a/tests/base/test_data_router.py b/tests/base/test_data_router.py index 5927ca7e049a..b1a89d079b06 100644 --- a/tests/base/test_data_router.py +++ b/tests/base/test_data_router.py @@ -1,4 +1,3 @@ - import mock from rasa_nlu import data_router diff --git a/tests/base/test_emulators.py b/tests/base/test_emulators.py index 1de3b60a7c34..5f1a589c056c 100644 --- a/tests/base/test_emulators.py +++ b/tests/base/test_emulators.py @@ -1,5 +1,3 @@ - - def test_luis_request(): from rasa_nlu.emulators.luis import LUISEmulator em = LUISEmulator() diff --git a/tests/base/test_featurizers.py b/tests/base/test_featurizers.py index e1f98fd49347..611c1a738569 100644 --- a/tests/base/test_featurizers.py +++ b/tests/base/test_featurizers.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 - - import os import numpy as np diff --git a/tests/base/test_interpreter.py b/tests/base/test_interpreter.py index 91724da15b51..76aaf9647745 100644 --- a/tests/base/test_interpreter.py +++ b/tests/base/test_interpreter.py @@ -1,4 +1,3 @@ - import rasa_nlu import pytest diff --git a/tests/base/test_multitenancy.py b/tests/base/test_multitenancy.py index 6841d5afa08d..e286895aa97e 100644 --- a/tests/base/test_multitenancy.py +++ b/tests/base/test_multitenancy.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - import os import tempfile diff --git a/tests/base/test_persistor.py b/tests/base/test_persistor.py index c2440a5f6cae..bb54c54ef065 100644 --- a/tests/base/test_persistor.py +++ b/tests/base/test_persistor.py @@ -1,4 +1,3 @@ - import os import mock diff --git a/tests/base/test_project.py b/tests/base/test_project.py index 438e1de2476b..12b99c3be833 100644 --- a/tests/base/test_project.py +++ b/tests/base/test_project.py @@ -1,4 +1,3 @@ - import io import mock diff --git a/tests/base/test_server.py b/tests/base/test_server.py index 43f495162749..d135136a8f72 100644 --- a/tests/base/test_server.py +++ b/tests/base/test_server.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - import io import json import tempfile