takuyaa / kuromoji.js

JavaScript implementation of Japanese morphological analyzer
848 stars 118 forks source link

Support loading dictionaries from the filesystem in the browser #14

Closed iwehrman closed 6 years ago

iwehrman commented 8 years ago

This PR fixes two bugs:

  1. When the loadArrayBuffer XHR fails, it applies its callback to the error but fails to return, which results in a later async error related to calling a callback more than once. This avoids calling the loadArrayBuffer callback twice by returning after applying the callback to an error.
  2. It's not currently possible to use this library in a web page served from the filesystem due to a different bug. The problem is that the status of filesystem XHRs is always 0 because status is an HTTP-specific concept. This works around the problem by adding an extra this.status > 0 conjunct to the XHR error test.
coveralls commented 8 years ago

Coverage Status

Coverage remained the same at 93.75% when pulling 1a9dc844e1c40f9bee052d478d015b91d16c9f74 on iwehrman:iwehrman/load-dict-from-fs into 8f30e7e4adb0df739668372d828328dc48f9b1a2 on takuyaa:master.

codecov-io commented 8 years ago

Current coverage is 93.82% (diff: 100%)

Merging #14 into master will not change coverage

@@             master        #14   diff @@
==========================================
  Files            22         22          
  Lines           923        923          
  Methods         120        120          
  Messages          0          0          
  Branches        106        106          
==========================================
  Hits            866        866          
  Misses           57         57          
  Partials          0          0          

Powered by Codecov. Last update 8f30e7e...1a9dc84

iwehrman commented 7 years ago

Hi @takuyaa! Just checking in about this PR. Do you have any concerns with it?

takuyaa commented 6 years ago

@iwehrman Sorry for late response on this PR... This PR is pretty nice and seems to works well.