Skip to content

Commit

Permalink
Merge branch 'master' into combined-entity-intent-model
Browse files Browse the repository at this point in the history
  • Loading branch information
tabergma committed Oct 25, 2019
2 parents 74ec4c4 + 80cd95b commit 934ae5e
Show file tree
Hide file tree
Showing 35 changed files with 518 additions and 114 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -7,6 +7,7 @@ Rasa Change Log
All notable changes to this project will be documented in this file.
This project adheres to `Semantic Versioning`_ starting with version 1.0.


[Unreleased 1.5.0a1] - `master`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand All @@ -29,6 +30,24 @@ Fixed
-----
- ``MultiProjectImporter`` now imports files in the order of the import statements

[Unreleased 1.4.2]
~~~~~~~~~~~~~~~~~~

Added
-----

Changed
-------

Removed
-------
- TensorFlow deprecation warnings are no longer shown when running ``rasa x``

Fixed
-----
- Fixed ``'Namespace' object has no attribute 'persist_nlu_data'`` error during
interactive learning

[1.4.1] - 2019-10-22
^^^^^^^^^^^^^^^^^^^^
Regression: changes from ``1.2.12`` were missing from ``1.4.0``, readded them
Expand Down
2 changes: 2 additions & 0 deletions data/test_config/keyword_classifier_config.yml
@@ -0,0 +1,2 @@
pipeline:
- name: "KeywordIntentClassifier"
51 changes: 36 additions & 15 deletions docs/nlu/components.rst
Expand Up @@ -272,23 +272,8 @@ CountVectorsFeaturizer
Intent Classifiers
------------------

KeywordIntentClassifier
~~~~~~~~~~~~~~~~~~~~~~~

:Short: Simple keyword matching intent classifier. Not intended to be used.
:Outputs: ``intent``
:Requires: nothing
:Output-Example:

.. code-block:: json
{
"intent": {"name": "greet", "confidence": 0.98343}
}

:Description:
This classifier is mostly used as a placeholder. It is able to recognize `hello` and
`goodbye` intents by searching for these keywords in the passed messages.

MitieIntentClassifier
~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -482,6 +467,41 @@ EmbeddingIntentClassifier
See `starspace paper <https://arxiv.org/abs/1709.03856>`_ for details.


.. _keyword_intent_classifier:

KeywordIntentClassifier
~~~~~~~~~~~~~~~~~~~~~~~

:Short: Simple keyword matching intent classifier, intended for small, short-term projects.
:Outputs: ``intent``
:Requires: nothing

:Output-Example:

.. code-block:: json
{
"intent": {"name": "greet", "confidence": 1.0}
}
:Description:
This classifier works by searching a message for keywords.
The matching is case sensitive by default and searches only for exact matches of the keyword-string in the user message.
The keywords for an intent are the examples of that intent in the NLU training data.
This means the entire example is the keyword, not the individual words in the example.

.. note:: This classifier is intended only for small projects or to get started. If
you have few NLU training data you can use one of our pipelines
:ref:`choosing-a-pipeline`.

:Configuration:

.. code-block:: yaml
pipeline:
- name: "KeywordIntentClassifier"
case_sensitive: True
Selectors
----------

Expand All @@ -493,6 +513,7 @@ Response Selector
:Short: Response Selector
:Outputs: A dictionary with key as ``direct_response_intent`` and value containing ``response`` and ``ranking``
:Requires: A featurizer

:Output-Example:

.. code-block:: json
Expand Down
7 changes: 3 additions & 4 deletions examples/moodbot/data/nlu.md
Expand Up @@ -14,11 +14,11 @@
- good afternoon

## intent:goodbye
- good afternoon
- cu
- good by
- cee you later
- good night
- good afternoon
- bye
- goodbye
- have a nice day
Expand All @@ -42,7 +42,6 @@

## intent:mood_great
- perfect
- very good
- great
- amazing
- feeling like a king
Expand All @@ -51,7 +50,7 @@
- I am great
- I am amazing
- I am going to save the world
- super
- super stoked
- extremely good
- so so perfect
- so good
Expand All @@ -67,7 +66,7 @@
- sad
- very sad
- unhappy
- not so good
- not good
- not very good
- extremly sad
- so saad
Expand Down
2 changes: 2 additions & 0 deletions rasa/cli/arguments/interactive.py
Expand Up @@ -14,6 +14,7 @@
add_debug_plots_param,
add_dump_stories_param,
add_augmentation_param,
add_persist_nlu_data_param,
)


Expand All @@ -38,6 +39,7 @@ def set_interactive_arguments(parser: argparse.ArgumentParser):
add_debug_plots_param(train_arguments)
add_dump_stories_param(train_arguments)
add_force_param(train_arguments)
add_persist_nlu_data_param(train_arguments)


