Tips Programming Intelligent Bots with Rasa Open Source

nhathuy6920

New member
[TIẾNG VIỆT]:
## Lập trình bot thông minh với nguồn mở rasa

RASA Open Source là một khung công tác miễn phí và nguồn mở để xây dựng các ứng dụng AI trò chuyện.Nó được xây dựng trên đỉnh của Python và sử dụng nhiều thư viện học máy nguồn mở, chẳng hạn như Tensorflow và Spacy.Nguồn mở RASA được thiết kế để dễ sử dụng, ngay cả đối với các nhà phát triển không có kinh nghiệm trước trong xử lý ngôn ngữ tự nhiên (NLP).

Bài viết này sẽ cung cấp một hướng dẫn từng bước về cách xây dựng một chatbot đơn giản bằng nguồn mở rasa.Chúng tôi sẽ trình bày các chủ đề sau:

* Cài đặt nguồn mở rasa
* Tạo một dự án mới
* Viết mô hình đối thoại
* Đào tạo mô hình
* Chạy bot

### Cài đặt nguồn mở rasa

Bước đầu tiên là cài đặt nguồn mở rasa.Bạn có thể làm điều này bằng cách làm theo các hướng dẫn trên trang web RASA Open Source.

Khi bạn đã cài đặt RASA Open Source, bạn có thể tạo một dự án mới bằng cách chạy lệnh sau:

`` `
Rasa init
`` `

Điều này sẽ tạo ra một thư mục mới gọi là `myproject`.Bên trong thư mục `myProject`, bạn sẽ tìm thấy một số tệp và thư mục, bao gồm:

* `Domain.yml`: Tệp này xác định các ý định, thực thể và hành động mà bot của bạn có thể hiểu và trả lời.
* `model`: Thư mục này chứa các mô hình được đào tạo cho bot của bạn.
* `nlu`: Thư mục này chứa dữ liệu đào tạo cho mô hình NLU của bot của bạn.
* `Chính sách ': Thư mục này chứa các tệp chính sách cho hệ thống quản lý đối thoại của bạn.
* `rasa.yaml`: Tệp này cấu hình nguồn mở rasa.

### Tạo mô hình đối thoại

Bước tiếp theo là tạo một mô hình đối thoại cho bot của bạn.Một mô hình đối thoại xác định ý định, thực thể và hành động mà bot của bạn có thể hiểu và trả lời.

Để tạo mô hình đối thoại, hãy mở tệp `domain.yml` và thêm mã sau:

`` `
Ý định:
- Chào
- tạm biệt
- Ask_weather

Các thực thể:
- vị trí

