HanziGraph icon indicating copy to clipboard operation
HanziGraph copied to clipboard

Question: how do user provided sources work?

Open tilusnet opened this issue 3 months ago • 5 comments

Hi,

I noticed in the code that there's provision for "user sources" at https://github.com/mreichhoff/HanziGraph/blob/main/public/js/modules/explore.js#L27

Is this for examples that users can provide, alongside the Tatoeba and the AI generated ones?

tilusnet avatar Sep 16 '25 17:09 tilusnet

thanks for the question! For signed in users with the AI permission (an allowlist model for now), when the user types in some Chinese or English text, or uploads a PDF or other image, the text is shown as an individual sentence (or sentences in the image analysis case), with an explanation. I've given you that permission so you can try it out...you should see some new options in the menu and when clicking on the text box.

Here's a basic example (note that the Chinese text is user-entered, the AI part is just for translating and explaining...I should maybe even switch to a more basic translation API):

Image

mreichhoff avatar Sep 17 '25 00:09 mreichhoff

Ah this is really cool! Thank for you enabling the feature. Some sentence grammar understanding can be problematic. AI's explanation is very welcome there, so I'd argue your current implementation it's far more useful as it is, compared to a would be simpler "Google Translate" style service.

Two extra features come to mind on the side of what you have here:

  1. When clicking on a word, the example sentence list could also include user's sentences, not only Ai/Tatoeba. In your example 喜欢 could also display your example sentence. Added perk: being able to filter example sentence categories by source, and/or set that in the options!
  2. Similar to my "filtered vocabulary" idea #106, a provision for uploading user defined example sentences would be great. These would show up in the sentence examples list alongside the pre-provided ones.

tilusnet avatar Sep 17 '25 08:09 tilusnet

yes, both those make a lot of sense, as would making clearer when the user has made a flashcard from the sentence (currently it just shows up when clicking the three dot menu). I would probably try to avoid the user sharing their sentences with others though, just to prevent any potential unwanted/low quality/offensive user-entered sentences from affecting many people

mreichhoff avatar Sep 18 '25 00:09 mreichhoff

I totally agree, user uploaded examples should stay under the user's account. And if signed out, perhaps they could also be looked up from disk (like with pre provided sentences.json) - useful for custom local runs where user management might not be necessary.

tilusnet avatar Sep 18 '25 08:09 tilusnet

Related #114

tilusnet avatar Oct 26 '25 09:10 tilusnet