Code Monkey home page Code Monkey logo

Comments (10)

codelucas avatar codelucas commented on July 20, 2024

Tonight the docs will go through a huge overhaul, a ton of stuff is missing including what you mentioned above. Thanks.

from newspaper.

codelucas avatar codelucas commented on July 20, 2024

The tutorial to do so is now up on this link:
http://newspaper.readthedocs.org/en/latest/user_guide/advanced.html#adding-new-languages

from newspaper.

mushfiq avatar mushfiq commented on July 20, 2024

The language I want to add is a non latin language, do you have idea when you are going to update the docs regarding the non latin language support?
Thanks in advance.

from newspaper.

codelucas avatar codelucas commented on July 20, 2024

Which language if you don't mind me asking? I'll update it when school clears up, maybe 1-2 weeks.

from newspaper.

mushfiq avatar mushfiq commented on July 20, 2024

@codelucas language code is "BD".

from newspaper.

codelucas avatar codelucas commented on July 20, 2024

Re-opened

from newspaper.

Wooobee avatar Wooobee commented on July 20, 2024

Hi I am also interested in new non-latin languages. I like to ad a bunch of indien languages. Really appreciate your work!

from newspaper.

kBashar avatar kBashar commented on July 20, 2024

And i'm interested very much in Bangla. Is there any way to have support or make supportable in Bangla.
Sent using CloudMagic
On Fri, Feb 14, 2014 at 2:28 AM, Wooobee [email protected] wrote:Hi I am also interested in new non-latin languages. I like to ad a bunch of indien languages. Really appreciate your work!

β€”Reply to this email directly or view it on GitHub.

from newspaper.

codelucas avatar codelucas commented on July 20, 2024

Thanks for all of this enthusiasm to add more! Here is what I know so far (more will be added to this thread, and later to the docs):

First, please reference this file and read from the highlighted line all the way down to the end of the file.

https://github.com/codelucas/newspaper/blob/master/newspaper/text.py#L57

One aspect of our text extraction algorithm revolves around counting the number of stopwords present in a text. Stopwords are: some of the most common, short function words, such as the, is, at, which, and on in a language.

Reference this line to see it in action:
https://github.com/codelucas/newspaper/blob/master/newspaper/extractors.py#L669

So for latin languages, it is pretty basic. We first provide a list of stopwords in stopwords-<language-code>.txt form. We then take some input text and tokenize it into words by splitting the white space. After that we perform some bookkeeping and then proceed to count the number of stopwords present.

For non-latin languages, as you may have noticed in the code above, we need to tokenize the words in a different way, splitting by whitespace simply won't work for languages like Chinese or Arabic. For the Chinese language we are using a whole new open source library called jieba to split the text into words. For arabic we are using a special nltk tokenizer to do the same job.

So, to add full text extraction to a new (non-latin) language, we need:
1.) Push up a stopwords file in the format of stopwords-<2-char-language-code>.txt in newspaper/resources/text/.
2.) Provide a way of splitting/tokenizing text in that foreign language into words. Here are some examples for Chinese, Arabic, English:

For latin languages:
1.) Push up a stopwords file in the format of stopwords-<2-char-language-code>.txt in newspaper/resources/text/. and we are done!

from newspaper.

codelucas avatar codelucas commented on July 20, 2024

Guide on adding new languages:
http://newspaper.readthedocs.org/en/latest/user_guide/advanced.html#adding-new-languages

from newspaper.

Related Issues (20)

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.