Permalink
Browse files

[offline-renderer] mecab appears to be broken on Ubuntu > 10.x

Catch the exception an issue a warning instead.

This probably means all Japanese text in a document will be omitted

Need to figure out what happened to the mecab library/API to remove
all the calls we are using.

This change should allow some form of test build to continue
until things can be sorted out.

If anyone has any ideas why
the sentence_length attribute and the begin_node_list() end_node_list()
methods have disappeared; or if the mecab.tagger() needs different arguments
please let us know.

Signed-off-by: Christopher Hall <hsw@openmoko.com>
  • Loading branch information...
1 parent 47e1a80 commit 3997434ab32053c74f5fb9756b0175f4ce14dcb5 @hxw hxw committed Jan 24, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 host-tools/offline-renderer/LanguageTranslation.py
@@ -218,7 +218,11 @@ def trans(self, text):
text = text.encode('utf-8')
n = self.mecab.parseToNode(text)
- slen = n.sentence_length;
+ try:
+ slen = n.sentence_length;
+ except AttributeError as e:
+ print('**AttributeError(sentence_length) on "{t:s}"\n'.format(t=text))
+ slen = -1
processed_len = 0
for i in range(slen + 1):
b = n.begin_node_list(i)

0 comments on commit 3997434

Please sign in to comment.