[PYTHON] J'ai essayé Mind Meld pour la première fois

Cet article a été publié en tant que jour 10 du calendrier de l'avent Cisco Systems Japan 2019 par nos collègues Ciscos. Cliquez ici pour les calendriers précédents Version 2017: https://qiita.com/advent-calendar/2017/cisco -> Balises de stratégie distribuées avec LISP et essai de TrustSec avec CML / VIRL Édition 2018: https://qiita.com/advent-calendar/2018/cisco -> J'ai essayé d'utiliser l'outil de surveillance / détection de comportement de type SaaS de Cisco pour la surveillance de l'environnement multi-cloud

Cette année, ma troisième année dans l'entreprise (Advent Calendar a également participé pendant trois années consécutives!), J'étudie autour du "machine learning / IA", j'écrirai donc ** MindMeld ** comme un thème correspondant à la technologie Cisco.

Qu'est-ce que Mindmeld?

Mindmeld est une plate-forme d'IA interactive basée sur l'industrie acquise par Cisco en 2017, une boîte à outils pour développeurs publiée en open source en mai 2019. Pour donner une explication un peu plus détaillée, MindMeld utilise le bot MindMeld créé pour refléter ce que les développeurs et les utilisateurs veulent faire (intention), "Je veux faire XX", "Je veux que vous trouviez XX", "△" Il s'agit d'un kit d'outils personnalisable pour répondre aux demandes telles que «Je veux que vous récupériez les informations de △» par le biais d'une conversation avec le bot. L'explication détaillée a été publiée sous ce blog Consultez le référentiel GitHub (https://github.com/cisco/mindmeld/blob/master/README.md).

Que faire dans cet article

Je suis désolé de ne pas avoir d'astuces parce que j'essaie de toucher cet article, mais j'aimerais créer une IA interactive en utilisant le plan ** Video Discovery ** préparé comme un exemple selon le playbook. pense. À l'avenir, j'aimerais l'utiliser comme référence pour créer un plan personnalisé qui m'aidera à trouver l'article que je veux lire. Nous allons commencer par la préparation de l'environnement, donc si vous avez un document japonais, vous êtes intéressé et souhaitez l'essayer, veuillez vous référer à cet article.

Avant de commencer

Comme préparation préliminaire à l'utilisation de MindMeld, nous commencerons par installer MindMeld. Il existe deux modèles d'options d'installation,

  1. Docker
  2. virtualenv Vous pouvez choisir parmi. Pour ceux qui souhaitent utiliser MindMeld à l'avenir, 2. virtualenv est recommandé. Je voudrais faire cet article avec 2. virtualenv.

<détails>

Votre environnement et préparations </ summary>

sw_vers
  ProductName:	Mac OS X
  ProductVersion:	10.15.1
  BuildVersion:	19B88
java -version
  openjdk version "12" 2019-03-19
  OpenJDK Runtime Environment (build 12+33)
  OpenJDK 64-Bit Server VM (build 12+33, mixed mode, sharing)

#Mise à jour Homebrew
brew update

#Installation de virtualenv
#Python a un module qui vous permet de créer un environnement virtuel, et vous pouvez utiliser ce virtualenv pour créer un environnement virtuel.
#Vous pouvez avoir différentes versions de Python pour chaque environnement virtuel.
sudo -H pip install --upgrade virtualenv

# Elasticsearch 6.7 prêt à l'emploi
#En raison des changements dans la politique d'utilisation de Java, les utilisateurs de macOS auront besoin d'un environnement Elasticsearch.
export JAVA_HOME=/path/to/java
curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz -o elasticsearch-6.7.0.tar.gz
tar -zxvf elasticsearch-6.7.0.tar.gz
cd elasticsearch-6.7.0/bin
./elasticsearch

