livecode and *Readability.js* (='.'=)

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: heatherlaine, Klaus, FourthWorld, kevinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5890
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: livecode and *Readability.js* (='.'=)

Post by FourthWorld » Fri Apr 06, 2018 7:31 am

If it can be done in another scripting language it can be done in LiveCode. It shouldn't be necessary to hook into a second language interpreter for a single task like this. LiveCode is very good at parsing strings, in some ways better than JavaScript.

We don't even need to translate the code per se. How we solve parsing problems in LC is often different than how other languages solve them.

All we need is someone with enough familiarity with JS and LC who also has some time on there hands and we'd have an LC-native library.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Mariasole
Posts: 194
Joined: Tue May 07, 2013 9:38 pm

Re: livecode and *Readability.js* (='.'=)

Post by Mariasole » Tue Apr 10, 2018 10:03 am

Thanks Bogs and thanks Richard!
I believe we are going in the right direction. :D
If it can be done in another scripting language it can be done in LiveCode.
--> Richard
still working on the .js angle myself, I didn't forget
--> Bogs

We have to analyze the original algorithm of Readability, understand it and "translate it" into LiveCode.

For what Richard said
All we need is someone with enough familiarity with JS and LC who also has some time on there hands and we'd have an LC-native library.
the ancient Romans had a specific verb to translate a concept from one language to another: "vertere".

