livecode and *Readability.js* (='.'=)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: livecode and *Readability.js* (='.'=)
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.
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
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: livecode and *Readability.js* (='.'=)
Thanks Bogs and thanks Richard!
I believe we are going in the right direction.
We have to analyze the original algorithm of Readability, understand it and "translate it" into LiveCode.
For what Richard said
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!
(But with patience and with the highlighter I'm trying to find in the Readability js code a schema .... )
Thanks to you for keeping this thread alive!
Mariasole
(='.'=)
I believe we are going in the right direction.
--> RichardIf it can be done in another scripting language it can be done in LiveCode.
--> Bogsstill working on the .js angle myself, I didn't forget
We have to analyze the original algorithm of Readability, understand it and "translate it" into LiveCode.
For what Richard said
the ancient Romans had a specific verb to translate a concept from one language to another: "vertere".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.
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!
(But with patience and with the highlighter I'm trying to find in the Readability js code a schema .... )
Thanks to you for keeping this thread alive!
Mariasole
(='.'=)
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: livecode and *Readability.js* (='.'=)
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
. . . 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
Re: livecode and *Readability.js* (='.'=)
Monsieur!
Le courage croît en osant et la peur en hésitant.
Mariasole
(='.'=)
Le courage croît en osant et la peur en hésitant.
Mariasole
(='.'=)
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: livecode and *Readability.js* (='.'=)
Oh, aye, an Ahm nae wasnae that glaikit, forbye, syne Ah wis learnt til program.
Re: livecode and *Readability.js* (='.'=)
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
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 After a whole lot of searching,
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=
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 After a whole lot of searching,
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: livecode and *Readability.js* (='.'=)
I'm not sure how far you can stretch this analogy:That is, using different words proper to one's own language (in this case Latin) to translate a concept of another language (perhaps Greek).
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.
Re: livecode and *Readability.js* (='.'=)
Really thank you Bogs for your availability!
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!
As for the concept of "vertere"
"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
https://github.com/andreskrey/readability.php
Thank you all, really!
Mariasole
(='.'=)
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!
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!Oh, aye, an Ahm nae wasnae that glaikit, forbye, syne Ah wis learnt til program.
As for the concept of "vertere"
I think Andres Rey explained the concept of "vertere" between javascript with this sentence:the ancient Romans had a specific verb to translate a concept from one language to another: "vertere".
"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
https://github.com/andreskrey/readability.php
Thank you all, really!
Mariasole
(='.'=)
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: livecode and *Readability.js* (='.'=)
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.it's not nice to post phrases that are very difficult to translate
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.
Re: livecode and *Readability.js* (='.'=)
Ane leid is nivver eneuch...
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator
Re: livecode and *Readability.js* (='.'=)
I am continuing undeterred in the experiments!
Unfortunately I ran aground on one thing, I think, simple ... maybe ...
How do I export the plain text of the browser widget to a field?
I tried with:
but nothing happens! [LC 8.1.9]
Thank you so much! In advance!
Mariasole
(='.'=)
Unfortunately I ran aground on one thing, I think, simple ... maybe ...
How do I export the plain text of the browser widget to a field?
I tried with:
Code: Select all
set the htmltext of widget "Browser" to field "PlainText"
Thank you so much! In advance!
Mariasole
(='.'=)
"I'm back" - The Cyberdyne Systems Model 101 Series 800 Terminator