Hành động:
- Utter_Greet
- UTTER_GOODBYE
- Utter_Weather
`` `

Mô hình đối thoại này xác định ba ý định: `chào`,` Goodbye` và `ask_weather`.Nó cũng định nghĩa hai thực thể: `vị trí` và` weather`.

### Đào tạo mô hình

Khi bạn đã tạo một mô hình đối thoại, bạn cần đào tạo mô hình.Để thực hiện việc này, hãy chạy lệnh sau:

`` `
Tàu Rasa
`` `

Điều này sẽ đào tạo mô hình trên dữ liệu trong thư mục `nlu`.

### chạy bot

Khi bạn đã đào tạo mô hình, bạn có thể chạy bot.Để thực hiện việc này, hãy chạy lệnh sau:

`` `
Rasa chạy
`` `

Điều này sẽ bắt đầu bot trong một quy trình con.Bây giờ bạn có thể tương tác với bot bằng cách gửi tin nhắn trong thiết bị đầu cuối.

### Cuộc trò chuyện ví dụ

Dưới đây là một cuộc trò chuyện ví dụ với bot rasa:

`` `
Người dùng: Xin chào
Bot: Xin chào!Làm thế nào để tôi giúp bạn?
Người dùng: Thời tiết hôm nay như thế nào?
BOT: Hiện tại là 72 độ với bầu trời đầy nắng.
Người dùng: Cảm ơn!
Bot: Bạn được chào đón!
`` `

Như bạn có thể thấy, bot rasa đã có thể hiểu được ý định của người dùng và trả lời một cách thích hợp.

### Phần kết luận

RASA Open Source là một công cụ mạnh mẽ để xây dựng các ứng dụng AI trò chuyện.Thật dễ dàng để sử dụng và có thể được sử dụng để xây dựng bot cho nhiều mục đích khác nhau, chẳng hạn như dịch vụ khách hàng, bán hàng và tiếp thị.

Nếu bạn quan tâm đến việc tìm hiểu thêm về nguồn mở rasa, tôi khuyến khích bạn xem [trang web nguồn mở Rasa] (Conversational AI Platform | Superior Customer Experiences Start Here).

### Bài viết tham khảo

* [Tài liệu nguồn mở RASA] (Rasa: Developer Documentation Portal)
* [Hướng dẫn nguồn mở rasa] (https://rasa.com/docs/rasa/tutorial/)
* [Diễn đàn nguồn mở Rasa] (Rasa Community Forum)

[ENGLISH]:
## Programming Intelligent Bots with Rasa Open Source

Rasa Open Source is a free and open-source framework for building conversational AI applications. It's built on top of Python and uses a variety of open-source machine learning libraries, such as TensorFlow and SpaCy. Rasa Open Source is designed to be easy to use, even for developers with no prior experience in natural language processing (NLP).

This article will provide a step-by-step guide on how to build a simple chatbot using Rasa Open Source. We'll cover the following topics:

* Installing Rasa Open Source
* Creating a new project
* Writing a dialogue model
* Training the model
* Running the bot

### Installing Rasa Open Source

The first step is to install Rasa Open Source. You can do this by following the instructions on the Rasa Open Source website.

Once you've installed Rasa Open Source, you can create a new project by running the following command:

```
rasa init
```

This will create a new directory called `myproject`. Inside the `myproject` directory, you'll find a number of files and folders, including:

* `domain.yml`: This file defines the intents, entities, and actions that your bot can understand and respond to.
* `models`: This folder contains the trained models for your bot.
* `nlu`: This folder contains the training data for your bot's NLU model.
* `policies`: This folder contains the policy files for your bot's dialogue management system.
* `rasa.yaml`: This file configures Rasa Open Source.

### Creating a Dialogue Model

The next step is to create a dialogue model for your bot. A dialogue model defines the intents, entities, and actions that your bot can understand and respond to.

To create a dialogue model, open the `domain.yml` file and add the following code:

```
intents:
- greet
- goodbye
- ask_weather

entities:
- location

actions:
- utter_greet
- utter_goodbye
- utter_weather
```

This dialogue model defines three intents: `greet`, `goodbye`, and `ask_weather`. It also defines two entities: `location` and `weather`.

### Training the Model

Once you've created a dialogue model, you need to train the model. To do this, run the following command:

```
rasa train
```

This will train the model on the data in the `nlu` folder.

### Running the Bot

Once you've trained the model, you can run the bot. To do this, run the following command:

```
rasa run
```

This will start the bot in a subprocess. You can now interact with the bot by sending it messages in the terminal.

### Example Conversation

Here is an example conversation with a Rasa bot:

```
User: Hi
Bot: Hello! How can I help you?
User: What's the weather like today?
Bot: It's currently 72 degrees with sunny skies.
User: Thanks!
Bot: You're welcome!
```

As you can see, the Rasa bot was able to understand the user's intent and respond appropriately.

### Conclusion

Rasa Open Source is a powerful tool for building conversational AI applications. It's easy to use and can be used to build bots for a variety of purposes, such as customer service, sales, and marketing.

If you're interested in learning more about Rasa Open Source, I encourage you to check out the [Rasa Open Source website](https://rasa.com/).

### Reference Articles

* [Rasa Open Source Documentation](https://rasa.com/docs/)
* [Rasa Open Source Tutorial](https://rasa.com/docs/rasa/tutorial/)
* [Rasa Open Source Forum](https://forum.rasa.com/)
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top