Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c56351ff authored by PixelFault's avatar PixelFault
Browse files

Merge branch 'master' of https://github.com/PoCFrance/e into fork-olivia

parents 8aae0831 a4e4f295
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -13,3 +13,5 @@
/captures
.externalNativeBuild
.cxx
back/res/locale/*/training.json
back/package/*/*.so

LICENSE

0 → 100644
+21 −0
Original line number Diff line number Diff line
MIT License

Copyright (c) 2020 PoC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+30 −33
Original line number Diff line number Diff line
# /e/ Vocal Assistant
### e

<p align="center">
  <img src="./.github/appDemo.png" alt="image-20200623191251374" style="zoom:50%;"/>
</p>
## Description

## Introduction
E is a vocal assistant designed to be respectful of user privacy over theirs data.
The goal of this project is to be seen incorporated in /e/ os, a product from the [e foundation](https://e.foundation/), do to so it is supervised by [Gaël Duval](https://fr.wikipedia.org/wiki/Ga%C3%ABl_Duval).

/e/ Vocal Assistant is a project designed to be opensource and respectful application for the **/e/ OS**.
This project has to be incorporated within the [/e/ Foundation Project](https://gitlab.e.foundation/e)
This project was made using [Leon chatbot](https://github.com/leon-ai/leon)
E Vocal Assistant is composed of 3 parts, a front end built in Kotlin using gradle, a back-end generously inspired from [Olivia](https://github.com/olivia-ai/olivia)'s design, packaging an AI, and a CLI tool made for testing purpose.
Each part have it's own `README.md` where all the information relative to the said part will be detailed and explained more in depth.

## /e/  Project
 ## Installation

The /e/ Foundation goal is to produce open source, privacy-enabled smartphone operating systems.

## Current Project State

The application features 3 majors parts :
```shell
git clone https://github.com/PoCFrance/e
```

 - A front-end Kotlin-based application that handles user's communication
 - Leon Chatbot as a back-end interpreter for speech to text or module's redirection
 - Leon's Modules, allowing adding features to the assistant such as SMS sending or Calendar handling

within the front-end we implemented a basic chat as well as a vocal handling.

The project features addition to Leon's chatbot in the handling of Front-end actions return, making the modules able to make android-based actions
// todo luca -- build with android studio

## Development
## Quick Start

### Installation
As a developer or for testing, you can simply start the back end in local and request on it.
-- for dev purpose it's the basic option since IP isn't configurable yet
first start the back-end

```bash
# clone the Vocal assistant repository
git clone https://github.com/PoCFrance/e poc-e
```shell
cd back
go run ./
```

concerning the application, you will have to follow an [android studio guide](https://developer.android.com/guide) to lead you through the software
Then lunch android studio in the `front` folder, and build the app
You can start the application once build is completed.

### Usage
// todo luca -- update ip address (conf / raw code update)

```bash
# TODO
```
## Maintainers

* [Theo Ardouin](https://github.com/Qwexta)
* [Luca George Francois](https://github.com/PixelFault-tech)

Rebuild the app if needed thanks to android studio software
## Source

## What's next
As said in the description, e is inspired from [Olivia](https://github.com/olivia-ai/olivia), yet it also uses a part of its code.
The project was built upon Olivia's IA and a fork from it's Back-end. Currently, the back has been totally updated to meet the requirement we had over flexibility and mutability, but we still use the [IA]() for the moment.

We plan to add multiples modules making the assistant bigger and able to handle more request.
## License

Also, we did not yet implemented it on /e/ OS and it would be the next major step.
 No newline at end of file
This project is under MIT licence
 No newline at end of file

back/analysis/coverage.go

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
package analysis
+27 −40
Original line number Diff line number Diff line
@@ -7,40 +7,26 @@ import (
	"github.com/PoCFrance/e/util"
)

func IntentTagFormat(locale string, pack_i, trig_i int) string {
	return plugins.GetPackage(locale)[pack_i].Name + "_" + locale + "_" + plugins.GetPackage(locale)[pack_i].IO.Triggers[trig_i].CallBack
}

// IntentOlivia - conv plugin of elivia to olivia's form.
func IntentOlivia(locale string) []Intent {
	var intents []Intent

	for pi, pack := range plugins.GetPackage(locale) {
		for ti, trigger := range pack.IO.Triggers {
			intents = append(intents, Intent{
				Tag:       IntentTagFormat(locale, pi, ti),
				Patterns:  trigger.OliviaPatterns,
				Responses: []string{},
				Context:   ""})
		}
	}
	return intents
// IntentTagFormat formats the tag associated with a function of the package
func IntentTagFormat(packName, locale, predicat string) string {
	return packName + "_" + locale + "_" + predicat
}

// Organize intents with an array of all words, an array with a representative word of each tag
// and an array of Documents which contains a word list associated with a tag
func Organize(locale string) (words, classes []string, documents []Document) {
	intents := IntentOlivia(locale)
	packages := plugins.GetPackage(locale)

	for _, intent := range intents {
		for _, pattern := range intent.Patterns {
	for _, pack := range packages {
		for _, module := range pack.Modules {
			for tag, trigger := range module.Triggers {
				for _, pattern := range trigger.Patterns {
					// Tokenize the pattern's sentence
					patternSentence := Sentence{locale, pattern}
					patternSentence.arrange()

					// Add each word to response
					for _, word := range patternSentence.stem() {

						if !util.Contains(words, word) {
							words = append(words, word)
						}
@@ -49,12 +35,13 @@ func Organize(locale string) (words, classes []string, documents []Document) {
					// Add a new document
					documents = append(documents, Document{
						patternSentence,
				intent.Tag,
						tag,
					})
				}

				// Add the intent tag to classes
		classes = append(classes, intent.Tag)
				classes = append(classes, tag)
			}
		}
	}

	sort.Strings(words)
Loading