That is, using different words proper to one's own language (in this case Latin) to translate a concept of another language (perhaps Greek). Replace Latin with LiveCode and Greek with Javascript and you're done!
The fact is that I do not know anything about Greek! :shock: :wink:
(But with patience and with the highlighter I'm trying to find in the Readability js code a schema .... 8) )

Thanks to you for keeping this thread alive!

Mariasole
(='.'=)
Proud to learn with Live Code Community Edition
I appreciate the "free as in freedom" (courtesy of Richard Gaskin)
We the Beginners is the opening phrase of the Preamble to the LiveCode Community Edition Constitution

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2362
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: livecode and *Readability.js* (='.'=)

Post by richmond62 » Tue Apr 10, 2018 11:02 am

Almost EVERYTHING can be done with LiveCode . . .

. . . the questions are:

1. How long and complicated do you want your code to be when it
might be possible to do the same thing in another programming environment
more suited for that task?

2. How much time and effort are you prepared to invest in working out
how to do "everything"?

Et nous avons un petit problem avec les conceptions 'version' et 'traduction'; ne c'est pas?

Stripping text out of HTML documents is very, very easy in LiveCode:

http://forums.livecode.com/viewtopic.php?f=7&t=30870

Mariasole
Posts: 194
Joined: Tue May 07, 2013 9:38 pm

Re: livecode and *Readability.js* (='.'=)

Post by Mariasole » Wed Apr 11, 2018 5:20 pm

Monsieur!
Le courage croît en osant et la peur en hésitant. :wink:

Mariasole
(='.'=)
Proud to learn with Live Code Community Edition
I appreciate the "free as in freedom" (courtesy of Richard Gaskin)
We the Beginners is the opening phrase of the Preamble to the LiveCode Community Edition Constitution

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2362
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: livecode and *Readability.js* (='.'=)

Post by richmond62 » Wed Apr 11, 2018 6:23 pm

Oh, aye, an Ahm nae wasnae that glaikit, forbye, syne Ah wis learnt til program.

bogs
Posts: 1722
Joined: Sat Feb 25, 2017 10:45 pm

Re: livecode and *Readability.js* (='.'=)

Post by bogs » Tue Apr 24, 2018 7:57 pm

Hi Mariasole,

Sorry to say this, but I think I will not be able to figure out a solution to what your looking to get done for a couple of reasons, the primary one being that even the readability tool itself works on such a limited number of the sites and pages created these days.

I was testing this out myself by forcing readability to attempt pages where it doesn't show up normally by prefixing the site address with

Code: Select all

about:reader?url=
in the address bar. I tested on a number of sites like Lc, PcMag, Cnet, etc. In all those cases because of the way sites are designed today, Readability failed to send back anything useful.

Where it did work was on sites where base HTML, or at most HTML and CSS, were used to format the page, something Lc already does with default statements pretty well and you can just filter scripting statements. Unfortunately perhaps, sites made this way appear now to be in the extreme minority :roll:
Selection_006.png
Selection_005.png
Selection_004.png
After a whole lot of searching,
Image
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2362
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: livecode and *Readability.js* (='.'=)

Post by richmond62 » Tue Apr 24, 2018 8:40 pm

That is, using different words proper to one's own language (in this case Latin) to translate a concept of another language (perhaps Greek).
I'm not sure how far you can stretch this analogy:

after all, between languages only very naive people (well, and Google "translate") think they can translate words and sentences . . .

. . . nothing like reading a string of words with the syntax of a different language . . .

. . . people who know what they are doing translate ideas and semantics.

As computer languages are effectively meaning-free (computers DON'T think), one can translate words and sentences, making the whole enterprise considerably easier than translating between 2 languages.

bogs
Posts: 1722
Joined: Sat Feb 25, 2017 10:45 pm

Re: livecode and *Readability.js* (='.'=)

Post by bogs » Tue Apr 24, 2018 8:59 pm

Um...huh? :shock:
Image

danielrr
Posts: 97
Joined: Mon Mar 04, 2013 4:03 pm

Re: livecode and JAVA boilerpipe (='.'=)

Post by danielrr » Tue May 01, 2018 9:14 am

bogs wrote:
Tue Mar 13, 2018 10:06 pm
Uh! pretty impressive! thanks

Mariasole
Posts: 194
Joined: Tue May 07, 2013 9:38 pm

Re: livecode and *Readability.js* (='.'=)

Post by Mariasole » Wed May 02, 2018 9:49 am

Really thank you Bogs for your availability! :D
In fact, Readability.js is built to extract only news articles, but some sites block this javascript (which obviously destroys the original layout). I am continuing to study the script, making a parallelism, like the Rosetta Stone, between Readability.js and Readability.php. Thank you so much Bogs for everything you did.


Thanks Richmond for giving your precious contribution!
Oh, aye, an Ahm nae wasnae that glaikit, forbye, syne Ah wis learnt til program.
I think it's Scottish, but it's not nice to post phrases that are very difficult to translate, I notice a bit of sarcasm, anyway. I can only answer you: brother peace! :D

As for the concept of "vertere"
the ancient Romans had a specific verb to translate a concept from one language to another: "vertere".
I think Andres Rey explained the concept of "vertere" between javascript with this sentence:

"Most of the code is a 1:1 copy –even the comments were imported– but some functions and structures were adapted to suit better the PHP language."

"but some functions and structures were adapted to suit better the PHP language" ----> vertere 8)

https://github.com/andreskrey/readability.php

Thank you all, really!
Mariasole
(='.'=)
Proud to learn with Live Code Community Edition
I appreciate the "free as in freedom" (courtesy of Richard Gaskin)
We the Beginners is the opening phrase of the Preamble to the LiveCode Community Edition Constitution

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2362
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: livecode and *Readability.js* (='.'=)

Post by richmond62 » Wed May 02, 2018 1:07 pm

it's not nice to post phrases that are very difficult to translate
Well, Mariasole, I jalouse you, as well as I, get tired of English from time to time, and, also, feel unable to express ourselves fully in that language. :D

It might not be 'nice' to always have to post messages in English.

And, I, for one, do not know why Scots is always taken as sarcastical by those who do not speak it.

Mariasole
Posts: 194
Joined: Tue May 07, 2013 9:38 pm

Re: livecode and *Readability.js* (='.'=)

Post by Mariasole » Wed May 02, 2018 2:56 pm

Ane leid is nivver eneuch... :D
Proud to learn with Live Code Community Edition
I appreciate the "free as in freedom" (courtesy of Richard Gaskin)
We the Beginners is the opening phrase of the Preamble to the LiveCode Community Edition Constitution

bogs
Posts: 1722
Joined: Sat Feb 25, 2017 10:45 pm

Re: livecode and *Readability.js* (='.'=)

Post by bogs » Wed May 02, 2018 3:38 pm

Mariasole wrote:
Wed May 02, 2018 9:49 am
I am continuing to study the script, making a parallelism, like the Rosetta Stone, between Readability.js and Readability.php.
That I am glad to hear, I am sure you will eventually solve the puzzle :D
Image

bogs
Posts: 1722
Joined: Sat Feb 25, 2017 10:45 pm

Re: livecode and JAVA boilerpipe (='.'=)

Post by bogs » Wed May 02, 2018 3:45 pm

danielrr wrote:
Tue May 01, 2018 9:14 am
bogs wrote:
Tue Mar 13, 2018 10:06 pm
Uh! pretty impressive! thanks
I never wrote that. Hmmm. :|
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”