Git Product home page Git Product logo

lwt's People

Contributors

andreask7 avatar chaosarium avatar darkone23 avatar dependabot[bot] avatar dhassanali avatar hangug-eo avatar heliozoa avatar hugofara avatar jzohrab avatar pirtleshell avatar programcomputer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lwt's Issues

Tests should not use sentences with unknown words

Description

I imported a long text and started working through terms. When it came to testing, the test routine used sentences with many unknown words, which was confusing. We should limit the tests to only use sentences where all words are at least status <> unknown.

Video in the /media folder don't show up in the "or choose a file in" dropdown menu

Is your feature request related to a problem? Please describe.
When trying to add videos that are in the /media folder, users have to type in the path manually

Describe the solution you'd like
Detect videos in the /media folder and list them in the "choose a file in" menu

Describe alternatives you've considered
Have a separate folder for videos?

Mecab does not work when text have space

Describe the bug
when Japanese text has space in between word, mecab won't parse correctly.
To Reproduce

  1. add Japanese with mecab
  2. add some japanese text with space for ex "新 し い 物語 が"
  3. mecab parse not correctly

Expected behavior
mecab should parse correctly

Screenshots
image

Additional context
Remove spaces manually does fix it. So I suspect text got inserted into mecab before space is removed. This problem is probably not a priority, since preprocessing text with a website like this [[https://onlinetexttools.com/remove-all-whitespace-from-text]] can fix it.

LOAD DATA LOAD FILE on webserver

Describe the bug
After uploading lwt to webhoster the save/save and open/check text functionalities return an error.

Fatal Error in SQL Query: LOAD DATA LOCAL INFILE '/storage/ssd2/332/18504332/tmp/tmpti.txt' INTO TABLE temptextitems FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' (@w,@c) set TiSeID = @b, TiCount = (@d:=@d+CHAR_LENGTH(@c))+1-CHAR_LENGTH(@c), TiOrder = if(@c like "%\r",case when (@c:=REPLACE(@c,"\r","")) is NULL then NULL when (@b:=@b+1) is NULL then NULL when @d:= @e is NULL then NULL else @a:=@a+1 end, @a:=@a+1), TiText = @c,TiWordCount=@w

Error Code & Message: [1047] Unsupported 'LOAD DATA LOCAL INFILE' command

Backtrace:

#0  do_mysqli_query(LOAD DATA LOCAL INFILE '/storage/ssd2/332/18504332/tmp/tmpti.txt' INTO TABLE temptextitems FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' (@w,@c) set TiSeID = @b, TiCount = (@d:=@d+CHAR_LENGTH(@c))+1-CHAR_LENGTH(@c), TiOrder = if(@c like "%\r",case when (@c:=REPLACE(@c,"\r","")) is NULL then NULL when (@b:=@b+1) is NULL then NULL when @d:= @e is NULL then NULL else @a:=@a+1 end, @a:=@a+1), TiText = @c,TiWordCount=@w) called at [/storage/ssd2/332/18504332/public_html/inc/database_connect.php:764]
#1  splitCheckText(test text upload, 1, 10) called at [/storage/ssd2/332/18504332/public_html/edit_texts.php:346]

Expected behavior
Page with added text available, ready to read.

Desktop:

  • OS: Windows 7 SP1
  • Browser: Chrome 98.0.4758.102
  • PHP Version: 8.0.7
  • MySQL Version: 10.5.12-MariaDB

Additional context
It worked with original lwt version (same hoster, same setting up proces). After opening text after this error, text doesn't appear (blank space in place of text/dictionaries).
After installing the LWT demo database there's an error as well

*** Error: Demo Database NOT restored - 418 queries - 23 successful (17/0 tables dropped/created, 0 records added), 395 failed. ***

Again it seems like texts don't upload. Languages and audio files do.

Smart text import

Reducing time-on-task to import a text
Usually, imported texts come from the net. When your are on the import page you have to

  1. Go to the original text tab and copy it.
  2. Go to the LWT tab and paste the text in the text area.
  3. Go to the text tab, copy the title.
  4. Paste the title to LWT
  5. Eventually, copy the source URL
  6. Paste it on LWT

That's a lot of steps for the most basic option of LWT. The issue is more or less the same with texts imported from local files.

Smart text import
For texts imported from the net, here is my suggestion:

  1. Put the Source URI field at the top.
    • With a correct URL inside, download the web content.
  2. Complete fields automatically.

Add a local file import button
We can import texts from local files with the long text import option, but this option is not in the standard text import.

Use the news feed mechanics?
The news feed import settings offer to click on the useful part of a web page, it can be useful here.

Unclear path for Mobile_Detect.php

Describe the bug
Reading a text might result in this error:

[Mon Jan 10 17:40:52 2022] PHP 7.4.12 Development Server (http://localhost:9004) started
[Mon Jan 10 17:40:54 2022] [::1]:53495 Accepted
[Mon Jan 10 17:40:54 2022] [::1]:53495 [500]: GET /do_text.php?start=1 - require_once(): Failed opening required 'vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php' (include_path='.:/Applications/MAMP/bin/php/php7.4.12/lib/php') in /Users/username/vendor/hugofara/lwt/do_text.php on line 15
[Mon Jan 10 17:40:54 2022] [::1]:53495 Closing

To Reproduce
(I'm not sure if this is the proper way to set up lwt. But since MAMP doesn't come with composer, I followed this guide and put composer.phar in ~/

  1. composer require hugofara/lwt
  2. Start PHP development server from VSCode. Everything seems to work fine until making a request to do_text.php or do_test.php
  3. Read a text, which results in a blank web page

Expected behavior
lwt automatically finds the right Mobile_Detect.php.

Screenshots
Essentially blank web page:
image

Desktop (please complete the following information):

  • OS: MacOS 12.0.1
  • Browser: Safari
  • PHP 7.4.12
  • MySQL 5.7.32

Additional context
Specifying the absolute path to Mobile_Detect.php fixes the issue, but I'm sure this isn't the most elegant solution.

require_once '/Users/username/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php'; // (was 'vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php';)

Since composer installs both mobiledetect/mobiledetectlib and hugofara/lwt in vendor/, this also works

require_once '../../mobiledetect/mobiledetectlib/Mobile_Detect.php'; // (was 'vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php';)

DB connect error when use docker

Describe the bug
After I compile and run docker-compose file, I tried to connect to localhost:8010 but I got an error page saying DB connect error

To Reproduce
Steps to reproduce the behavior:

  1. run docker compose file
  2. go to localhost:8010
    Expected behavior
    lwt page should open
    Screenshots
    image

Desktop (please complete the following information):

  • OS: win10 and Ubuntu 20.0 (I tried both, they both have this error)
  • Browser chrome

Add sounds

Sounds are often a good way to make an application more lively.

Open source sounds are necessary, but that should not be a problem.

On edit_texts.php, selecting texts and then clicking "Test marked texts" goes to a blank page

For example:

image

in the dropdown, selecting "test marked texts" gives this:

image

Reason for this:

The code eventually does a header Location redirect to Location: do_test.php?selection=1, but it loses the session variable (eg in the PHP err log it says [07-Nov-2022 01:36:29 UTC] PHP Notice: Undefined variable: _SESSION ). This can happen with PHP redirects, apparently (ref https://stackoverflow.com/questions/17242346/php-session-lost-after-redirect).

I'll submit a fix.

"I know all" tries to import same word multiple times, resulting in unique key error.

Describe the bug

If a text contains the same word multiple times with different cases, "I know all" tries to import them all, resulting in a unique key error.

Backtrace:

Backtrace:

#0  do_mysqli_query(INSERT INTO words (
            WoLgID, WoText, WoTextLC, WoStatus, WoStatusChanged, WoTodayScore, WoTomorrowScore, WoRandom ) 
        VALUES( 9, 'Hola', 'hola', 99 , NOW(),  
       ... SNIP
        END), RAND() )) called at [/Applications/MAMP/htdocs/lwt/inc/database_connect.php:60]
... SNIP ...
#2  all_words_wellknown_process_word(99, Hola, hola, 9) called at [/Applications/MAMP/htdocs/lwt/all_words_wellknown.php:116]
#3  all_words_wellknown_main_loop(11, 99) called at [/Applications/MAMP/htdocs/lwt/all_words_wellknown.php:175]
#4  all_words_wellknown_content(11, 99) called at [/Applications/MAMP/htdocs/lwt/all_words_wellknown.php:195]
#5  all_words_wellknown_full(11, 99) called at [/Applications/MAMP/htdocs/lwt/all_words_wellknown.php:202]

Error:

Error Code & Message: [1062] Duplicate entry 'hola-9' for key 'WoTextLCLgID'

To Reproduce

  1. Create a new text, with the text "hola hola. Hola. HOLA. Hola hola.". The text is imported correctly.
  2. Click on "read text", then click "I know all".
  3. error message.

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • OS: mac
  • Browser: chrome
  • Version This is LWT Version 2.5.2-fork (September 27 2022)
Server Software | Apache/2.4.46
-- | --
PHP Version | 7.4.21
MySQL Version | 5.7.34

Server Software	[Apache/2.4.46](https://en.wikipedia.org/wiki/Apache_HTTP_Server)
[PHP](https://en.wikipedia.org/wiki/PHP) Version	7.4.21
[MySQL](https://en.wikipedia.org/wiki/MySQL) Version	5.7.34

Recursive span and laggy long text

To Reproduce
Using the same text, I got different-looking HTMLs in two different versions of LWT (2.2.0 and the original 1.6.31):

A long French text on 1.6.31 looks like this. Each word gets a span on its own.

normal spans

The same text on 2.2.0 looks like this, with spans inside the previous one, making a long chain.

nesting spans

Expected behavior
Long texts don't lag out

Desktop

  • OS: MacOS 12.0.1
  • Browser: Safari
  • PHP 7.4.12
  • MySQL 5.7.32

Website isn't responsive on mobile devices

Hi,
When I resize the window on the computer, the website respond very well. But on my phone, it's not responsive as when I resize window on the computer.

Here is the screenshot on computer.

And here is the screenshot on my phone.

Can't import texts

Extracted from #31

  1. If I try to import a long text (doesn't matter if I paste or select a txt file), when I select NEXT STEP: Check the texts I get an error message and as you can see, it doesn't seem to process the text, it returns Length: 0 Bytes, and two of the buttons here don't work (Cancel and Go Back), only the Create 1 text, which returns us to the UI problem.

Notice: Undefined index: TextTags in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\long_text_import.php on line 30
Warning: Invalid argument supplied for foreach() in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\long_text_import.php on line 67

2

1.1 After selecting Create 1 text, since it's null, I get

Fatal Error in SQL Query: insert into texts (TxLgID, TxTitle, TxText, TxAnnotatedText, TxAudioURI, TxSourceURI) values( 1, 'Mondaiji 2', NULL, '', NULL, NULL)
Error Code & Message: [1048] Column 'TxText' cannot be null

Backtrace:

#0  do_mysqli_query(insert into texts (TxLgID, TxTitle, TxText, TxAnnotatedText, TxAudioURI, TxSourceURI) values( 1, 'Mondaiji 2', NULL, '', NULL, NULL)) called at [C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\inc\database_connect.php:60]
#1  runsql(insert into texts (TxLgID, TxTitle, TxText, TxAnnotatedText, TxAudioURI, TxSourceURI) values( 1, 'Mondaiji 2', NULL, '', NULL, NULL), ) called at [C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\long_text_import.php:160]
  • The only way I can import a text is if paste it in New Text, it can't be through Long Text. Note that here the Check button more or less... works? However it graphically represents the line breaks and the line numbers. Is that intended?

3

  • I can also see that it returns a word list and non-word list which is cool and would that mean MeCab is working... ?
  • But since it doesn't parse, nor can I select it to parse manually, it doesn't save any new terms.

Desktop (please complete the following information):

  • Same setup as last time, except this time Chromium has another version
  • OS: Windows 11 21H2 and Windows 10 20H2
  • Browser: Chromium 101.0.4951.64
  • EasyPHPDevserver-17 PHP 7.1.3

Invalid default value for 'WoStatusChanged'

A bug originally signaled by @jzohrab on Discord.

When installing the default demo database, there is a possibility f it failing with a message ERROR 1067 (42000): Invalid default value for 'WoStatusChanged'. This is appends when NO_ZERO_DATE mode is disabled in MySQL configuration.

Since this mode is deprecated according to Server SQL Modes#NO_ZERO_DATE, a default date of 1970-01-01 00:00:01 should be enough.

"I know all errored"

Finally, I can set LWT up on my computer, it runs very smoothly except when I click the I know all button it returned an error.

Fatal Error in SQL Query: SELECT DISTINCT Ti2Text, Ti2TextLC FROM (textitems2 LEFT JOIN words ON (Ti2TextLC = WoTextLC) AND (Ti2LgID = WoLgID) ) WHERE Ti2IsNotWord = 0 AND WoID IS NULL AND Ti2WordCount = 1 AND Ti2TxID = 1 ORDER BY Ti2Order

Error Code & Message: [1054] Unknown column 'Ti2TextLC' in 'field list'

If anyone runs into LOCAL INFILE problem as I did. You should uncomment mysqli.allow_local_infile = On in server configuration rather than trying to find the file and uncomment it.

Originally posted by @nghiaphamtm in #25 (comment)

Get error when add text

When I tried to import text into my website but I got an error.

Fatal Error in SQL Query: LOAD DATA LOCAL INFILE '/tmp/tmpti.txt' INTO TABLE temptextitems FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' (@w,@c) set TiSeID = @b, TiCount = (@d:=@d+CHAR_LENGTH(@c))+1-CHAR_LENGTH(@c), TiOrder = if(@c like "%\r",case when (@c:=REPLACE(@c,"\r","")) is NULL then NULL when (@b:=@b+1) is NULL then NULL when @d:= @e is NULL then NULL else @a:=@a+1 end, @a:=@a+1), TiText = @c,TiWordCount=@w

Error Code & Message: [1148] The used command is not allowed with this MariaDB version

image

I don't know how to fix this, My SQL version is 10.3.28-MariaDB-cll-lve and PHP version is 8.0.3

Can you tell me how to fix this? Thank you very much.

multi-phrase with space not working properly

Describe the bug
The new update work great for Japanese, when there is no space between phrase. But when I try to use it for English, the new phrase does not show up in different colors. I suspect this is because the English multiphase has space in between, while the Japanese one doesn't.

To Reproduce

  1. add the English language with the default setting
  2. add English text
  3. select multiple words and add a phrase
  4. color does not show up
    Expected behavior
    color should show up for the multi-word phrase.

Desktop (please complete the following information):

  • OS: Linux arm
  • Browser edge

Broken UI, can't import or parse long texts on 2.4.0

Hi!
I've been testing (or trying to) test the new version as soon as I saw the 2.4.0 release and I got the time. Well, here are my findings.

First problem: UI

  • There are a lot of UI buttons that aren't functional, in special the ones from the dropdown.
  • Also, you can see that after clicking on the checkbox to select the text and parse it, delete and et cetera, the dropdown to the right side of Marked text doesn't became enabled, as you can see at the image below

1

Second problem: text import

  • Well, here I am again, trying to parse my 日本語 sub :). You said at #23 that you got the parse working, but unfortunately I couldn't test it, because:
  1. If I try to import a long text (doesn't matter if I paste or select a txt file), when I select NEXT STEP: Check the texts I get an error message and as you can see, it doesn't seem to process the text, it returns Length: 0 Bytes, and two of the buttons here don't work (Cancel and Go Back), only the Create 1 text, which returns us to the UI problem.

Notice: Undefined index: TextTags in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\long_text_import.php on line 30
Warning: Invalid argument supplied for foreach() in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\long_text_import.php on line 67

2

1.1 After selecting Create 1 text, since it's null, I get

Fatal Error in SQL Query: insert into texts (TxLgID, TxTitle, TxText, TxAnnotatedText, TxAudioURI, TxSourceURI) values( 1, 'Mondaiji 2', NULL, '', NULL, NULL)
Error Code & Message: [1048] Column 'TxText' cannot be null

Backtrace:

#0  do_mysqli_query(insert into texts (TxLgID, TxTitle, TxText, TxAnnotatedText, TxAudioURI, TxSourceURI) values( 1, 'Mondaiji 2', NULL, '', NULL, NULL)) called at [C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\inc\database_connect.php:60]
#1  runsql(insert into texts (TxLgID, TxTitle, TxText, TxAnnotatedText, TxAudioURI, TxSourceURI) values( 1, 'Mondaiji 2', NULL, '', NULL, NULL), ) called at [C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\long_text_import.php:160]
  • The only way I can import a text is if paste it in New Text, it can't be through Long Text. Note that here the Check button more or less... works? However it graphically represents the line breaks and the line numbers. Is that intended?

3

  • I can also see that it returns a word list and non-word list which is cool and would that mean MeCab is working... ?
  • But since it doesn't parse, nor can I select it to parse manually, it doesn't save any new terms.

Third problem: text reading

  • When reading imported text, if I select I KNOW ALL, a message appears asking if I'm sure, even though I am, it doesn't save any terms.
  • If I click on any words, the sidebar to create a new term doesn't appear.
  • The buttons marked in red don't work.

4

Forth problem: the parsing per se

  • So before submitting the issue, I realised that I could go to My Languages section and parse from there. It returns some numbers, but I'm not really sure if it's doing anything because If I go the My Texts, there's still no words or any info whatsoever
  • This section still returns a notice
    Notice: Undefined variable: 0 in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\edit_languages.php on line 725

5

  • After clicking to parse, still no info about the text.

6

Desktop (please complete the following information):

  • Same setup as last time, except this time Chromium has another version
  • OS: Windows 11 21H2 and Windows 10 20H2
  • Browser: Chromium 101.0.4951.64
  • EasyPHPDevserver-17 PHP 7.1.3

Phew! That took a while to write. Sorry for the long text. In fact it isn't that long, the images make it so. Does the images throughout the text help or should they go to a separate section at the end of the post?
I also couldn't make the docker version work, but I'll reference that in another issue.

Suggestion: allow right lookup frames to always be visible (reduces screen chaos)

This may be a stylistic choice, but I find the current UI to be distracting/slowing when working with new texts. For example, given the following text window:

image

When I click on "puesto", the right frame obscures the text I'm working on, and the popup doesn't go away, hiding part of the right frame:

image

Then when I click save, the frame says "new term saved", but it still blocks the text, and remains present until I click the reading frame again:

image

If all of this occurred in an ever-present right frame, with the reading frame present, that would probably be a cleaner experience. It would result in the UI being a lot more like the original LWT ... I'm not sure that's a bad thing!

Other options/notes:

  • close the pop-up div when the right frame appears
  • auto-close the right frame when the term is saved, after a very short delay
  • instead of using the whole frame to show "new term saved", flash a short message in a very very small popup div
  • Perhaps don't even bother to show "new term saved" ... the reading pane is already updated with the word highlighted when it has been changed, which should be all the feedback the user needs!

DB backup and restore fails, bad exported file format (Mac, MAMP)

To Reproduce

  1. http://localhost:8888/lwt/backup_restore.php
  2. click "download lwt backup", file is created and downloaded (eg lwt-backup-exp_version-2022-11-02-19-28-54.sql.gz)
  3. on same page, "restore" section, choose that file, and click "restore from lwt backup"
  4. *** Error: Invalid Database Restore file (possibly not created by LWT backup) ***

If I try to gunzip the file, I get an error:

MacBook-Air-2:Downloads jeff$ gunzip lwt-backup-exp_version-2022-11-02-19-28-54.sql.gz
gunzip: lwt-backup-exp_version-2022-11-02-19-28-54.sql.gz: not in gzip format

setup:

Mac, MAMP

Web Server	localhost:8888
Server Software	Apache/2.4.46
PHP Version	7.4.21
MySQL Version	5.7.34
This is LWT Version 2.5.2-fork (September 27 2022)

Tested on master branch:

MacBook-Air-2:lwt jeff$ git log -n 1
commit 3c10d17115616a5dcba51e16c0d19501cbc550cb (HEAD -> master, upstream/master, upstream/HEAD, origin/master)

Database Easily Corrupted

Bug description
This bug apparently starts out-of-the blue. As far as I know, it can at least affect valid words and texts. Data can be altered in any way, from edition of a single cell to the deletion of entire line.

To Reproduce
Just a normal use of LWT. Precise conditions yet to determine.

I'm not sure how related it is, but bugs started to appear when texts went to archive automatically.

SQL injection from malformed URI could also be a cause.

Additional context
This is an important bug! As long as it not fixed, this fork stays a playground and is unsuitable for production!

Any help would be greatly appreciated!

UX suggestion: get rid of of overlib popup (and js library)

Summary

Currently, on word click, a small popup appears in the reading pane, but it also changes the right frame to open the edit window:

image

There's no need for both things -- he editing in the right frame is sufficient :-) -- and the popup clutters the screen.

Getting rid of this will also remove overlib.js, which is, as far as I know, really really old (even the home page of the project, http://www.bosrup.com/web/overlib/, gives a 404).

Where it's found

searching on my mac, and removing overlib itself (*in ./js/overlib/overlib) docs, and the minified js:

$ find . -name '*.*' -print0 | xargs -0 grep -l overlib 2>/dev/null
./inc/session_utility.php
./src/js/pgm.js
./src/js/jq_pgm.js
./src/js/user_interactions.js

./src/js/pgm.js has many overlib functions. The following files have only a few refs to overlib:

$ grep overlib inc/session_utility.php 
    <script type="text/javascript" src="js/overlib/overlib_mini.js" charset="utf-8"></script>

$ grep -i overlib ./src/js/jq_pgm.js
  run_overlib_test(
    run_overlib_status_unknown(
    run_overlib_status_99(
    run_overlib_status_98(
    run_overlib_status_1_to_5(
    run_overlib_multiword(WBLINK1, WBLINK2, WBLINK3, JQ_TOOLTIP ? make_tooltip($(this).text(), $(this).attr('data_trans'), $(this).attr('data_rom'), status) : $(this).attr('title'),

$ grep -i overlib ./src/js/user_interactions.js 
    window.setTimeout('overlib()', 10);

Phrase select broken?

In the original LWT version, one can select phrases by first clicking and holding on a word and dragging. This seems broken in the current version.

A screenshot of the drag and multiselect feature:

Capture d’écran 2022-02-27 à 17 59 11

Ukrainian voice issue

Describe the bug
Wrong Ukrainian voice when using text aloud

To Reproduce
I have the following configuration for Ukrainian

image

Expected behavior

It should read in Ukrainian. Right now I'm using google TTS which seems to work

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux
  • Browser: Chrome

Additional context
It reads the Cyrillic alphabet with an English like pronunciation. I notice that the uk code for Ukrainian is used.

Glad to help to solve this issue.

Right frame doesn't hide when clicking "I know this term well"

The code in insert_word_ignore.php implies that the right frame should disappear, which would be nice:

    window.parent.document.getElementById('frame-l').focus();
    window.parent.setTimeout('cClick()', 100);

A few things wrong with this:

overlib_mini.js:189 Uncaught TypeError: Cannot read properties of null (reading 'style')
    at hideObject (overlib_mini.js:189:27)
    at eval (eval at runHook (overlib_mini.js:309:48), <anonymous>:1:1)
    at runHook (overlib_mini.js:309:48)
    at cClick (overlib_mini.js:45:32)

Bigger buttons to switch between archived/active texts

"Archived Texts" buttons is small and hidden
It lays in a small corner after all the content.
image

Bigger interface is better
No reason for this button to be this small.

Additional
This button is quite useful since texts are auto-archived, with is another problem per se.

Multi-word terms occasionally don't highlight

This is quite odd -- in some places, mwords highlight, and in others, not. This persists after page refresh. For example:

image
...
image

Both of the circled terms are defined in the db:

mysql> select woid, wolgid, wotext, wotextlc, wowordcount from words where wotext like '%importancia%' or wotext like '%con el tiempo%';
+------+--------+-------------------------+-------------------------+-------------+
| woid | wolgid | wotext                  | wotextlc                | wowordcount |
+------+--------+-------------------------+-------------------------+-------------+
| 5023 |      1 | quitándole importancia  | quitándole importancia  |           2 |
| 5030 |      1 | Con el tiempo           | con el tiempo           |           3 |
+------+--------+-------------------------+-------------------------+-------------+
2 rows in set (0.01 sec)

If I click and drag on "quitándole importancia", the term actually shows up in the edit window, so the code can find it.

Not sure what other info to attach to this issue :-)

Reflecting number 1 in status charts

Capture d’écran 2022-02-07 à 21 55 50

log(1) is technically 0 so this is expected with a log scale. I wonder if anything needs to be done so that the number 1 is reflected on the chart.

I think I might want to look into this. Is there any way I can assign myself for this issue?

Suggestion: change database scripts

This suggestion will hopefully simplify database management for this project. In summary:

  • move database scripts to a new db folder. (This will help with future script creation, keeps root dir free)
  • commit the database script as unzipped file. Currently it's install_demo_db.sql.gz, but it doesn't need to be gzipped:
    • it's still quite small when unzipped, so it's not a space hog
    • git zips content when committing, so it doesn't save repo space
    • biggest reason: committing as plain text sql file allows for git diffing and inspection
  • separate schema creation from baseline data (per https://github.com/jzohrab/DbMigrator/blob/master/docs/managing_database_changes.md)

I have a few cycles free so will start working on this in a branch based off of this repo's dev branch.

Branch: https://github.com/jzohrab/lwt/tree/iss_54_change_db_scripts

LWT authentication via Wordpress failing

Describe the bug
Multi user setup via wordpress authentication fails with the following message:
'PHP message: PHP Fatal error: Cannot redeclare get_version() (previously declared in /usr/share/webapps/wordpress/lwt/inc/kernel_utility.php:28) in /usr/share/webapps/wordpress/lwt/inc/kernel_utility.php on line 28'

To Reproduce
Steps to reproduce the behavior:

  1. Setup Wordpress under wordpress.example.com
  2. Install LWT as a subfolder under Wordpress
  3. Fill in "connect_wordpress.inc.php" and rename to "connect.inc.php"
  4. Restart Webserver and when accessing wordpress.example.com/lwt a blank page is shown

Expected behavior
The wordpress login screen should display and after one has logged in the LWT site should be visible.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Arch Linux
  • Browser Chromium
  • Version 104.0.5112.101

Additional context
This originally worked before LWT was abandoned

"set all to known" doesn't seem to stick, and then creates problems when trying to create terms

1. New text: Create a new short text, all words unknown:

image

2. click: Click "set all to known"

image

3. Refresh page: refresh the page, and all words again appear as blue, with status = "unknown" in the popup.

image

4. Try to learn one of the words: click a word, and try to mark it as "learn", get error:

Fatal Error in SQL Query: INSERT INTO words ( WoLgID, WoText, WoTextLC, WoStatus, WoWordCount, WoStatusChanged, WoTodayScore, WoTomorrowScore, WoRandom ) values( 1, 'negro', 'negro', 99, 1, NOW(), ...[SNIP]..., RAND() )

Error Code & Message: [1062] Duplicate entry 'negro-1' for key 'WoTextLCLgID'

Currently running on 'dev' branch:

commit 956ffce285ea7452384079d8f79cf73b40a3b86e (HEAD -> dev, origin/dev)
Author: HugoFara <[email protected]>
Date:   Sun Oct 30 16:20:39 2022 +0900

    Fixed #46: I know all crashing on duplicate words.

Suggestion: add "canonical term" to words to show word "parents"

Rough description

I feel that a central idea that Lingq and LWT lack is the idea of "canonical term" for a word. Many words are just declensions of other words, and so it doesn't make sense to have to define the same idea several times. For example, if a text says "Yo tengo un gato" and "tú tienes un gato", "tengo" and "tienes" are both forms of "tener".

It would be great if words could be linked with canonical terms, and the canonical term info (translation, tags) were automatically "inherited" during display and filtering.

UX idea

(pardon the crappy picture)

image

Essentially, there would be a drop-down box, likely autofill, that would just show the existing words entries. If left blank, the word wouldn't have a canonical form. If a non-existing word was entered as the canonical form, a new "enter word" form would appear, just like the existing one. If an existing word was chosen, it would be used as the canonical form.

Implementation

Pre-requisite: No matter what, this implementation requires database changes, and so something like #54 should be implemented.

We could just add a new "word_parent" table: id, parentWoID, childWoID. I think this is better than changing the words table, b/c it will allow for import of existing backups that people might have.

etc etc. :-P

Unable to create/ignore a term longer than the parsed by MeCab

Extracted from #31

  • When reading imported text, if I select I KNOW ALL, a message appears asking if I'm sure, even though I am, it doesn't save any terms.
  • If I click on any words, the sidebar to create a new term doesn't appear.
  • The buttons marked in red don't work.

4

Desktop (please complete the following information):

  • Same setup as last time, except this time Chromium has another version
  • OS: Windows 11 21H2 and Windows 10 20H2
  • Browser: Chromium 101.0.4951.64
  • EasyPHPDevserver-17 PHP 7.1.3

Inconsistent word highlighting when same word appears in different texts.

Description

(let me know if this is user error!)

Text 1

I created a text and marked some words as known, some as learning. (I also clicked "I know all" at some point, which gave some bugs, so perhaps my db is somehow inconsistent and this is not a real issue):

image

Text 2

I then copied part of that text into a new text. Note that all of the words show up as known (except for those which are learning):

image

Expected behaviour

Text 2 should have shown the same highlights as Text 1 ... but again, there may be some problem with the database that I'm not sure about.

cheers! jz

Add userid to languages table, login screen to choose user, and possibly remove global $tbpref

Currently I believe that global $tbpref is used to allow for multiple users to use the same database, but that makes queries more complicated to write, and won't let devs use stored procedures or queries (which are easier to test).

If a user table is added, and the user specified on app startup (and stored in the session), the languages table could have a userId field added, which would keep all texts, words, and terms separate per user.

Mecab for Japanese can't parse texts

Hi!
I've tried to use LWT in the past but due to the lack of Japanese tokenization it just wasn't worth the trouble and since then I've been looking for an alternative. When I found this fork I and I saw that it had mecab support, I decided to try again, but haven't been able to read anything so far.

Describe the bug
After installing EasyPHP Devserver 17 and following the instructions here, then setting LWT to use mecab in RegExp Word Characters field, whenever I try to import a text I get an error.

Fatal Error in SQL Query: LOAD DATA LOCAL INFILE 'C:\\Users\\USER\\AppData\\Local\\Temp/tmpti.txt' INTO TABLE temptextitems2 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' (@c,@e,@f) SET TiSeID = if(@g=2 or (@f="7" and @c="EOS"), @s:=@s+(@d:=@h)+1,@s), TiCount = (@d:=@d+CHAR_LENGTH(@c))+1-CHAR_LENGTH(@c), TiOrder = if( CASE WHEN @f = '7' THEN IF(@c="EOS",(@g:=2) AND (@c:="¶"), @g:=2) WHEN LOCATE(@e,'267') THEN @g:=@h ELSE @g:=1 END IS null, null, @a:=@a+IF((@i=1) AND (@g=1), 0, 1)+IF((@i=0) AND (@g=0), 1, 0)), TiText = @c, TiWordCount= CASE WHEN (@i:=@g) IS NULL THEN NULL WHEN @g=0 THEN 1 ELSE 0 END

Error Code & Message: [7890] Can't find file 'C:\Users\USER\AppData\Local\Temp/tmpti.txt'.

To Reproduce
Steps to reproduce the behaviour:

  1. Import a Japanese text and set the language accordingly, doesn't matter if you upload or paste it
  2. Get an error

Expected behaviour

  1. Get a message saying that the import was done and be able to read the imported text as a result.

Screenshots
Language configuration
chrome_adQcMWNHus

Desktop (please complete the following information):

  • OS: Windows 11 21H2 and Windows 10 20H2
  • Browser: Chromium 97.0.4692.71
  • EasyPHPDevserver-17 PHP 7.1.3
  • XAMPP (didn't work either)

Additional context
I've noticed that if I create the above file tmpti.txt, LWT removes the file and returns the same error message. Perhaps it has something to do with backslashes on windows? Shouldn't the path be C:\Users\USER\AppData\Local\Temp\tmpti.txt instead of C:\Users\USER\AppData\Local\Temp/tmpti.txt ? Well, I don't know any PHP, so... :P
I tried a while ago to make it work on my Arch machine but I couldn't make it connect to the database so I gave up.
I'm also uploading the Backtrace
Backtrace.txt

Question on WordPress integration for @Redmattski

Hi @Redmattski - I saw issue #41 that you had opened, hopefully you will see this open issue and will reply. (You don't have a fork of this repo, otherwise I would have pinged you there.)

I was curious how you were using LWT and Wordpress together. I've been hacking on LWT a bit and there are some things about the integration with WP that make LWT development more difficult than it needs to be. If we can remove the WordPress integration, we might be able simplify a few things in this project and make it easier to work with.

Can you let me know how you're using both of these things? Do you have multiple people using the same LWT database, or is it just you?

Cheers, jz

AJAX files use wrong path

Describe the bug
Before v2.0.4-fork, AJAX files were in the root folder. Since then, they were transferred in the inc/ folder. Thus, some of them do not behave properly because they do not "know" that they should go in the parent folder to find files for instance.

Expected behavior
They should do something like chdir('..') before any operation.

Additional context
The AJAX files all start with ajax_. While this seems sensible, an even more sensible solution will be to move them in an ajax/ folder, and shorten their names. js files are not nammed js_something.js.

composer install gives error

Hi!

Great to see this project going again!

Describe the bug
Unable to install dependencies.

To Reproduce
I tried the installation instructions in readme by running composer install hugofara/lwt

That gave me the error Invalid argument hugofara/lwt. Use "composer require hugofara/lwt" instead to add packages to your composer.json., so I ran composer require hugofara/lwt and got this:

❯ composer require hugofara/lwt

Installation failed, deleting ./composer.json.

In RequireCommand.php line 210:

  No composer.json present in the current directory (./composer.json), this may be the cause of t
  he following exception.


In InitCommand.php line 907:

  Could not find a version of package hugofara/lwt matching your minimum-stability (stable). Requ
  ire it with an explicit version constraint allowing its desired stability.

Specifying version by running composer require hugofara/lwt:dev-master gives this:

❯ composer require hugofara/lwt:dev-master
./composer.json has been created
Running composer update hugofara/lwt
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires hugofara/lwt dev-master -> satisfiable by hugofara/lwt[dev-master].
    - hugofara/lwt dev-master requires aehlke/tag-it ^2.0 -> could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, deleting ./composer.json.

Switching to the dev-dev version and testing on Linux result in the same error

Expected behavior
composer install hugofara/lwt simply works

Desktop:
PHP version: tested on both 7.4.3 on Ubuntu 20.04.3 with Firefox and 7.4.12 on MacOS 12.0.1 with Safari and Vivaldi
Composer version: 2.2.3 on Ubuntu 20.04.3 with Firefox and 2.3-dev on MacOS 12.0.1 with Safari and Vivaldi

Unfortunately, I know little about PHP and couldn't figure out how to resolve the issue. But I'm really looking forward to seeing the future of this project!

Can't parse japanese text properly

Extracted from #31

  • So before submitting the issue, I realised that I could go to My Languages section and parse from there. It returns some numbers, but I'm not really sure if it's doing anything because If I go the My Texts, there's still no words or any info whatsoever
  • This section still returns a notice
    Notice: Undefined variable: 0 in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\lwt\edit_languages.php on line 725

5

  • After clicking to parse, still no info about the text.

6

Desktop (please complete the following information):

  • Same setup as last time, except this time Chromium has another version
  • OS: Windows 11 21H2 and Windows 10 20H2
  • Browser: Chromium 101.0.4951.64
  • EasyPHPDevserver-17 PHP 7.1.3

hosted server - read page not showing anyhting

Describe the bug
The text does not show after i click read when lwt is installed on a hosted website server... (Original sourceforge installation works fine)
I have reinstalled and reloaded at least 5 times no luck
The import had some errors but all text files seem to be there.

To Reproduce
Click read
Nothing shows

Expected behavior
click read
see text

Screenshots
image

image

Desktop (please complete the following information):

  • OS: windows 11,
  • Browser chrome and firefox

Chrome Text-to-speech

Automatic text-to-speech not working in Chrome
When using automatic text to speech, Chrome doesn't emit sound, without raising any error.

Tag breaks text modification

Description and reproduction

I imported the LWT database from my previous version of LWT, edit a text, click "changed and open", and got this error. I suspect this is some sort of database issue.

Fatal Error in SQL Query: insert into tags2 (T2Text) values('poem')

Error Code & Message: [1062] Duplicate entry 'poem' for key 'T2Text'

Backtrace:

#0  do_mysqli_query(insert into tags2 (T2Text) values('poem')) called at [/(omitted)/hugofara-lwt/inc/database_connect.php:59]
#1  runsql(insert into tags2 (T2Text) values('poem'), ) called at [(omitted)/hugofara-lwt/inc/session_utility.php:277]
#2  saveTextTags(88) called at [(omitted)/hugofara-lwt/edit_texts.php:332]

Currently, I need to remove existing tags in order to make changes to texts. Creating new tags and saving change seems to work without causing any issue, but editing and saving again without changing tags causes the same issue again. Term tags don't seem to have this issue though.

Expected behavior
Tags don't cause a problem when making changes to texts

Desktop
OS: MacOS 12.0.1
Browser: Safari
PHP 7.4.12
MySQL 5.7.32

Google translate fails for whole sentence, but succeeds for a phrase with the exact same terms.

For me, google translate sentence always fails the first time the window opens, eg.:

image

I have to click the "retry" button, at which point the translation works.

Interestingly, when I create a multi-word phrase that is the same as the sentence (excluding the punctuation), the translation succeeds:

image

(I've tried it with phrases that have punctuation, and the translation still succeeds.

This is on a Mac, Spanish language. There's something different about how the translation is called for a phrase, vs a full sentence.

Broken UI

Extracted from #31

UI problems

  • There are a lot of UI buttons that aren't functional, in special the ones from the dropdown.
  • Also, you can see that after clicking on the checkbox to select the text and parse it, delete and et cetera, the dropdown to the right side of Marked text doesn't became enabled, as you can see at the image below

1

Desktop (please complete the following information):

  • Same setup as last time, except this time Chromium has another version
  • OS: Windows 11 21H2 and Windows 10 20H2
  • Browser: Chromium 101.0.4951.64
  • EasyPHPDevserver-17 PHP 7.1.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.