#Confirmation du démarrage d'Elasticsearch
curl localhost:9200
{
  "name" : "hoBpMt3",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "5G91TzSLTDO4WCFg9h5hhg",
  "version" : {
    "number" : "6.7.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "8453f77",
    "build_date" : "2019-03-21T15:32:29.844721Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

#Préparer l'environnement virtuel
mkdir my_mm_workspace4advent
cd my_mm_workspace4advent
virtualenv -p python3 .
source bin/activate
(deactivate)

#Installation du package MindMeld et confirmation du démarrage
pip install mindmeld #Si vous obtenez une erreur ici, veuillez réinstaller le package spécifique à l'origine de l'erreur.
mindmeld #Si cautionWarning s'affiche, vous pouvez l'ignorer.
  Usage: mindmeld [OPTIONS] COMMAND [ARGS]...

    Command line interface for MindMeld.

  Options:
    -V, --version        Show the version and exit.
    -v, --verbosity LVL  Either CRITICAL, ERROR, WARNING, 
  INFO or DEBUG
    -h, --help           Show this message and exit.

  Commands:
    blueprint  Sets up a blueprint application.
    convert    Converts a Rasa or DialogueFlow project to a...
    load-kb    Loads data into a question answerer index.
    num-parse  Starts or stops the local numerical parser...

#Début des analyseurs numériques.
# (Remarque)Si une erreur se produit ici, vous ne pouvez pas continuer. Assurez-vous de réussir avant de continuer.
mindmeld num-parse --start
  ...
  Numerical parser running, PID XXXXX
#Vous pouvez également le vérifier avec la commande suivante.
mindmeld num-parse --start -p 9000

[Supplément] MindMeld utilise un analyseur numérique basé sur un langage de programmation purement fonctionnel appelé Haskell pour afficher des représentations numériques spécifiques (telles que l'heure et la date) dans les requêtes des utilisateurs. Il est détecté. Si aucun port n'est spécifié, il démarrera localement sur le port 7151 par défaut.

mindmeld num-parse --start -Si vous exécutez p 9000, il démarrera sur le port 9000 et sera http://0.0.0.0:Quack lors de l'accès à 9000!S'affiche uniquement.



### Début du plan
 Si vous êtes nouveau dans MindMeld, nous vous recommandons de commencer par essayer l'application Blueprint fournie.
 Les quatre types de plans suivants sont préparés sous forme d'échantillons.
1. Food Ordering (```food_ordering```)
2. Home Assistant (```home_assistaant```)
 3. Video Discovery (`` `video_discovery```) <-Blueprints traités dans cet article
4. Kwik-E-Mart (```kwik_e_mart```)
 L'objectif de ** Video Discovery ** couvert dans cet article est de trouver le film ou l'émission télévisée que je recherche en dialoguant avec MindMeld, comme le montre l'image ci-dessous.
 <img width="590" alt="スクリーンショット 2019-11-26 17.32.46.png " src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/214756/6ebc9852-a3fd-9dba-8cd3-bf0a14676c3f.png ">

```python
#Démarrez Python
python

#Téléchargez et configurez l'application MindMeld Blueprint
import mindmeld as mm
mm.configure_logs()
bp_name = 'video_discovery'
mm.blueprint(bp_name)
#Lorsque la configuration est terminée, le journal suivant s'affiche.
# Created 'video_discovery' knowledge base at 'localhost'
# '/Users/XXX/my_mm_workspace4advent/video_discovery'

[Supplément]

bp_name = 'video_discovery'Évitez les files d'attente et directement mm.blueprint('video_discovery')Vous pouvez également le faire comme.


 Lorsque le dossier de projet MindMeld (`` video_discovery '') est créé, un répertoire sera créé comme indiqué dans l'image ci-dessous.
 <img width="554" alt="スクリーンショット 2019-11-26 17.50.59.png " src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/214756/7193a949-1cbc-f24b-ce05-6dcb2ff32d16.png ">

### Essai de fonctionnement ①
```python
#Importation et configuration de l'application QuestionAnswerer
from mindmeld.components.question_answerer import QuestionAnswerer
qa = QuestionAnswerer(app_path='video_discovery')

#Recherchez "Movie Minions" dans les entrées de la base de connaissances
qa.get(index='videos', title='Minions')[0]

[Supplément] Le résultat du test est le suivant.

{'overview': 'Minions Stuart, Kevin and Bob are recruited by Scarlet Overkill, a super-villain who, alongside her inventor husband Herb, hatches a plot to take over the world.', 'imdb_id': 'tt2293640', 'directors': ['Kyle Balda', 'Pierre Coffin'], 'release_year': 2015, 'runtime': 91, 'doc_type': 'movie', 'countries': ['US'], 'title': 'Minions', 'cast': ['Sandra Bullock', 'Jon Hamm', 'Michael Keaton', 'Allison Janney', 'Steve Coogan', 'Jennifer Saunders', 'Geoffrey Rush', 'Steve Carell', 'Pierre Coffin', 'Katy Mixon', 'Michael Beattie', 'Hiroyuki Sanada', 'Dave Rosenbaum', 'Alex Dowding', 'Paul Thornley', 'Kyle Balda', 'Ava Acres'], 'img_url': 'http://image.tmdb.org/t/p/w185//q0R4crx2SehcEEQEkYObktdeFy.jpg', 'release_date': '2015-06-17', 'genres': ['Family', 'Animation', 'Adventure', 'Comedy'], 'vote_average': 6.4, 'popularity': 2.295467321653707, 'id': 'movie_211672', 'vote_count': 3660}

Cette application ** Video Discovery ** fait référence à un site Web appelé The Movie DB en tant que base de connaissances.

Formation sur le système PNL de base de l'application MindMeld Blueprint

Former le système NLP (classe `` NaturalLanguageProcessor '') en se nourrissant de données étiquetées.

# (option)Modifier le niveau de journal
import logging
logging.getLogger('mindmeld').setLevel(logging.INFO)

#Effectuer une formation pour le système PNL de base
from mindmeld import configure_logs; configure_logs()
from mindmeld.components.nlp import NaturalLanguageProcessor
nlp = NaturalLanguageProcessor(app_path='video_discovery')
nlp.build()

[Supplément] En modifiant le niveau de journal, vous pouvez voir le processus d'apprentissage automatique comme suit.

<détails>

nlp.build () `` journal des erreurs </ résumé>

Fitting domain classifier
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/unrelated/compliment/train.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/unrelated/general/train.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/unrelated/insult/train.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/browse/train_00.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/browse/train_01.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/browse/train_02.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/browse/train_03.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/browse/train_04.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/browse/train_05.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/browse/train_mturk_00.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/browse/train_range_00.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/exit/train.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/greet/train.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/help/train.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/start_over/train.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/unsupported/train_get_channel_00.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/unsupported/train_get_channel_01.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/unsupported/train_get_channel_02.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/unsupported/train_get_time_00.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/unsupported/train_get_time_01.txt
Loading raw queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/video_content/unsupported/train_get_time_02.txt
Loading queries from file /Users/yunambu/my_mm_workspace4advent/video_discovery/domains/unrelated/compliment/train.txt
Unable to connect to the system entity recognizer. Make sure it's running by typing 'mindmeld num-parse' at the command line.

Une erreur a été générée. .. .. Comme on m'a dit, lorsque je vérifie avec mindmeld num-parse '', Num-parse '' semble fonctionner correctement.

mindmeld num-parse
  ...
  Numerical parser running, PID 94958

Voyons d'abord ce qu'est cette `` entité système ''. Ensuite, il y avait une telle description dans le document.

""" Entities in MindMeld are categorized into two types:

System Entities Generic entities that are application-agnostic and are automatically detected by MindMeld. Examples include numbers, time expressions, email addresses, URLs and measured quantities like distance, volume, currency and temperature.

Custom Entities ...

System entities are generic application-agnostic entities that all MindMeld applications detect automatically. There is no need to train models to learn system entities; they just work. ... MindMeld does not assume that any of the system entities are needed in your app. It is the system entities that you annotate in your training data that MindMeld knows are needed. """

En bref, il s'agit d'une entité à usage général (valeur numérique, représentation temporelle, adresse e-mail, URL, mesure de distance, volume, devise, température, etc.) qui est utilisée de la même manière pour toutes les applications fournies par MindMeld, et qui y est connectée. Je reçois un message d'erreur indiquant que ce n'est pas fait. J'ai pensé qu'il pourrait y avoir un problème avec le nlp.py``` que j'essaie d'utiliser ici, alors j'ai jeté un coup d'œil au code source comme suit.

<détails>

Vérifier nlp.py``` </ summary>

nlp.py


#Extrait uniquement des parties susceptibles d'être applicables
# system_entity_module de reconnaissance(nlp.Module parent de py)Importer la classe SystemEntityRecongnizer à partir de
from ..system_entity_recognizer import SystemEntityRecognizer

"""
Pour plus de détails, voir le système_entity_recongizer.Il est commenté dans py.
Ce SystemEntityRecognizer est singleton(Autrement dit, assurez-vous qu'il existe toujours une instance de cette classe.)Il est censé être utilisé comme.
Par conséquent, il est conçu de manière à ne être initialisé qu'une seule fois lors de la construction de l'objet NLP.
Le travail pour l'initialiser est dans la ligne suivante.
"""
# initialize the system entity recognizer singleton
SystemEntityRecognizer.get_instance(app_path)
Confirmation de `` `` system_entity_recognizer.py```

system_entity_recognizer.py


#Extrait uniquement des parties susceptibles d'être applicables
# nlp.Création de classes pour les services d'analyse externe utilisés par d'autres applications telles que py.
class SystemEntityRecognizer:
    """SystemEntityRecognizer is the external parsing service used to extract
    system entities. It is intended to be used as a singleton, so it's
    initialized only once during NLP object construction.

    TODO: Abstract this class into an interface and implement the duckling
    service as one such service.
    """

    _instance = None #Une chose magique qui sort toujours lors de l'utilisation de Singleton

    def __init__(self, app_path=None): 
     #Méthode spéciale d'initialisation de l'instance appelée lors de la création de l'instance__init__Définition de. app_path a None comme variable par défaut
        #Il dit que ce constructeur est dédié à SystemEntityReconizer. Notez que assurez-vous d'utiliser gettter lors de l'utilisation
        """Private constructor for SystemEntityRecognizer. Do not directly
        construct the SystemEntityRecognizer object. Instead, use the
        static get_instance method.

        Args:
            app_path (str): A application path
        """
        if SystemEntityRecognizer._instance:
            raise Exception("SystemEntityRecognizer is a singleton") #Utilisez l'instruction rise pour lever une exception dans cette condition
        else: #L'API Duckling suivante(Duckling =Analyse de texte en langage naturel open source)Il semble que la date / heure et les valeurs mesurées proviennent des informations dans le langage naturel en utilisant.
            if not app_path:
                # The service is turned on by default
                self._use_duckling_api = True
            else:
                self._use_duckling_api = is_duckling_configured(app_path)

        self.app_path = app_path
        SystemEntityRecognizer._instance = self

    @staticmethod #Utilisé comme méthode de classe
    def get_instance(app_path=None):
        """ Static access method.

        Args:
            app_path (str): A application path

        Returns:
            (SystemEntityRecognizer): A SystemEntityRecognizer instance
        """
        if not SystemEntityRecognizer._instance:
            SystemEntityRecognizer(app_path)
        return SystemEntityRecognizer._instance

    def get_response(self, data):

        if not self._use_duckling_api:
            return [], NO_RESPONSE_CODE

        url = get_system_entity_url_config(app_path=self.app_path)

        try: #Décrivez le processus à forcer même lorsqu'une exception se produit
            response = requests.request('POST', url, data=data, timeout=1)

            if response.status_code == requests.codes['ok']:
                response_json = response.json()

                # Remove the redundant 'values' key in the response['value'] dictionary
                for i, entity_dict in enumerate(response_json):
                    if 'values' in entity_dict['value']:
                        del response_json[i]['value']['values']

                return response_json, response.status_code
            else:
                raise SystemEntityError('System entity status code is not 200.')
        except requests.ConnectionError: #Décrire le traitement lorsqu'une exception se produit
            sys.exit("Unable to connect to the system entity recognizer. Make sure it's "
                     "running by typing 'mindmeld num-parse' at the command line.") #Terminer le processus principal dans le programme en cours
        except Exception as ex:  # pylint: disable=broad-except
            logger.error('Numerical Entity Recognizer Error: %s\nURL: %r\nData: %s', ex, url,
                         json.dumps(data))
            sys.exit('\nThe system entity recognizer encountered the following ' +
                     'error:\n' + str(ex) + '\nURL: ' + url + '\nRaw data: ' + str(data) +
                     "\nPlease check your data and ensure Numerical parsing service is running. "
                     "Make sure it's running by typing "
                     "'mindmeld num-parse' at the command line.")

Autant que je puisse voir, il semble que le traitement au moment de l'exception de la dernière instruction try-except '' de system_entity_recognizer.py '' '' fonctionne, et finalement Service d'analyse '' ne peut pas être atteint. Alors, abandonnez ce que vous faites avec `` virtualenv '' et recommencez à utiliser le conteneur Docker.

  • Étant donné que la cause n'a pas pu être identifiée par la date de publication, je souhaite l'ajouter dès que le dépannage est terminé.

Créer un environnement Docker

Re-préparation dans l'environnement Docker
#Vérification de la version de Docker
docker version
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:22:34 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea
  Built:            Wed Nov 13 07:29:19 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

#Obtenez la dernière image de MindMeld à partir du registre
docker pull mindmeldworkbench/dep:latest
#Conteneur neuf, 9200/7151/0 pour chaque port de conteneurs de 9300.0.0.9200 sur 0/7151/Liez au port 9300 et exécutez en arrière-plan.
docker run -p 0.0.0.0:9200:9200 -p 0.0.0.0:7151:7151 -p 0.0.0.0:9300:9300 mindmeldworkbench/dep -ti -d

#Préparation et démarrage d'un environnement virtuel
mkdir my_mm_workspace4advent2
cd my_mm_workspace4advent2
virtualenv -p python3 .
source bin/activate

#Installez et lancez le package MindMeld
pip install mindmeld
mindmeld

#Télécharger MindMeld Blueprint
mindmeld blueprint video_discovery #Vous pouvez également l'exécuter à partir d'un terminal au lieu de Python Shell

Essai de fonctionnement ②

#Importation et configuration de l'application QuestionAnswerer
from mindmeld.components.question_answerer import QuestionAnswerer
qa = QuestionAnswerer(app_path='video_discovery')

#Recherchez "Movie Minions" dans les entrées de la base de connaissances
qa.get(index='videos', title='Minions')[0]

[Supplément] Le résultat du test est le suivant.

{'overview': 'Minions Stuart, Kevin and Bob are recruited by Scarlet Overkill, a super-villain who, alongside her inventor husband Herb, hatches a plot to take over the world.', 'imdb_id': 'tt2293640', 'directors': ['Kyle Balda', 'Pierre Coffin'], 'release_year': 2015, 'runtime': 91, 'doc_type': 'movie', 'countries': ['US'], 'title': 'Minions', 'cast': ['Sandra Bullock', 'Jon Hamm', 'Michael Keaton', 'Allison Janney', 'Steve Coogan', 'Jennifer Saunders', 'Geoffrey Rush', 'Steve Carell', 'Pierre Coffin', 'Katy Mixon', 'Michael Beattie', 'Hiroyuki Sanada', 'Dave Rosenbaum', 'Alex Dowding', 'Paul Thornley', 'Kyle Balda', 'Ava Acres'], 'img_url': 'http://image.tmdb.org/t/p/w185//q0R4crx2SehcEEQEkYObktdeFy.jpg', 'release_date': '2015-06-17', 'genres': ['Family', 'Animation', 'Adventure', 'Comedy'], 'vote_average': 6.4, 'popularity': 2.295467321653707, 'id': 'movie_211672', 'vote_count': 3660}

Nouvelle tentative de formation du système PNL

# (option)Modifier le niveau de journal
import logging
logging.getLogger('mindmeld').setLevel(logging.DEBUG) #Changeons-le en DEBUG et jetons un œil au journal détaillé.

#Effectuer une formation pour le système PNL de base
from mindmeld import configure_logs; configure_logs()
from mindmeld.components.nlp import NaturalLanguageProcessor
nlp = NaturalLanguageProcessor(app_path='video_discovery')
nlp.build()
`` `` nlp.build () `` journal détaillé
Fitting domain classifier
Loading raw queries from file video_discovery/domains/unrelated/compliment/train.txt
Loading raw queries from file video_discovery/domains/unrelated/general/train.txt
Loading raw queries from file video_discovery/domains/unrelated/insult/train.txt
Loading raw queries from file video_discovery/domains/video_content/browse/train_00.txt
Loading raw queries from file video_discovery/domains/video_content/browse/train_01.txt
Loading raw queries from file video_discovery/domains/video_content/browse/train_02.txt
Loading raw queries from file video_discovery/domains/video_content/browse/train_03.txt
Loading raw queries from file video_discovery/domains/video_content/browse/train_04.txt
Loading raw queries from file video_discovery/domains/video_content/browse/train_05.txt
Loading raw queries from file video_discovery/domains/video_content/browse/train_mturk_00.txt
Loading raw queries from file video_discovery/domains/video_content/browse/train_range_00.txt
Loading raw queries from file video_discovery/domains/video_content/exit/train.txt
Loading raw queries from file video_discovery/domains/video_content/greet/train.txt
Loading raw queries from file video_discovery/domains/video_content/help/train.txt
Loading raw queries from file video_discovery/domains/video_content/start_over/train.txt
Loading raw queries from file video_discovery/domains/video_content/unsupported/train_get_channel_00.txt
Loading raw queries from file video_discovery/domains/video_content/unsupported/train_get_channel_01.txt
Loading raw queries from file video_discovery/domains/video_content/unsupported/train_get_channel_02.txt
Loading raw queries from file video_discovery/domains/video_content/unsupported/train_get_time_00.txt
Loading raw queries from file video_discovery/domains/video_content/unsupported/train_get_time_01.txt
Loading raw queries from file video_discovery/domains/video_content/unsupported/train_get_time_02.txt
Loading queries from file video_discovery/domains/unrelated/compliment/train.txt
Loading queries from file video_discovery/domains/unrelated/general/train.txt
Loading queries from file video_discovery/domains/unrelated/insult/train.txt
Loading queries from file video_discovery/domains/video_content/browse/train_00.txt
Loading queries from file video_discovery/domains/video_content/browse/train_01.txt
Loading queries from file video_discovery/domains/video_content/browse/train_02.txt
Loading queries from file video_discovery/domains/video_content/browse/train_03.txt
Loading queries from file video_discovery/domains/video_content/browse/train_04.txt
Loading queries from file video_discovery/domains/video_content/browse/train_05.txt
Loading queries from file video_discovery/domains/video_content/browse/train_mturk_00.txt
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for "80's".
Unable to load query: Unable to resolve system entity of type 'sys_interval' for "1990's".
Unable to load query: Unable to resolve system entity of type 'sys_interval' for "1990's".
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1980s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for 'all time'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '70s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for "80's".
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1980s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for "90's".
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for 'all time'.
Unable to load query: Unable to resolve system entity of type 'sys_time' for 'the year'.
Unable to load query: Unable to resolve system entity of type 'sys_time' for 'this moment'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for "90's".
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '2010-2015'. Entities found for the following types ['sys_temperature', 'sys_amount-of-money', 'sys_phone-number']
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1980s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1980s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '2000s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for "90's".
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '2000 to now'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '2000s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for 'last year'. Entities found for the following types ['sys_time']
Unable to load query: Unable to resolve system entity of type 'sys_interval' for "40's".
Unable to load query: Unable to resolve system entity of type 'sys_interval' for 'last decade'.
Unable to load query: Unable to resolve system entity of type 'sys_time' for 'this summer'. Entities found for the following types ['sys_interval']
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1950s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '2000s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1960s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Loading queries from file video_discovery/domains/video_content/browse/train_range_00.txt
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '2000 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1970s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1900s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1970s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1970 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1970s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1990 to 1995'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '60s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for 'eighties'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '70s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1980s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for 'last year'. Entities found for the following types ['sys_time']
Unable to load query: Unable to resolve system entity of type 'sys_interval' for 'last year'. Entities found for the following types ['sys_time']
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1960s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for 'late 1990 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for 'past year'. Entities found for the following types ['sys_time']
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '2000s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '60s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '2010s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1980s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90 s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '80s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '90s'.
Unable to load query: Unable to resolve system entity of type 'sys_interval' for '1950s'.
Loading queries from file video_discovery/domains/video_content/exit/train.txt
Loading queries from file video_discovery/domains/video_content/greet/train.txt
Loading queries from file video_discovery/domains/video_content/help/train.txt
Loading queries from file video_discovery/domains/video_content/start_over/train.txt
Loading queries from file video_discovery/domains/video_content/unsupported/train_get_channel_00.txt
Loading queries from file video_discovery/domains/video_content/unsupported/train_get_channel_01.txt
Loading queries from file video_discovery/domains/video_content/unsupported/train_get_channel_02.txt
Loading queries from file video_discovery/domains/video_content/unsupported/train_get_time_00.txt
Loading queries from file video_discovery/domains/video_content/unsupported/train_get_time_01.txt
Loading queries from file video_discovery/domains/video_content/unsupported/train_get_time_02.txt
Building gazetteer 'sort'
Loading entity data from 'video_discovery/entities/sort/gazetteer.txt'
52/52 entities in entity data file exceeded popularity cutoff and were added to the gazetteer
Loading synonyms from entity mapping
Added 49/49 synonyms from file into gazetteer
Building gazetteer 'director'
Loading entity data from 'video_discovery/entities/director/gazetteer.txt'
89750/89750 entities in entity data file exceeded popularity cutoff and were added to the gazetteer
Loading synonyms from entity mapping
Added 0/0 synonyms from file into gazetteer
Building gazetteer 'title'
Loading entity data from 'video_discovery/entities/title/gazetteer.txt'
276728/276728 entities in entity data file exceeded popularity cutoff and were added to the gazetteer
Loading synonyms from entity mapping
Added 0/0 synonyms from file into gazetteer
Building gazetteer 'cast'
Loading entity data from 'video_discovery/entities/cast/gazetteer.txt'
486719/486719 entities in entity data file exceeded popularity cutoff and were added to the gazetteer
Loading synonyms from entity mapping
Added 0/0 synonyms from file into gazetteer
Building gazetteer 'genre'
Loading entity data from 'video_discovery/entities/genre/gazetteer.txt'
101/101 entities in entity data file exceeded popularity cutoff and were added to the gazetteer
Loading synonyms from entity mapping
Added 70/70 synonyms from file into gazetteer
Building gazetteer 'type'
Loading entity data from 'video_discovery/entities/type/gazetteer.txt'
18/18 entities in entity data file exceeded popularity cutoff and were added to the gazetteer
Loading synonyms from entity mapping
Added 20/20 synonyms from file into gazetteer
Building gazetteer 'country'
Loading entity data from 'video_discovery/entities/country/gazetteer.txt'
477/477 entities in entity data file exceeded popularity cutoff and were added to the gazetteer
Loading synonyms from entity mapping
Added 243/243 synonyms from file into gazetteer
Fitting intent classifier: domain='video_content'
Selecting hyperparameters using k-fold cross-validation with 5 splits
Best accuracy: 98.12%, params: {'C': 10, 'class_weight': {0: 0.5805006811989102, 1: 3.431368821292776, 2: 0.9903185247275775, 3: 5.1444117647058825, 4: 2.906170886075949, 5: 0.6776020174232005}, 'fit_intercept': True}
Fitting entity recognizer: domain='video_content', intent='browse'
No entity_resolution model configuration set. Using default.
No entity_resolution model configuration set. Using default.
No entity_resolution model configuration set. Using default.
No entity_resolution model configuration set. Using default.
No entity_resolution model configuration set. Using default.
No entity_resolution model configuration set. Using default.
No entity_resolution model configuration set. Using default.
No entity_resolution model configuration set. Using default.
No entity_resolution model configuration set. Using default.
Fitting role classifier: domain='video_content', intent='browse', entity_type='type'
No role model configuration set. Using default.
Importing synonym data to synonym index 'synonym_type'
Creating index 'synonym_type'
100%|████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 23.57it/s]
Loaded 2 documents
Fitting role classifier: domain='video_content', intent='browse', entity_type='country'
No role model configuration set. Using default.
Importing synonym data to synonym index 'synonym_country'
Creating index 'synonym_country'
100%|███████████████████████████████████████████████████████████████████████████| 235/235 [00:00<00:00, 555.92it/s]
Loaded 235 documents
Fitting role classifier: domain='video_content', intent='browse', entity_type='sys_interval'
No role model configuration set. Using default.
Fitting role classifier: domain='video_content', intent='browse', entity_type='cast'
No role model configuration set. Using default.
Importing synonym data to synonym index 'synonym_cast'
Creating index 'synonym_cast'
0it [00:00, ?it/s]
Loaded 0 documents
Fitting role classifier: domain='video_content', intent='browse', entity_type='genre'
No role model configuration set. Using default.
Importing synonym data to synonym index 'synonym_genre'
Creating index 'synonym_genre'
100%|█████████████████████████████████████████████████████████████████████████████| 31/31 [00:00<00:00, 270.29it/s]
Loaded 31 documents
Fitting role classifier: domain='video_content', intent='browse', entity_type='sort'
No role model configuration set. Using default.
Importing synonym data to synonym index 'synonym_sort'
Creating index 'synonym_sort'
100%|████████████████████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 43.20it/s]
Loaded 4 documents
Fitting role classifier: domain='video_content', intent='browse', entity_type='sys_time'
No role model configuration set. Using default.
Fitting role classifier: domain='video_content', intent='browse', entity_type='director'
No role model configuration set. Using default.
Importing synonym data to synonym index 'synonym_director'
Creating index 'synonym_director'
0it [00:00, ?it/s]
Loaded 0 documents
Fitting role classifier: domain='video_content', intent='browse', entity_type='title'
No role model configuration set. Using default.
Importing synonym data to synonym index 'synonym_title'
Creating index 'synonym_title'
0it [00:00, ?it/s]
Loaded 0 documents
Fitting entity recognizer: domain='video_content', intent='greet'
There are no labels in this label set, so we don't fit the model.
Fitting entity recognizer: domain='video_content', intent='help'
There are no labels in this label set, so we don't fit the model.
Fitting entity recognizer: domain='video_content', intent='start_over'
There are no labels in this label set, so we don't fit the model.
Fitting entity recognizer: domain='video_content', intent='exit'
There are no labels in this label set, so we don't fit the model.
Fitting entity recognizer: domain='video_content', intent='unsupported'
There are no labels in this label set, so we don't fit the model.
Fitting intent classifier: domain='unrelated'
Selecting hyperparameters using k-fold cross-validation with 5 splits
Best accuracy: 70.87%, params: {'C': 1, 'class_weight': {0: 0.9618644067796609, 1: 1.009, 2: 1.0395604395604394}, 'fit_intercept': True}
Fitting entity recognizer: domain='unrelated', intent='insult'
There are no labels in this label set, so we don't fit the model.
Fitting entity recognizer: domain='unrelated', intent='general'
There are no labels in this label set, so we don't fit the model.
Fitting entity recognizer: domain='unrelated', intent='compliment'
There are no labels in this label set, so we don't fit the model.

Pour le moment, l'erreur peut être évitée, Meilleure précision: 70,87%, paramètres: {'C': 1, 'class_weight': {0: 0.9618644067796609, 1: 1.009, 2: 1.0395604395604394}, 'fit_intercept': True} J'ai reçu le résultat ».

Unable to load query: Unable to resolve system entity of type 'sys_interval'、Unable to load query: Unable to resolve system entity of type 'sys_time'J'avais peur qu'il y ait un journal disant cela, mais je l'ajouterai dès que je le comprendrai parce que la cause ne pouvait pas être étudiée à la date d'affichage.


 En outre, à ce stade, il n'y a `` Aucun jeu de configuration de modèle entity_resolution. En utilisant default.``, et la précision est aussi faible que moins de 70%, mais dans le test, après cela, la méthode d'extraction de caractéristiques sera décrite. Nous améliorerons la précision en sélectionnant et en ajustant.


### Essai de fonctionnement ③
```python
#Lancer une requête de test sur un système NLP formé
nlp.process("Show me movies with Yo Oizumi")
{'text': 'Show me movies with Yo Oizumi', 'domain': 'video_content', 'intent': 'browse', 'entities': [{'text': 'movies', 'type': 'type', 'role': None, 'value': [{'cname': 'movie', 'score': 19.448803, 'top_synonym': 'movies'}, {'cname': 'tv-show', 'score': 1.684855, 'top_synonym': 'series'}], 'span': {'start': 8, 'end': 13}}, {'text': 'Yo Oizumi', 'type': 'cast', 'role': None, 'value': [], 'span': {'start': 20, 'end': 28}}]}
#Créer un classificateur d'intention. Utilisez-le pour accéder aux paramètres d'extraction de modèle et de fonction
>>> ic = nlp.domains['video_content'].intent_classifier
>>> ic.config.model_settings['classifier_type']
'logreg'

>>> ic.config.features
{'bag-of-words': {'lengths': [1, 2]}, 'edge-ngrams': {'lengths': [1, 2]}, 'in-gaz': {}, 'exact': {'scaling': 10}, 'gaz-freq': {}, 'freq': {'bins': 5}}

#Ce classificateur convient()En passant les paramètres appropriés à l'aide de méthodes, vous pouvez essayer divers algorithmes d'apprentissage, fonctions, hyperparamètres, paramètres de vérification mutuelle, etc.
#Par exemple, par défaut, bag-of-les mots sont utilisés dans l'extraction de caractéristiques, mais sac-of-N-Vous pouvez également ajouter et utiliser des grammes.
#J'utilise un exemple de plan ici, il est donc déjà inclus.
>>> ic.config.features['bag-of-words']['lengths'].append(3)
>>> ic.fit() # fit(learan_data, learn_label)Les données de formation et les résultats peuvent être formés à l'aide de méthodes
Fitting intent classifier: domain='video_content'
Selecting hyperparameters using k-fold cross-validation with 5 splits
Best accuracy: 98.12%, params: {'C': 10, 'class_weight': {0: 0.8202145776566757, 1: 2.0420152091254753, 2: 0.9958507963118188, 3: 2.7761764705882355, 4: 1.8169303797468355, 5: 0.8618294360385144}, 'fit_intercept': True}

Déploiement

Une fois que vous avez terminé toutes les étapes jusqu'à présent, utilisez la classe `` Conversation '' pour tester votre application interactive.

from mindmeld.components.dialogue import Conversation
conv = Conversation(nlp=nlp, app_path='video_discovery')
res = conv.say("Show me movies with Yo Oizumi")
print(res[1])

<détails>

Résultats </ summary>

{
    "popularity": 1.6843605812038211,
    "release_year": 2001,
    "title": "Spirited Away",
    "type": "movie"
}
{
    "popularity": 1.331518694517026,
    "release_year": 2004,
    "title": "Howl's Moving Castle",
    "type": "movie"
}
{
    "popularity": 0.9276412700980977,
    "release_year": 2014,
    "title": "When Marnie Was There",
    "type": "movie"
}
{
    "popularity": 0.5483075183578056,
    "release_year": 2002,
    "title": "The Cat Returns",
    "type": "movie"
}
{
    "popularity": 0.48987671974559993,
    "release_year": 2015,
    "title": "I Am a Hero",
    "type": "movie"
}
{
    "popularity": 0.40345108131710566,
    "release_year": 2015,
    "title": "The Boy and the Beast",
    "type": "movie"
}
{
    "popularity": 0.21568218441881915,
    "release_year": 2006,
    "title": "Brave Story",
    "type": "movie"
}
{
    "popularity": 0.14845276320241113,
    "release_year": 2015,
    "title": "Kakekomi",
    "type": "movie"
}
{
    "popularity": 0.12538694143866852,
    "release_year": 2009,
    "title": "Professor Layton and the Eternal Diva",
    "type": "movie"
}
{
    "popularity": 0.0982032635261464,
    "release_year": 2007,
    "title": "Kitaro",
    "type": "movie"
}

Simulation de dialogue

say()La méthode regroupe le texte d'entrée dans un objet de requête utilisateur et le transmet au gestionnaire d'application mindmeld pour simuler l'interaction de l'utilisateur avec l'application. Cette méthode génère la partie du texte de réponse envoyée par le gestionnaire de dialogue.

>>> conv.say('Hi, there!')
['Hi!', 'Talk to me to browse movies and TV shows.', '{\n    "popularity": 4.904354681204688,\n    "release_year": 2017,\n    "title": "Wonder Woman",\n    "type": "movie"\n}\n{\n    "popularity": 4.743179401930947,\n    "release_year": 2017,\n    "title": "Beauty and the Beast",\n    "type": "movie"\n}\n{\n    "popularity": 4.390633761852561,\n    "release_year": 2017,\n    "title": "Transformers: The Last Knight",\n    "type": "movie"\n}\n{\n    "popularity": 4.316296603970634,\n    "release_year": 2017,\n    "title": "Logan",\n    "type": "movie"\n}\n{\n    "popularity": 4.088732678349925,\n    "release_year": 2017,\n    "title": "The Mummy",\n    "type": "movie"\n}\n{\n    "popularity": 3.9604223694356175,\n    "release_year": 2017,\n    "title": "Kong: Skull Island",\n    "type": "movie"\n}\n{\n    "popularity": 3.920513974901613,\n    "release_year": 2005,\n    "title": "Doctor Who",\n    "type": "tv-show"\n}\n{\n    "popularity": 3.8653508696521426,\n    "release_year": 2011,\n    "title": "Game of Thrones",\n    "type": "tv-show"\n}\n{\n    "popularity": 3.7942142869419615,\n    "release_year": 2010,\n    "title": "The Walking Dead",\n    "type": "tv-show"\n}\n{\n    "popularity": 3.575316921466775,\n    "release_year": 2017,\n    "title": "Pirates of the Caribbean: Dead Men Tell No Tales",\n    "type": "movie"\n}', "Suggestions: 'Most popular', 'Most recent', 'Movies', 'TV Shows', 'Action', 'Dramas', 'Sci-Fi'"]
>>> 
>>> conv.say('Show me Yo Oizumi movies')
['Ok. Here are some results:', '{\n    "popularity": 1.6843605812038211,\n    "release_year": 2001,\n    "title": "Spirited Away",\n    "type": "movie"\n}\n{\n    "popularity": 1.331518694517026,\n    "release_year": 2004,\n    "title": "Howl\'s Moving Castle",\n    "type": "movie"\n}\n{\n    "popularity": 0.9276412700980977,\n    "release_year": 2014,\n    "title": "When Marnie Was There",\n    "type": "movie"\n}\n{\n    "popularity": 0.5483075183578056,\n    "release_year": 2002,\n    "title": "The Cat Returns",\n    "type": "movie"\n}\n{\n    "popularity": 0.48987671974559993,\n    "release_year": 2015,\n    "title": "I Am a Hero",\n    "type": "movie"\n}\n{\n    "popularity": 0.40345108131710566,\n    "release_year": 2015,\n    "title": "The Boy and the Beast",\n    "type": "movie"\n}\n{\n    "popularity": 0.21568218441881915,\n    "release_year": 2006,\n    "title": "Brave Story",\n    "type": "movie"\n}\n{\n    "popularity": 0.14845276320241113,\n    "release_year": 2015,\n    "title": "Kakekomi",\n    "type": "movie"\n}\n{\n    "popularity": 0.12538694143866852,\n    "release_year": 2009,\n    "title": "Professor Layton and the Eternal Diva",\n    "type": "movie"\n}\n{\n    "popularity": 0.0982032635261464,\n    "release_year": 2007,\n    "title": "Kitaro",\n    "type": "movie"\n}']
>>> 
>>> conv.say('from 2015')
['Perfect. Here are some movies with Yo Oizumi:', '{\n    "popularity": 0.48987671974559993,\n    "release_year": 2015,\n    "title": "I Am a Hero",\n    "type": "movie"\n}\n{\n    "popularity": 0.40345108131710566,\n    "release_year": 2015,\n    "title": "The Boy and the Beast",\n    "type": "movie"\n}\n{\n    "popularity": 0.14845276320241113,\n    "release_year": 2015,\n    "title": "Kakekomi",\n    "type": "movie"\n}']
>>>
>>> conv.say('Thank you')
['See you later.']
>>>
>>> conv.say('do you have comedy movies?')
['Perfect. Here are some results:', '{\n    "popularity": 3.575316921466775,\n    "release_year": 2017,\n    "title": "Pirates of the Caribbean: Dead Men Tell No Tales",\n    "type": "movie"\n}\n{\n    "popularity": 3.16142885645921,\n    "release_year": 2017,\n    "title": "Guardians of the Galaxy Vol. 2",\n    "type": "movie"\n}\n{\n    "popularity": 2.864445217663442,\n    "release_year": 2017,\n    "title": "Despicable Me 3",\n    "type": "movie"\n}\n{\n    "popularity": 2.8304034588472593,\n    "release_year": 2017,\n    "title": "Cars 3",\n    "type": "movie"\n}\n{\n    "popularity": 2.824917558393832,\n    "release_year": 2017,\n    "title": "Baywatch",\n    "type": "movie"\n}\n{\n    "popularity": 2.7538905585490667,\n    "release_year": 2016,\n    "title": "Deadpool",\n    "type": "movie"\n}\n{\n    "popularity": 2.6281775734086983,\n    "release_year": 2016,\n    "title": "Tomorrow Everything Starts",\n    "type": "movie"\n}\n{\n    "popularity": 2.561422298541789,\n    "release_year": 2017,\n    "title": "The Lego Batman Movie",\n    "type": "movie"\n}\n{\n    "popularity": 2.4652902501503737,\n    "release_year": 2000,\n    "title": "DragonHeart: A New Beginning",\n    "type": "movie"\n}\n{\n    "popularity": 2.4633532858463862,\n    "release_year": 2017,\n    "title": "Smurfs: The Lost Village",\n    "type": "movie"\n}']
>>> 
>>> conv.say('show me the ones with Yo Oizumi')
['Ok. Here are some comedy movies:', '{\n    "popularity": 0.14845276320241113,\n    "release_year": 2015,\n    "title": "Kakekomi",\n    "type": "movie"\n}\n{\n    "popularity": 0.08592812381604169,\n    "release_year": 2013,\n    "title": "Detective in the Bar",\n    "type": "movie"\n}\n{\n    "popularity": 0.058488695289761736,\n    "release_year": 2013,\n    "title": "The Kiyosu Conference",\n    "type": "movie"\n}\n{\n    "popularity": 0.015350574738277112,\n    "release_year": 2016,\n    "title": "Gold Medal Man",\n    "type": "movie"\n}\n{\n    "popularity": 0.015203833742272778,\n    "release_year": 2011,\n    "title": "Drucker in the Dug-Out",\n    "type": "movie"\n}\n{\n    "popularity": 0.01330410659551587,\n    "release_year": 2012,\n    "title": "Bread of Happiness",\n    "type": "movie"\n}\n{\n    "popularity": 0.011187189390564376,\n    "release_year": 2006,\n    "title": "Sugar & Spice: F\\u00fbmi zekka",\n    "type": "movie"\n}\n{\n    "popularity": 0.006566393969770445,\n    "release_year": 2014,\n    "title": "A Drop of the Grapevine",\n    "type": "movie"\n}\n{\n    "popularity": 0.0005218638053935734,\n    "release_year": 2006,\n    "title": "Simsons",\n    "type": "movie"\n}']
>>> 
>>> conv.say('Released in 2012')
['Done. Here are some comedy movies starring Yo Oizumi:', '{\n    "popularity": 0.01330410659551587,\n    "release_year": 2012,\n    "title": "Bread of Happiness",\n    "type": "movie"\n}']
>>> conv.say('Thank you')
['Bye!']

J'ai pu le faire pour le moment!

Donc, pour le moment, j'ai pu essayer toutes les bases. Je pense que la bonne chose à propos de MindMeld est qu'il peut être personnalisé, donc j'aimerais essayer de créer des applications personnalisées (plan Article_Discovery), la localisation japonaise, l'intégration de Chat Bot, etc. à l'avenir.

Avertissement

Les opinions exprimées sur ce site et les commentaires correspondants sont les opinions personnelles de l'affiche et non les opinions de Cisco. Le contenu de ce site est fourni à titre informatif uniquement et n'est pas destiné à être approuvé ou exprimé par Cisco ou toute autre partie. En publiant sur ce site Web, chaque utilisateur est seul responsable du contenu de toutes les informations publiées, liées ou autrement téléchargées, et décline Cisco de toute responsabilité relative à l'utilisation de ce site Web. Je suis d'accord.

Recommended Posts