def set_interactive_core_arguments(parser: argparse.ArgumentParser):
Expand Down
9 changes: 6 additions & 3 deletions rasa/cli/interactive.py
Expand Up @@ -52,8 +52,7 @@ def add_subparser(


def interactive(args: argparse.Namespace):
args.fixed_model_name = None
args.store_uncompressed = False
_set_not_required_args(args)

if args.model is None:
check_training_data(args)
Expand All @@ -64,10 +63,14 @@ def interactive(args: argparse.Namespace):
perform_interactive_learning(args, zipped_model)


def interactive_core(args: argparse.Namespace):
def _set_not_required_args(args: argparse.Namespace) -> None:
args.fixed_model_name = None
args.store_uncompressed = False


def interactive_core(args: argparse.Namespace):
_set_not_required_args(args)

if args.model is None:
zipped_model = train.train_core(args)
else:
Expand Down
4 changes: 2 additions & 2 deletions rasa/cli/x.py
Expand Up @@ -59,11 +59,11 @@ def _rasa_service(
):
"""Starts the Rasa application."""
from rasa.core.run import serve_application
import rasa.utils.common

# needs separate logging configuration as it is started in its own process
logging.basicConfig(level=args.loglevel)
rasa.utils.common.set_log_level(args.loglevel)
io_utils.configure_colored_logging(args.loglevel)
logging.getLogger("apscheduler").setLevel(logging.WARNING)

if not credentials_path:
credentials_path = _prepare_credentials_for_rasa_x(
Expand Down
2 changes: 1 addition & 1 deletion rasa/core/lock_store.py
Expand Up @@ -2,7 +2,7 @@
import json
import logging
import os
from typing import Text, Optional, Union, AsyncGenerator, Coroutine
from typing import Text, Optional, Union, AsyncGenerator

from async_generator import asynccontextmanager

Expand Down
2 changes: 0 additions & 2 deletions rasa/core/policies/embedding_policy.py
@@ -1,4 +1,3 @@
from collections import namedtuple
import copy
import json
import logging
Expand All @@ -10,7 +9,6 @@
from typing import Any, List, Optional, Text, Dict, Tuple

import rasa.utils.io
from rasa.core import utils
from rasa.core.domain import Domain
from rasa.core.featurizers import (
TrackerFeaturizer,
Expand Down
2 changes: 1 addition & 1 deletion rasa/core/policies/form_policy.py
@@ -1,6 +1,6 @@
import logging
import typing
from typing import List, Optional, Dict, Text, Optional
from typing import List, Dict, Text, Optional

from rasa.core.actions.action import ACTION_LISTEN_NAME
from rasa.core.domain import PREV_PREFIX, ACTIVE_FORM_PREFIX, Domain, InvalidDomain
Expand Down
1 change: 0 additions & 1 deletion rasa/core/policies/keras_policy.py
Expand Up @@ -9,7 +9,6 @@

import rasa.utils.io

from rasa.core import utils
from rasa.core.domain import Domain
from rasa.core.featurizers import (
MaxHistoryTrackerFeaturizer,
Expand Down
1 change: 0 additions & 1 deletion rasa/core/policies/mapping_policy.py
Expand Up @@ -6,7 +6,6 @@

import rasa.utils.io

from rasa.core import utils
from rasa.core.actions.action import (
ACTION_BACK_NAME,
ACTION_LISTEN_NAME,
Expand Down
1 change: 0 additions & 1 deletion rasa/core/policies/memoization.py
Expand Up @@ -9,7 +9,6 @@

import rasa.utils.io

from rasa.core import utils
from rasa.core.domain import Domain
from rasa.core.events import ActionExecuted
from rasa.core.featurizers import TrackerFeaturizer, MaxHistoryTrackerFeaturizer
Expand Down
1 change: 0 additions & 1 deletion rasa/core/policies/sklearn_policy.py
Expand Up @@ -15,7 +15,6 @@
from typing import Optional, Any, List, Text, Dict, Callable

import rasa.utils.io
from rasa.core import utils
from rasa.core.domain import Domain
from rasa.core.featurizers import TrackerFeaturizer, MaxHistoryTrackerFeaturizer
from rasa.core.policies.policy import Policy
Expand Down
1 change: 0 additions & 1 deletion rasa/core/policies/two_stage_fallback.py
Expand Up @@ -5,7 +5,6 @@
from typing import List, Text, Optional

import rasa.utils.io
from rasa.core import utils
from rasa.core.actions.action import (
ACTION_REVERT_FALLBACK_EVENTS_NAME,
ACTION_DEFAULT_FALLBACK_NAME,
Expand Down
1 change: 0 additions & 1 deletion rasa/core/training/visualization.py
@@ -1,7 +1,6 @@
from collections import defaultdict, deque

import random
import re
from typing import Any, Text, List, Dict, Optional, TYPE_CHECKING

from rasa.core.actions.action import ACTION_LISTEN_NAME
Expand Down
3 changes: 1 addition & 2 deletions rasa/core/validator.py
@@ -1,5 +1,4 @@
import logging
import asyncio
from collections import defaultdict
from typing import List, Set, Text
from rasa.core.domain import Domain
Expand All @@ -13,7 +12,7 @@
logger = logging.getLogger(__name__)


class Validator(object):
class Validator:
"""A class used to verify usage of intents and utterances."""

def __init__(self, domain: Domain, intents: TrainingData, stories: List[StoryStep]):
Expand Down
1 change: 0 additions & 1 deletion rasa/jupyter.py
Expand Up @@ -4,7 +4,6 @@
from typing import Any, Dict, Text, Optional
from rasa.cli.utils import print_success, print_error
from rasa.core.interpreter import NaturalLanguageInterpreter, RasaNLUInterpreter
import rasa.model as model

if typing.TYPE_CHECKING:
from rasa.core.agent import Agent
Expand Down
4 changes: 2 additions & 2 deletions rasa/nlu/classifiers/embedding_intent_classifier.py
Expand Up @@ -724,8 +724,8 @@ def load(

graph = tf.Graph()
with graph.as_default():
session = tf.Session(config=_tf_config)
saver = tf.train.import_meta_graph(checkpoint + ".meta")
session = tf.compat.v1.Session(config=_tf_config)
saver = tf.compat.v1.train.import_meta_graph(checkpoint + ".meta")

saver.restore(session, checkpoint)

Expand Down

0 comments on commit 934ae5e

Please sign in to comment.