Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Updating vietnamese language and training model #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,46 @@
</p>

## Introduction

<p align="center">
<img alt="introduction" height="100" src="https://i.imgur.com/Ygm9CMc.png">
</p>

### Description

Olivia is an open-source chatbot built in Golang using Machine Learning technologies.
Its goal is to provide a free and open-source alternative to big services like DialogFlow.
Its goal is to provide a free and open-source alternative to big services like DialogFlow.

You can chat with her by speaking (STT) or writing, she replies with a text message but you can enable her voice (TTS).

You can clone the project and customize it as you want using [GitHub](https://github.com/olivia-ai/olivia)
Try it on [her website!](https://olivia-ai.org)

### Why Olivia?

- The only chatbot project in Go that could be modulable and customizable.
- Using daily a privacy-friendly chatbot is great.
- The Website is a Progressive Web Application, which means you can add it to your phone and it seems like a native app!


## Getting started
### Installation
#### Login to Github

### Installation

#### Login to Github

To get a personal access token from Github go to `Setings > Developer settings > Personal Access Tokens`

Click on Generate new Token and name it you MUST have read and write packages ticked on.
Then click Generate new token

Replace `TOKEN` with the Token that you just made.

```bash
$ export PAT=TOKEN
```

Login to Github (Note: change USERNAME to Gthub username)

```bash
$ echo $PAT | docker login docker.pkg.github.com -u USERNAME --password-stdin
```
Expand All @@ -86,57 +92,66 @@ $ echo $PAT | docker login docker.pkg.github.com -u USERNAME --password-stdin
</p>

Pull the image from GitHub Packages

```bash
$ docker pull docker.pkg.github.com/olivia-ai/olivia/olivia:latest
```

Then start it

```bash
$ docker run -d -e PORT=8080 -p 8080:8080 docker.pkg.github.com/olivia-ai/olivia/olivia:latest
```

You can just use the websocket of Olivia now.

To stop it, get the container id:

```bash
$ docker container ls
```

```bash
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
311b3abb963a olivia "./main" 7 minutes ago Up 7 minutes 0.0.0.0:8080->8080/tcp quizzical_mayer
```

and stop it

```bash
$ docker container stop 311b3abb963a
$ docker container stop 311b3abb963a
```

The app will automatically check for `res/datasets/training.json` file which contains the save of the neural network.
By default when you clone the repository from Github you have a stable save.
If you want to train a new model just delete this file and rerun the app.

#### GitHub

<p align="center">
<img height="100" src="https://i.imgur.com/RRPoP69.png">
</p>

Clone the project via GitHub:

```bash
```bash
$ git clone [email protected]:olivia-ai/olivia.git
```

Then download the dependencies

```bash
$ go mod download
```

And run it

```bash
$ go run main.go
```

### Frontend and Backend

To install the frontend and the backend together, please use the `docker-compose.yml` file:

```bash
Expand All @@ -146,6 +161,7 @@ $ docker-compose up
And all done!

## Architecture

<p align="center">
<img alt="architecture" height="85" src="https://i.imgur.com/95h8WIU.png">
<br>
Expand All @@ -159,15 +175,18 @@ And all done!
</p>

### Languages supported

- <img src="https://i.imgur.com/URqxsb0.png" width="25"> English
- <img src="https://i.imgur.com/Oo5BNk0.png" width="25"> Spanish
- <img src="https://i.imgur.com/2DWxeF9.png" width="25"> Catalan
- <img src="https://i.imgur.com/0dVqbjf.png" width="25"> French
- <img src="https://i.imgur.com/sXLQp8e.png" width="25"> German
- <img src="https://i.imgur.com/DGNcrRF.png" width="25"> Italian
- <img src="https://i.imgur.com/tq19CY1.png" width="25"> Vietnam
- <img src="https://i.imgur.com/kB0RoFZ.png" width="25"> Brazilian portuguese - not completed

### Coverage

The coverage of the translations is given [here](https://olivia-ai.org/dashboard/language).
To add a language please read [the documentation for that](https://docs.olivia-ai.org/translations.html).

Expand All @@ -181,13 +200,14 @@ To add a language please read [the documentation for that](https://docs.olivia-a
Please refer to the [contributing file](.github/CONTRIBUTING.md)

### Code Contributors
Thanks to the people who contribute to Olivia.
Thanks to the people who contribute to Olivia.

[Contribute](.github/CONTRIBUTING.md)
<a href="https://github.com/olivia-ai/olivia/graphs/contributors"><img src="https://opencollective.com/olivia-ai/contributors.svg?width=950&button=false" /></a>

### Financial Contributors
Become a financial contributor and help Olivia growth.

Become a financial contributor and help Olivia growth.

Contribute on the GitHub page of [hugolgst](https://github.com/sponsors/hugolgst) ❤️

Expand Down
4 changes: 4 additions & 0 deletions language/date/date.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ var PatternTranslation = map[string]PatternTranslations{
DateRegex: `(από )?(το )?((μεθ )?αύριο|((σήμερα|απόψε)|(επόμενη )?(δευτέρα|τρίτη|τετάρτη|πέμπτη|παρασκευή|σάββατο|κυριακή))|(\d{2}|\d)(η)? (of )?(ιανουάριος|φεβρουάριος|μάρτιος|απρίλιος|μάιος|ιούνιος|ιούλιος|αύγουστος|σεπτέμβριος|οκτώβριος|νοέμβριος|δεκέμβριος)|((\d{2}|\d)/(\d{2}|\d)))`,
TimeRegex: `(at )?(\d{2}|\d)(:\d{2}|\d)?( )?(μμ|πμ|μ\.μ|π\.μ)`,
},
"vi": {
DateRegex: `(của )?(một )?((sau )?ngày mai|((hôm nay|tối nay)|(tiếp )?(thứ hai|thứ ba|thứ tư|thứ năm|thứ sáu|thứ bảy|chủ nhật))|(\d{2}|\d)(th|rd|st|nd)? (of )?(january|february|march|april|may|june|july|august|september|october|november|december)|((\d{2}|\d)/(\d{2}|\d)))`,
TimeRegex: `(tại )?(\d{2}|\d)(:\d{2}|\d)?( )?(chiều|sáng|p\.m|a\.m)`,
},
}

// PatternTranslations are the translations of the regexs for dates
Expand Down
15 changes: 15 additions & 0 deletions language/date/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@ var RuleTranslations = map[string]RuleTranslation{
RuleNextDayOfWeek: "επόμενη",
RuleNaturalDate: `ιανουάριος|φεβρουάριος|μάρτιος|απρίλιος|μάιος|ιούνιος|ιούλιος|αύγουστος|σεπτέμβριος|οκτώβριος|νοέμβριος|δεκέμβριος`,
},
"vi": {
DaysOfWeek: []string{
"thứ hai", "thứ ba", "thứ tư", "thứ năm", "thứ sáu", "thứ bảy", "chủ nhật",
},
Months: []string{
"tháng 1", "tháng 2", "tháng 3", "tháng 4", "tháng 5", "tháng 6", "tháng 7",
"tháng 8", "tháng 9", "tháng 10", "tháng 11", "tháng 12",
},
RuleToday: `today|tonight`,
RuleTomorrow: `(after )?tomorrow`,
RuleAfterTomorrow: "after",
RuleDayOfWeek: `(next )?(thứ hai|thứ ba|thứ tư|thứ năm|thứ sáu|thứ bảy|chủ nhật)`,
RuleNextDayOfWeek: "next",
RuleNaturalDate: `tháng 1|tháng 2|tháng 3|tháng 4|tháng 5|tháng 6|tháng 7|tháng 8|tháng 9|tháng 10|tháng 11|tháng 12`,
},
}

// A RuleTranslation is all the texts/regexs to match the dates
Expand Down
1 change: 1 addition & 0 deletions language/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var MathDecimals = map[string]string{
"it": `(\d+( |-)decimale(s)?)|(numero (di )?decimale(s)? (è )?\d+)`,
"tr": `(\d+( |-)desimal(s)?)|(numara (dan )?desimal(s)? (mı )?\d+)`,
"nl": `(\d+( |-)decimal(en)?)|(nummer (van )?decimal(en)? (is )?\d+)`,
"vi": `(\d+( |-)decimal(s)?)|(nummer (van )?decimal(s)? (is )?\d+)`,
"el": `(\d+( |-)δεκαδικ(ό|ά)?)|(αριθμός (από )?δεκαδικ(ό|ά)? (είναι )?\d+)`,
}

Expand Down
4 changes: 4 additions & 0 deletions language/movies.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ var (
"Δράση", "Περιπέτεια", "Κινούμενα Σχέδια", "Παιδικά", "Κωμωδία", "Έγκλημα", "Ντοκιμαντέρ", "Δράμα", "Φαντασία",
"Film-Noir", "Τρόμου", "Μουσική", "Μυστηρίου", "Ρομαντική", "Επιστημονική Φαντασία", "Θρίλλερ", "Πολέμου", "Western",
},
"vi": {
"Hành động", "Thám hiển", "Hoạt hình", "Trẻ em", "Hài hước", "Tội phạm", "Phim tài liệu", "Kịch", "Viễn tưởng",
"Film-Noir", "Kinh dị", "Âm nhạc", "Bí ẩn", "Lãng mạn", "Khoa học - Viễn tưởng", "Giật gân", "Chiến tranh", "Western",
},
}
movies = SerializeMovies()
)
Expand Down
5 changes: 5 additions & 0 deletions language/music.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ var SpotifyKeyword = map[string]SpotifyKeywords{
From: "από",
On: "στο",
},
"vi": {
Play: "Chạy",
From: "Từ",
On: "Bật",
},
}

// SpotifyKeywords are the keywords used to get music name
Expand Down
4 changes: 4 additions & 0 deletions language/reason.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ var ReasonKeywords = map[string]ReasonKeyword{
That: "το οποίο",
To: "στο",
},
"vi": {
That: "Đây là",
To: "Tới",
},
}

