scripts icon indicating copy to clipboard operation
scripts copied to clipboard

[F] Suggest words automatically

Open fabianski7 opened this issue 3 years ago • 5 comments

Script name

dictionary-autocomplete

Script authors

@pbek

Actual behaviour

I currently use this script to correct words using the CTRL+Space shortcut, but this becomes extremely repetitive when I am writing a large file.

Expected behaviour

My suggestion is to allow the script to run automatically (without having to use the keyboard shortcut) whenever a word starts to be typed.

This could be identified when a sequence of words is inserted. Ex.: When inserting three words together, the QON would activate the script and it will show the same suggestions as the shortcut CTRL+Space.

This behavior is quite similar to what we already have in Android.

fabianski7 avatar Jan 24 '21 15:01 fabianski7

I'm sorry, there is no scripting hook that would allow this and implementing a hook that triggers on every keypress and then implementing a script that searches a large dictionary on every keypress wouldn't be very performant...

pbek avatar Jan 24 '21 18:01 pbek

any other opinion, @Waqar144?

pbek avatar Jan 24 '21 18:01 pbek

  • if this were to be implemented, it needs to be configurable somehow otherwise it will just some annoy users and they will ask for it to be configurable.
  • and yes, to do this with good performance we will probably need to do it natively..

But the idea is good, and would be helpful to some users.

Also, we will need the user to specify some autocomplete dictionary so that we don't have to lookup all available dictionaries.

We can, however, leverage sonnet API to provide some automated guessing but that already (most of the times) uses the dictionary to guess the language so not sure if using sonnet with auto detection will be helpful.

Waqar144 avatar Jan 24 '21 18:01 Waqar144

seems a bit difficult 🥲

fabianski7 avatar Jan 24 '21 22:01 fabianski7

Well it is not that difficult. First of all, you don't have to implement the fullblown solution, that supports the complete dictionaries of several langauges... Because that is the point, when performance will go down.

In Notepad++ they have a very nice autocomplete function, that I like very much. It works just with the words in the current file and the words from a user definded dictionary. And well, thats already enough to safe you plenty of time while typing.

From the backend view, the function adds any word with two or more characters long to a list that is used for the autocomplete. And the user is able to configure the function, if it starts showing the autocompleting window starting from typed 2-5 letters. So a hook could be, a word is typed in with the number of letters -> Reaction, show the autocompletion box, and the user is able to insert the word.

I recommend to take a look at the solution how it is implemented in Notepad++ (preferably by trying it directly in Noetpad). Otherwise theres an article at their documentation about the feature.

https://npp-user-manual.org/docs/auto-completion/ https://sodocumentation.net/notepadplusplus/topic/4843/auto-completion-and-suggestion

notepad func

I would really appreciate it, if a similar funciton would be implemented in QOwnNotes. Because the currently way with Crtl+Space is for me not very useable. Especially because I don't know if the word I type is already in the autocomplete list or not, so at the moment its more an all the time pressing Ctrl+Space in contrast to a automatic working autocompletion.

Born2Root avatar Oct 14 '21 07:10 Born2Root

Hi,

Very interesting idea!

I think that many scripts would profit if the script API had access to an edit suggestions dropdown list (maybe using QCompleter? I found that here: How to accomplish drop down word suggestions in Qt?).

Beurt avatar Feb 07 '23 09:02 Beurt

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Apr 04 '23 15:04 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Apr 19 '23 02:04 github-actions[bot]