Skip to content

Commit 6e23dd3

Browse files
chkosstabergmaindam23federicotdnerohmensing
authored
Merge 1.10.x into master (RasaHQ#5823)
* move set_up_tensorboard_writer to fit * don't log during loading * add changelog entry * check if spacy features are empty * add changelog * add test * update sed command * add log message * fix tests * check if vectors are present * add separate laoding parameter * fix test * fix :ref:s and update docs on form deactivation in validation function * Fix sed command * log request URL on exception * use concat_url for duckling url * changelog entry * Add missing quote * use clean up custom entities * add changelog * Don't add empty roles/groups * add changelog * import module instead of method * make sure 'collect' functions don't alter their inputs * add changelog entry * add test * include review feedback Co-authored-by: Tanja Bergmann <[email protected]> Co-authored-by: melindaloubser1 <[email protected]> Co-authored-by: Melinda Loubser <[email protected]> Co-authored-by: Federico Tedin <[email protected]> Co-authored-by: Ella <[email protected]> Co-authored-by: Federico Tedin <[email protected]> Co-authored-by: Tom Bocklisch <[email protected]> Co-authored-by: Roberto <[email protected]>
1 parent 65400b6 commit 6e23dd3

File tree

23 files changed

+194
-63
lines changed

23 files changed

+194
-63
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Features
3939

4040
.. note::
4141

42-
Composite entities are currently just supported by the :ref:``diet-classifier`` and :ref:``CRFEntityExtractor``.
42+
Composite entities are currently just supported by the :ref:`diet-classifier` and :ref:`CRFEntityExtractor`.
4343
- `#5465 <https://github.com/rasahq/rasa/issues/5465>`_: Update training data format for NLU to support entities with a role or group label.
4444

4545
You can now specify synonyms, roles, and groups of entities using the following data format:
@@ -66,7 +66,7 @@ Features
6666
6767
The markdown format ``[LA](location:Los Angeles)`` is deprecated. To update your training data file just
6868
execute the following command on the terminal of your choice:
69-
``sed -i .deprecated -E 's/\[(.*)\]\((.*):(.*)\)/\[\1\]\{"entity": "\2", "value": "\3"\}/g' nlu.md``
69+
``sed -i -E 's/\[([^)]+)\]\(([^)]+):([^)]+)\)/[\1]{"entity": "\2", "value": "\3"}/g' nlu.md``
7070

7171
For more information about the new data format see :ref:`training-data-format`.
7272

changelog/5617.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Don't create TensorBoard log files during prediction.

changelog/5638.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix: DIET breaks with empty spaCy model

changelog/5755.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove ``clean_up_entities`` from extractors that extract pre-defined entities.
2+
Just keep the clean up method for entity extractors that extract custom entities.

changelog/5788.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Don't set roles and groups to ``O`` (nothing found) when constructing entities from model predictions.

changelog/5792.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed issue where the ``DucklingHTTPExtractor`` component would
2+
not work if its `url` contained a trailing slash.

changelog/5794.improvement.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Creating a ``Domain`` using ``Domain.fromDict`` can no longer alter the input dictionary.
2+
Previously, there could be problems when the input dictionary was re-used for other
3+
things after creating the ``Domain`` from it.

docs/core/forms.rst

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,38 @@ to set, you can set more slots than just the one you are validating from inside
191191
a helper validation method. However, you are responsible for making sure that
192192
those extra slot values are valid.
193193

194-
You can also deactivate the form directly during this validation step (in case the
195-
slot is filled with something that you are certain can't be handled) by returning
196-
``self.deactivate()``
194+
In case the slot is filled with something that you are certain can't be handled
195+
and you want to deactivate the form directly,
196+
you can overwrite the ``request_next_slot()`` method to do so. The example below
197+
checks the value of the ``cuisine`` slot directly, but you could use any logic
198+
you'd like to trigger deactivation:
199+
200+
.. code-block:: python
201+
202+
def request_next_slot(
203+
self,
204+
dispatcher: "CollectingDispatcher",
205+
tracker: "Tracker",
206+
domain: Dict[Text, Any],
207+
) -> Optional[List[EventType]]:
208+
"""Request the next slot and utter template if needed,
209+
else return None"""
210+
for slot in self.required_slots(tracker):
211+
if self._should_request_slot(tracker, slot):
212+
213+
## Condition of validated slot that triggers deactivation
214+
if slot == "cuisine" and tracker.get_slot("cuisine") == "caribbean":
215+
dispatcher.utter_message(text="Sorry, I can't help you with that")
216+
return self.deactivate()
217+
218+
## For all other slots, continue as usual
219+
logger.debug(f"Request next slot '{slot}'")
220+
dispatcher.utter_message(
221+
template=f"utter_ask_{slot}", **tracker.slots
222+
)
223+
return [SlotSet(REQUESTED_SLOT, slot)]
224+
return None
225+
197226
198227
If nothing is extracted from the user's utterance for any of the required slots, an
199228
``ActionExecutionRejection`` error will be raised, meaning the action execution

docs/migration-guide.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ General
137137
# ... any other parameters
138138
139139
``CRFEntityExtractor`` featurizes user messages on its own, it does not depend on any featurizer.
140-
We extracted the featurization from the component into the new featurizer :ref:``LexicalSyntacticFeaturizer``. Thus,
140+
We extracted the featurization from the component into the new featurizer :ref:`LexicalSyntacticFeaturizer`. Thus,
141141
in order to obtain the same results as before, you need to add this featurizer to your pipeline before the
142-
:ref:``diet-classifier``.
142+
:ref:`diet-classifier`.
143143
Specifying ``CRFEntityExtractor`` in the configuration maps to the above component definition, the behaviour
144144
is unchanged from previous versions.
145145

docs/nlu/entity-extraction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ The entity object returned by the extractor will include the detected role/group
173173
174174
.. note::
175175

176-
Composite entities are currently only supported by the :ref:``diet-classifier`` and :ref:``CRFEntityExtractor``.
176+
Composite entities are currently only supported by the :ref:`diet-classifier` and :ref:`CRFEntityExtractor`.
177177

178178
In order to properly train your model with entities that have roles/groups, make sure to include enough training data
179179
examples for every combination of entity and role/group label.

0 commit comments

Comments
 (0)