// ReasonKeyword are used to find reason for different languages
Expand Down
7 changes: 5 additions & 2 deletions locales/locales.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
_ "github.com/olivia-ai/olivia/res/locales/it"
_ "github.com/olivia-ai/olivia/res/locales/nl"
_ "github.com/olivia-ai/olivia/res/locales/tr"
_ "github.com/olivia-ai/olivia/res/locales/el"

_ "github.com/olivia-ai/olivia/res/locales/vi"
)

// Locales is the list of locales's tags and names
Expand Down Expand Up @@ -55,6 +54,10 @@ var Locales = []Locale{
Tag: "el",
Name: "greek",
},
{
Tag: "vi",
Name: "vietnam",
},
}

// A Locale is a registered locale in the file
Expand Down
18 changes: 18 additions & 0 deletions res/datasets/countries.json
Original file line number Diff line number Diff line change
Expand Up @@ -3842,5 +3842,23 @@
"capital": "Harare",
"area": 390757,
"currency": "ZWL"
},
{
"name": {
"en": "Ha Noi",
"fr": "Ha Noi",
"es": "Ha Noi",
"ca": "Ha Noi",
"de": "Ha Noi",
"cn": "河内",
"pt": "Ha Noi",
"it": "Ha Noi",
"tr": "Ha Noi",
"nl": "Ha Noi",
"el": "Ханой"
},
"capital": "Harare",
"area": 390757,
"currency": "ZWL"
}
]
3 changes: 2 additions & 1 deletion res/locales/ca/training.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion res/locales/de/training.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion res/locales/el/training.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion res/locales/en/training.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion res/locales/es/training.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion res/locales/fr/training.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion res/locales/it/training.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion res/locales/nl/training.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion res/locales/tr/training.json

Large diffs are not rendered by default.

Loading