lucaswerkmeister / tool-lexeme-forms

Wikidata tool to create lexemes with pre-populated forms (e. g. declensions or conjugations)
https://lexeme-forms.toolforge.org/
Other
11 stars 7 forks source link

Unable to create new lexeme without all forms if a homograph lexeme exists #44

Closed jhsoby closed 3 years ago

jhsoby commented 3 years ago

This is real "edge-case" stuff. :grin:

If a lexeme with the same lemma already exists, I am not able to create a new lexeme with the advanced form if the first representation is not present.

To reproduce:

  1. This Bokmål lexeme already exists, with the lemma "kopper": https://www.wikidata.org/wiki/Lexeme:L479740
  2. I want to create a new lexeme, which is a plurale tantum, so the first two fields need to be empty: https://lexeme-forms.toolforge.org/template/bokm%C3%A5l-noun-masculine/advanced/?form_representation=&form_representation=&form_representation=kopper&form_representation=koppene
  3. When trying to do so, there is a quick flash of the yellow "a lexeme with this lemma already exists" box (and the accompanying "yes, I'm sure" checkbox at the bottom), but they immediately disappear.
  4. Click "Create"
  5. Repeat ad infinitum
lucaswerkmeister commented 3 years ago

Hmmmpf… I’m not sure if creating lexemes with the first form missing is supposed to be supported at all, since we use that form for the lemma…

Can you try disabling JavaScript? Then the “a lexeme with this lemma already exists” box should stay and you should be able to click it – I’m curious if the backend code will do the right thing then. (If yes, it sounds like we only need a JS fix.)

jhsoby commented 3 years ago

Yes, it worked when I disabled Javascript: https://www.wikidata.org/w/index.php?title=Lexeme:L482893&action=history

lucaswerkmeister commented 3 years ago

Hah: f97fc25c67130fa4eb69657c13e28d4c81a450f9

Note that we only listen to changes on the first form representation, which is not necessarily the one that will end up as the lemma in advanced mode. I think that’s an acceptable limitation. (Server-side duplicate detection checks the actual lemma, so it should still work, just not as conveniently.)

Turns out I was aware of this limitation way back in 2018 ^^ still, let’s fix it.

lucaswerkmeister commented 3 years ago

(Well, the “just not as conveniently” isn’t quite right, due to how the script immediately removes the server-side “this is a duplicate, are you sure?” elements.)

lucaswerkmeister commented 3 years ago

Alright, should be fixed now :)

jhsoby commented 3 years ago

Awesome! Thank you :grin: