Stypox / dicio-sentences-compiler

Sentences-compiler for Dicio assistant
GNU General Public License v3.0
11 stars 4 forks source link

Consider to continue development on Rust #6

Open andreytkachenko opened 3 years ago

andreytkachenko commented 3 years ago

I would like to suggest to switch this library to Rust and continue development on Rust. Reasons:

  1. It can be shared with other projects on C++ or Rust
  2. It will be safe as well as on Java (but even safer in case of multi threading)
  3. It is not limit us on performance (and even in case of heavy NLP onnx models)
  4. We can create a skill repository and write skills on WASM and link them as plugins - community driven skills
  5. Rust is a best language for such kind of things(parsers, matchers etc.)
  6. I has very loose coupling with Main Java application (interface should be quite simple)

Some links: https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-21-rust-on-android.html https://medium.com/visly/rust-on-android-19f34a2fb43 https://freemasen.com/blog/wasmer-plugin-pt-1/

Stypox commented 2 years ago

For some reason I was not watching this repo, sorry for answering so late... At the beginning I thought of writing skills so that they were multiplatform and they could run on Android, Linux, or anywhere you want. But when doing this I encountered some issues: often skills would need access to the resources specific to the environment they run in (e.g. the "open" skill needs to obtain apps from the system). Therefore either I chose something like Qt that would have common APIs in all systems, or I dropped multiplatform compatibility. I went for the second option since using Qt and making sure everything works in a multiplatform fashion would have taken much more work and would probably have been too ambitious. Also, there is already a very good assistant on Desktop devices (Mycroft). So at the end I went for Java skills built upon the Android SDK, so that skills themselves can directly access an Android Context and do whatever they need to with it. With that said, let me answer some of your points specifically:

  1. If you want to create a dicio-skill implementation in another language, this tool can easily be extended to allow compiling "dicio sentences language files" into a language different than Java.
  2. Performance is not much of an issue with this particular library (dicio-sentences-compiler), since it is used only at skill build time to convert from the "sentences language" directly to Java code compatible with dicio-skill, containing ready-to-use data structures that allow running a fast Dynamic Programming algorithm to compare the user input with what the skill accepts.
  3. I explained that above: multiplatform skills can be a good idea, but would probably create more problems than they solve, so I chose to make Dicio skills Android-only
  4. I have no experience with Rust, but I believe what you say ;-)

Thank you for reaching out