Jeackelin Sofía Montenegro Chamale
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Manual Técnico Chatbot ## Integrantes * Steven Facundo Mejía Xolop - 202104160 * Eduardo Josué González Cifuentes - 201900647 * Jeackelin Sofía Montenegro Chamalé - 201612120 ## 1. Descripción General del Proyecto ### 1.1 Propósito Este proyecto consiste en el desarrollo de un chatbot que responde a consultas básicas en idioma español. El chatbot es capaz de responder preguntas sobre materias, especializaciones, proyectos, oportunidades laborales, entre otros temas, utilizando un modelo entrenado en base a ejemplos de preguntas y respuestas. ### 1.2 Funcionalidad - Maneja varias intenciones como "saludo", "despedida", "consultas académicas", entre otras. - Utiliza un modelo de Machine Learning entrenado en un conjunto de datos en formato JSON. ## 2. Arquitectura del Proyecto ### 2.1 Estructura de Archivos La estructura del proyecto está organizada en distintos archivos que cumplen funciones específicas dentro del sistema. A continuación, se detallan los archivos clave del proyecto: * `data.json`: Contiene los ejemplos de preguntas y respuestas para cada intención (saludo, despedida, etc.). * `chatbot.js`: Archivo principal donde el chatbot interactúa con el usuario y responde a las consultas. * `package.json`: Contiene las dependencias y configuraciones del proyecto. * `App.jsx`: Archivo donde se implementa la interfaz de usuario de React. * `index.html`: Archivo HTML que estructura la página y carga la aplicación React. ### 2.2 Diagrama de Flujo 1. **Entrenamiento:** El modelo se entrena utilizando los datos de data.json. Este proceso se realiza previamente antes de la interacción con el usuario y no requiere intervención directa en el proyecto actual. 2. **Interacción con el Usuario**: * El archivo chatbot.js gestiona la interacción entre el usuario y el chatbot. * El modelo entrenado se utiliza para predecir la intención de las preguntas del usuario y generar respuestas adecuadas. 3. **Respuesta de Intenciones**: * El chatbot utiliza la función predict_intent en chatbot.js para detectar la intención de la consulta del usuario. * Luego, el chatbot responde utilizando la función get_response, que selecciona la respuesta adecuada de acuerdo con la intención detectada. ## 3. Instalación y Configuración ### 3.1 Requisitos Previos * **Node.js:** Se requiere tener Node.js instalado para ejecutar los archivos `.js`. * **npm:** Necesario para instalar las dependencias del proyecto. * **React:** Se requiere un entorno de desarrollo de React (utilizando Vite en este caso). ### 3.2 Instalación del Proyecto Clonar el repositorio: ```bash git clone <URL_del_repositorio> cd <nombre_del_repositorio> ``` Instalar las dependencias: Asegúrate de tener npm instalado en tu máquina. Luego, ejecuta el siguiente comando para instalar las dependencias necesarias: ```bash npm install ``` Instalar las dependencias adicionales: ```bash npm install compromise ``` ## 4. Uso del Chatbot ### 4.1 Interacción con el Chatbot El chatbot te permitirá hacer preguntas y recibir respuestas basadas en el modelo entrenado. Simplemente escribe tu pregunta en el campo de texto y presiona "Enviar". La interfaz gráfica muestra tanto las preguntas como las respuestas en el chat. ### 4.2 Ejemplo de Interacción * Usuario: "Hola" * Chatbot: "¡Hola! ¿Todo bien?" ## 5. Detalles Técnicos ### 5.1 Modelo de Machine Learning El modelo es un modelo de clasificación de texto basado en redes neuronales. Se entrena utilizando los datos de data.json y se ajusta para detectar la intención de la pregunta del usuario. El modelo es capaz de clasificar varias intenciones como: * **Saludo**: Cuando el usuario saluda al chatbot. * **Despedida**: Cuando el usuario se despide del chatbot. * **Consultas generales**: Preguntas relacionadas con temas académicos, generales o de interés. ### 5.2 Funciones Principales en chatbot.js predict_intent(user_input): Esta función toma el mensaje del usuario, lo procesa y predice la intención del mensaje. ```javascript function predict_intent(user_input) { sequences = tokenizer.texts_to_sequences([user_input]); padded_sequences = pad_sequences(sequences, { maxlen: 10 }); prediction = model.predict(padded_sequences); intent_index = np.argmax(prediction); confidence = np.max(prediction); console.log(`Confianza: ${confidence}`); if (confidence < 0.6) { return "no_reconocido"; } intent = label_encoder.inverse_transform([intent_index])[0]; return intent; } ``` **Explicación**: Esta función transforma la entrada del usuario en una secuencia numérica, la procesa con el modelo y calcula la confianza de la predicción. Si la confianza es baja (por debajo de 0.6), se devuelve la intención "no_reconocido", de lo contrario, se devuelve la intención predicha. **get_response(intent)**: Esta función devuelve la respuesta correspondiente según la intención predicha. ```javascript function get_response(intent) { with open("data/data.json", "r", encoding="utf-8") as file { data = json.load(file); } for (item in data["intents"]) { if (item["intent"] === intent) { return np.random.choice(item["responses"]); } } return "Lo siento, no te entendí."; } ``` **Explicación**: Esta función busca en el archivo data.json la intención correspondiente y devuelve una de las respuestas asociadas a esa intención. Si no se encuentra la intención, devuelve un mensaje predeterminado. ### 5.3 data.json Este archivo contiene las intenciones y las respuestas del chatbot. Cada intención tiene ejemplos de preguntas y respuestas que el chatbot utiliza para responder a las consultas. Ejemplo de data.json: ```json { "intents": [ { "intent": "saludo", "examples": [ "Hola", "Buenas tardes", "¿Qué tal?" ], "responses": [ "¡Hola! ¿Cómo estás?", "¡Hola! ¿Todo bien?" ] }, { "intent": "despedida", "examples": [ "Adiós", "Hasta luego", "Nos vemos" ], "responses": [ "¡Hasta luego!", "¡Nos vemos pronto!" ] } ] } ``` **Explicación**: Cada intención en data.json tiene una lista de ejemplos (preguntas que el chatbot puede recibir) y respuestas (respuestas posibles que el chatbot puede dar). ## 6. Mantenimiento y Actualización ### 6.1 Añadir Nuevas Intenciones Para añadir nuevas intenciones, debes seguir los siguientes pasos: 1. Edita el archivo data.json y agrega nuevas intenciones con sus ejemplos y respuestas. 2. El chatbot procesará automáticamente estas nuevas intenciones sin necesidad de reentrenar el modelo, ya que las respuestas se seleccionan dinámicamente. ### 6.2 Actualizar el Modelo Aunque el modelo no se actualiza automáticamente con las nuevas intenciones, si se desea mejorar la precisión del modelo o cambiar su comportamiento: 1. Entrenar el modelo nuevamente con un conjunto de datos actualizado. 2. Reemplazar el modelo existente con el nuevo modelo entrenado. ## 7. Errores Comunes * Problemas con `compromise`: Si no se puede cargar `compromise`, asegúrate de que esté correctamente instalado ejecutando: ```bash npm install compromise ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully