# How to properly use \`unfeaturized\` slot, so that it does not affect core predictions?

**URL:** <https://forum.rasa.com/t/how-to-properly-use-unfeaturized-slot-so-that-it-does-not-affect-core-predictions/11354>\
**Category:** Rasa Open Source\
**Created:** [June 12, 2019, 8:58am UTC](https://forum.rasa.com/t/how-to-properly-use-unfeaturized-slot-so-that-it-does-not-affect-core-predictions/11354 "2019-06-12T08:58:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![psds01](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@psds01](https://forum.rasa.com/u/psds01)\
**Post date:** [June 12, 2019, 8:58am UTC](https://forum.rasa.com/t/how-to-properly-use-unfeaturized-slot-so-that-it-does-not-affect-core-predictions/11354/1 "2019-06-12T08:58:45Z")

</div>

**Usage problem** : I have created a custom NLU component following [this](https://blog.rasa.com/enhancing-rasa-nlu-with-custom-components/). It detects language of the text, adds that language as an extra entity.

1. I have not included this extra entity type under `domain -> entity`.
2. But I have set a slot for this entity type, a slot of type `unfeaturized`.

If I train NLU+core, with `LanguageClassifier` component and `language` slot both disabled, everything works as expected.

But if I enable the `LanguageClassifier` component and `language` slot (type:_unfeaturized_) both, the core breaks up. It doesn’t proceed forward at all. The very first action is predicted as “custom\_fallback” (with `UserUtteranceReverted`). So you can imagine the infinite loop.

My guess is that the `language` slot of type _unfeaturized_ is not working as it should. What do you guys think? How to solve this?

Also, is there a better way to add this new 'language" property of text to message? Something like :

```auto
message.set("language", language, True) 

```

Without affecting predictions by core? What all “message properties” does core use to predict next action?

**Gist of the component class** :

```auto
class LanguageClassifier(Component):
    requires: List = [
        "entities",
    ]
    provides: List = [
        "entities",
    ]
    # Component configurations. These values can be overwritten in the `config` file
    defaults: Dict = {
        "model_params": {
            "kernel": "linear",
        },
    }
    # What language(s) this component can handle. Default - None : handles all languages
    language_list = None
    def __init__ (
            self,
            component_config: Dict[Text, Any] = None):
        super(LanguageClassifier, self). __init__ (component_config)

    def train(...):
        """
        Train this component.
        """
    def process(self, message, **kwargs):
        lang = "en"
        if some_condition:
            text = message.text
            text = text.lower()
            arr = self._featurize_text(text)
            lang = self.clf.predict([arr])[0]
        # I WANT TO DO THIS!!
        # message.set("language", lang, add_to_output=True)
        entity = self.convert_to_rasa(lang, 1.0)
        message.set(
            "entities",
            message.get("entities", []) + [entity],
            add_to_output=True
        )

    @classmethod
    def load(...) -> "LanguageClassifier":
        pass

    def persist(...) -> Optional[Dict[Text, Any]]:
        pass

    def convert_to_rasa(self, value: Text, confidence: float) -> Dict:
        entity = {
            "value": value,
            "confidence": confidence,
            "entity": "language",
            "extractor": "LanguageClassifier",
            "start":0,
            "end":0
        }
        return entity

```

**Command or request that led to error** :

```auto

```

**Content of configuration file (config.yml)** (if relevant):

```auto
# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline:
  - name : WhitespaceTokenizer
  - name : RegexFeaturizer
  - name : CRFEntityExtractor
  - name : EntitySynonymMapper
  - name : CountVectorsFeaturizer
  - name : EmbeddingIntentClassifier
  - name : LanguageClassifier

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
  - name: MemoizationPolicy
    max_history : 10
  - name: KerasPolicy
    max_history : 10
  - name: MappingPolicy
  - name: FallbackPolicy
    fallback_action_name: 'action_default_fallback'
    nlu_threshold: 0.5
    core_threshold: 0.9

```

**Content of domain file (domain.yml)** (if relevant):

```auto
slots:
  language:
    type: unfeaturized
  a:
    type: text
  b:
    type: text

entities:
  - a
  - b

.... usual stuff

```

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [June 18, 2019, 1:50pm UTC](https://forum.rasa.com/t/how-to-properly-use-unfeaturized-slot-so-that-it-does-not-affect-core-predictions/11354/2 "2019-06-18T13:50:05Z")

</div>

what do your stories look like? And can you post the debug log of when this happens (from `rasa shell --debug`)
