Skip to content

Added Japanese language support - #278

Closed
Newspad wants to merge 6 commits into
codelucas:masterfrom
Newspad:master
Closed

Added Japanese language support#278
Newspad wants to merge 6 commits into
codelucas:masterfrom
Newspad:master

Conversation

@Newspad

@Newspad Newspad commented Aug 5, 2016

Copy link
Copy Markdown

I've added Japanese language support and it works fine.
This change doesn't affect any other code.

@codelucas

Copy link
Copy Markdown
Owner

This looks great, I'm about to merge and accept but can you just add one unit test where 'ja' language works?

@Newspad

Newspad commented Aug 7, 2016

Copy link
Copy Markdown
Author

I've added a unit test for 'ja' language as you requested and replaced html.parser.HTMLParser with html.parser to avoid deprecated method warnings.
In addition, I've wrapped the test code in try-catch blocks because Travis can't run MeCab parser and rejects my code.

@technolingo

Copy link
Copy Markdown

Any progress on this front? Adding ja support would be great!

@technolingo

Copy link
Copy Markdown

@Newspad So Japanese text extraction is only supported on CentOS? If I don't use .nlp() method, can I use Japanese article extraction on heroku-powered projects?

@codelucas codelucas left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Newspad thanks for the great work on this 💯 sorry I've been busy and not been able to look for so long. I will take a look (and potentially add patch commits to your PR if there are merge conflicts.
cc @Evilplanet

No newline at end of file

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So many stopwords! 416? Does this seem right, I did some googling and found other Japanese stopwords files to be ~120 in length. e.g. https://github.com/stopwords-iso/stopwords-ja/blob/master/stopwords-ja.txt

@codelucas codelucas left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some more comments. @Newspad this is incredible work though, I'm surprised we don't have Japanese parsing actually as it's such a widely used language

Comment thread newspaper/text.py
words.append(word)
node = node.next
except Exception as e:
pass

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of pass and we please add exception logging in a pretty format saying Japanese stopwords extraction has failed. (in your experience does candidate_words have a high rate of failure? If not I'd even suggest no exception catching here.

Comment thread newspaper/text.py
words = []
try:
import MeCab
import os, subprocess

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a separate try/catch for these two import statements and print a pretty "you must install mecab .. etc" if it is not installed?

Comment thread README.rst
$ curl https://raw.githubusercontent.com/codelucas/newspaper/master/download_corpora.py | python3


**If you are on CentOS** and use Japanese language support, install using the following:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear if this means:

  1. Japanese language support works by default or all non-CentOS operating systems and you don't need to install
  2. Japanese language support works ONLY on CentOS, and if you are on CentOS install.

If 2) is true, I think this design is not ideal. A language support should be for all operating systems, not just one because a parse/tokenizing library is available only on that OS.

@vitaly-zdanevich

Copy link
Copy Markdown

For AWS Lambda anyway we will put all dependencies into deployment zip - so MeCab will be there too.

@asafcombo

Copy link
Copy Markdown

Hi Any updates on JP support ?
If this is not going to happen soon, should I use https://github.com/Newspad/newspaper instead ?

@technolingo

Copy link
Copy Markdown

@asafcombo The problem with Japanese support is you have to install MeCab, which is not easy feat. It really depends on your environment. You could take Newspad's code and make sure MeCab is installed on your server. Change the code where MeCab is called if necessary. (I use natto-py to call MeCab)

@joelhandwell joelhandwell mentioned this pull request Jul 20, 2018
@codelucas

Copy link
Copy Markdown
Owner

#584 is merged! Giving us JP support. Thanks again for this initial effort here @Newspad but I decided to merge PR-584 as it has minimal dependency requirements. Also unfortunately we don't have a good way to measure branch vs. branch performance in article extraction quality (will file a todo for myself)

@codelucas codelucas closed this Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants