Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skill: Definitions lookup #279

Open
GoogleIsEvil opened this issue Jan 28, 2025 · 7 comments
Open

Skill: Definitions lookup #279

GoogleIsEvil opened this issue Jan 28, 2025 · 7 comments
Labels
enhancement New feature or request skill Skill request or bug

Comments

@GoogleIsEvil
Copy link

"I cannot complete your request"

It would be nice if Dicio could give us the meaning of words(and read them back).

E.g., if I'm reading a book and don't know a definition it would be nice if I could quickly look it up as fast as possible. Also, for multiple languages:

E.g.,: "Definition in French beaucoup" and it recites the definition out loud.

@Inhishonor
Copy link
Contributor

This is a duplicate of #200. I am currently working on coding this skill and hope to have a pull request out sometime soon. 🤞

@GoogleIsEvil
Copy link
Author

GoogleIsEvil commented Jan 29, 2025

Ok, Hopefully have a slimmed down version just for quick definition lookups.

The entire point for me is to have a hands free way to simply ask for a definition very quickly as I'm reading. Ideally it would work with foreign words.

I have many dictionaries but having to take the time to type in and read the words slows down the entire process of reading the book. I'm not sure if something like one of those can be integrated into dicio itself where it can simply look up the word and say it's definition(s).

E.g., maybe one can install a definitions text(e.g., one of the free ones such as from freedict: https://freedict.org/) or use an online source(e.g., http://freedictionary.org/)

Then one can change the language with a command such as: "Set Dictionary English " and then "Definition " and it will take the English word and give the definition in French(There are TTS libraries that might help with pronunciation them correctly. The best I've seen is the ReadEra TTS which are based off the google TTS stuff IIRC but one can download them)

@Inhishonor
Copy link
Contributor

I was planning on using the https://dictionaryapi.dev/ API. Mainly, so that it is lightweight. (And easy to implement. 😀 ) Unfortunately, it is only for English. I have looked into other languages, but not much luck yet...
Having a dictionary that is downloaded is a good idea, but I think it may be a tad to difficult to implement, and/or, not really what this project is for. Not sure though, someone else might know better.
Good idea, regarding switching languages. I will do that. The TTS is a tad out of my wheelhouse, but I could look into it.

@Inhishonor
Copy link
Contributor

@Stypox Do you have anything to add to this? Does it sound good to you? Thanks!

@GoogleIsEvil
Copy link
Author

GoogleIsEvil commented Jan 31, 2025

I have something to add that may not be directly related:

You should be able to add custom commands relatively easy: Basically STT->Match to custom command->Execute command.

I'm not sure how useful it is with android but you could enable launching activities, opening files, etc. I haven't thought about it much but just thought it might be a useful generality for the app which if it could be done well might be quite useful.

In general, it would be nice to potentially have some way to automate things and then launch them with STT commands. Again, I don't know enough about android to know how useful this could be.

But say, you could enable launching python, bash, java, or kotlin scripts/code that take arguments which are passed to it through STT. Then one can write these scripts to do whatever they way more or less. This enables much more generalization of the app than having to hard code everything(which will never be able to satisfy everyone's needs/desires).


The downloadable dictionary stuff should be easy:

E.g., with freedict you can download many language files. This is from eng->pol and is in the .dict format which is just plain text that looks like:

abominable /əˈbɒmɪnəbəl/
I. straszny
II. Abominable Snowman /ɐbˈɒmɪnəbəl snˈəʊmən/ yeti
abominably /əˈbɒmɪnəblɪ/
okropnie
abort /əˈbɔ:t/
I. 1. poronić, przerwać ciążę
2. przerwać [przed zakończeniem]
II. [komp] abort, przerwanie zadania
abortion /əˈbɔ:ʃən/
aborcja, poronienie
abortive /əˈbɔ:tɪv/
nieskuteczny
abound /əˈbaʊnd/
być w obfitości, obfitować (with sth - w coś) (in sth - w coś)
about /əˈbaʊt/

  1. o
  2. z
  3. około
  4. wokoło

So basically you just look up the word in English(that is not indented) and then the definitions come afterwards which you would just read with TTS. [to speed up searching you can use a binary search since obviously the file terms are in alphabetical order]

So the basic idea is:

  1. Get in and out languages(probably set up either with some STT command or settings) which correspond to some freedict file usually in the format - (so might have to have a map say "English->eng, Polish->pol", etc to match to the file)
  2. Search for the term in the list and extract the definitions. This is easy and standard lookup and text stuff.
  3. Say the definitions using TTS. [This might be a little work but shouldn't be too bad
    E.g: https://www.geeksforgeeks.org/how-to-convert-text-to-speech-in-android-using-kotlin/

import android.speech.tts.TextToSpeech

tts!!.speak(text, TextToSpeech.QUEUE_FLUSH, null,"")

So basically it's pretty simple but just a lot of wiring up.

With the TTS you can then do more like even have it read back articles and such and even go into more like using voice to navigate sorta like screen readers. E.g., "Search google for " then it returns the search and you can read off the headers and then "Stop and open" and it will open the last one it spoke and then open that site and start reading it or read the summary google gives or whatever.

Using the TTS should be pretty simple for definitions though. You already have the ability to convert the STT so it's really just all plumbing and then polishing.

You could even then add an AI feature where you wrap some AI and let one put in the prompt using STT then read the AI output using TTS and basically have something like Siri but more useful. Maybe use deepseek.

@Stypox Stypox closed this as completed Feb 26, 2025
@Stypox Stypox reopened this Feb 26, 2025
@Stypox Stypox added enhancement New feature or request skill Skill request or bug labels Feb 26, 2025
@Stypox
Copy link
Owner

Stypox commented Feb 26, 2025

@Inhishonor sorry for the late reply. I think using an API is fine as an initial implementation, however it would be good if it supported multiple languages. The dictionary-files implementation could come as a community-maintained skill once there will be a way to install skills as plugins.

One issue I see with this skill is that the STT will not be able to understand a word in another language, so users will have to type it in manually.

To make the skill more powerful, you could compile a list of all possible language names and their variations (e.g. English, French, German, Italian, ...), so that the assistant is able to understand "what is the definition of ... in French".

@Inhishonor
Copy link
Contributor

I will work on this and see what I can do. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request skill Skill request or bug
Projects
None yet
Development

No branches or pull requests

3 participants