8000 Notify users when they got the corrected result · Issue #104 · zdict/zdict · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Notify users when they got the corrected result #104

Open
pi314 opened this issue Sep 12, 2016 · 8 comments
Open

Notify users when they got the corrected result #104

pi314 opened this issue Sep 12, 2016 · 8 comments
Labels

Comments

@pi314
Copy link
Collaborator
pi314 commented Sep 12, 2016

Yahoo dict "guesses" your input, and gives you auto-corrected result.

For example, if you query recurrance, yahoo dict gives you the result of recurrence. But actually the input is wrong, we should at least notify the user about this.

@pi314 pi314 added the bug label Sep 12, 2016
@fkztw
Copy link
Member
fkztw commented Sep 12, 2016

Uh... I don't think it's a bug.
Sure you can notify the users about the difference between the word they queried and the corrected result for a better UX, but still, I don't think it's a bug.
And for better UX, we shall not reject wrong query result (I think you mean that Yahoo Dict should return "Not Found" when user queried a wrong word? If it's what you think, I don't think it's a good idea.)

For me, I will notice that I just queried a wrong word after got the corrected result and really happy about that Yahoo dict has this feature.

So, I think this issue should rename from "reject wrong query result" to "Notify users when they got the corrected result." and use the feature label instead of the bug label.

@pi314 pi314 added UX and removed bug labels Sep 12, 2016
pi314 changed the title reject wrong query result Notify users when they got the corrected result Sep 12, 2016
@pi314
Copy link
Collaborator Author
pi314 commented Sep 12, 2016

@M157q you are right.

Does it possible for zdict to not save the result into database if it is corrected?

@fkztw
Copy link
Member
fkztw commented Sep 12, 2016

@pi314 I think you mean "Don't save the result (of corrected word) with wrong word into database"?
Sure it is possible, but the reason why I chose to save it is all for cache.

If we have to check the word which queried by the user is wrong, we have to wait for the result from the server and compare them. This makes cache almost impossible.

I had thought about storing a list of words (contains correct word and words which will be auto-corrected) mapping with the result, then we can use the list for caching. (Uh... like foreign key in database.)
But I thought it's too complicated for the current database schema. This is the reason why I chose to save the wrong word with result of corrected word into database.

How do you think? Any solution for this situation would be really appreciate.

@pi314
Copy link
Collaborator Author
pi314 commented Sep 13, 2016

@M157q Maybe we can write both ("recurrance", ":autocorrect:recurrence") and ("recurrence", <result>) into database? (:autocorrect: is just an example, JSON format is ok)

@pi314
Copy link
Collaborator Author
pi314 commented Nov 25, 2016

Discussed with @iblis17 several days ago, he thought this issue can be solved with foreign key

@pi314
Copy link
Collaborator Author
pi314 commented Nov 25, 2016

Tried self-referential foreign key: http://docs.peewee-orm.com/en/latest/peewee/models.html#self-referential-foreign-keys, but it needs table schema change.

@pi314
Copy link
Collaborator Author
pi314 commented Jan 17, 2017

[info update][planning]
Create a new table Correction with these fields

  • word - string
  • source - string
  • target - foreign key to Record table

This table only contains words that are corrected by online dictionaries.

If I query aple and Yahoo dict gives me apple, zdict should:

  1. If disable-db-cache option is disabled

    1. Check if aple is in table Correction. If yes, query Record with corrected word and return.
    2. Check if aple is in table Record. If yes, query Record and return.
  2. Query Yahoo dict

  3. Check if the word is corrected

    1. Store apple and its content into table Record
    2. Store (aple, apple) into table Correction
    3. Check if aple is in Record. If yes, delete it.

@pi314
Copy link
Collaborator 6C62 Author
pi314 commented Jan 22, 2017

I encountered two problems:

  1. My peewee cannot create Record and Correction tables, it always stuck by AttributeError: 'CompositeKey' object has no attribute 'get_db_field', even after I removed CompositeKey in Correction model
  2. Even if I created necessary tables by hand, newly created Correction record cannot be saved into database, it is stuck by AttributeError: 'CompositeKey' object has no attribute 'db_value'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0