alpheios-project / mjm

Major + Middle Liddell
0 stars 0 forks source link

identify greek words in short defs #1

Open balmas opened 3 years ago

balmas commented 3 years ago

From #541

we should add <span lang="grc" data-alpheios-enabled="all"></span> around Greek words referenced in short definitions so that they can be activated properly for lookups.

The following script will do it:

#!/usr/bin/perl
use strict;
use Unicode::UTF8 qw[decode_utf8 encode_utf8];

while (<>) {
  chomp;
  my ($lemma,$def,$source) = split /\|/;
  $def = decode_utf8($def);
  $def =~ s/([\p{InGreekExtended}\p{InGreekAndCoptic}]+)/<span data-alpheios-enable="all" lang="grc">\1<\/span>\2/g;
  print join "|", ($lemma,encode_utf8($def),$source);
  print "\n";
}
balmas commented 3 years ago

testable now in the latest 3.3.x QA builds.

examples of words with greek in defs enabled for lookup:

ὠκύπος Τριτοπατρῆς βακχιάς

monzug commented 3 years ago

for ὠκύπος it shows again the same pop-up. in Chrome it takes some time lo load the lookup from the Greek word for ὠκύπος and βακχιάς

monzug commented 3 years ago

Actually I got the script error in FF with lookup of the greek word in morphology pop-up for βακχιάς

this issue is verified but the loading time is really long specially in Chrome/PC

balmas commented 3 years ago

@monzug that's with the first lookup, right? is it better after the first one?

monzug commented 3 years ago

@balmas actually it gets worse after tot lookups, that's why I got the script error in FF. I think the repetition of the same lookup (different short def) could be the cause

balmas commented 3 years ago

Oh,do you mean, after you switch short definition dictionaries?

monzug commented 3 years ago

nope, not for switching dictionaries. mostly by repeating the lookup of the Greek word and then the enabled lookup in short def. I did try again now in FF and did not get any script error. I'll close this one

balmas commented 3 years ago

hmm. ok. that's a little worrisome.

monzug commented 3 years ago

tested in safari too. all good. Safari App Extension 3.3.3 build qa.20210113593 Alpheios Components 3.3.3-qa.20210113579