twitter / twitter-cldr-js

JavaScript implementation of the ICU (International Components for Unicode) that uses the Common Locale Data Repository to format dates, plurals, and more. Based on twitter-cldr-rb.
Apache License 2.0
346 stars 55 forks source link

TypeError: Cannot read property 'vi' of undefined #83

Closed loretoparisi closed 6 years ago

loretoparisi commented 7 years ago

I have installed via npm install twitter-cldr. I'm then load the vi locale that should be in the module assets here

> var TwitterCldr = require('twitter_cldr').load('vi');
undefined
> var iterator = new TwitterCldr.BreakIterator ("vi", {"use_uli_exceptions" : true});
undefined
> iterator.each_sentence("Trường đại học Bách Khoa Hà Nội");
TypeError: Cannot read property 'vi' of undefined
    at BreakIterator.TwitterCldr.BreakIterator.BreakIterator.tailoring_resource_for (/Users/loretoparisi/Documents/Projects/node_modules/twitter_cldr/full/core.js:1661:69)
    at BreakIterator.TwitterCldr.BreakIterator.BreakIterator.compile_rules_for (/Users/loretoparisi/Documents/Projects/node_modules/twitter_cldr/full/core.js:1590:38)
    at BreakIterator.TwitterCldr.BreakIterator.BreakIterator.each_boundary (/Users/loretoparisi/Documents/Projects/node_modules/twitter_cldr/full/core.js:1529:20)
    at BreakIterator.TwitterCldr.BreakIterator.BreakIterator.each_sentence (/Users/loretoparisi/Documents/Projects/node_modules/twitter_cldr/full/core.js:1510:19)
    at repl:1:10
    at sigintHandlersWrap (vm.js:22:35)
    at sigintHandlersWrap (vm.js:96:12)
    at ContextifyScript.Script.runInThisContext (vm.js:21:12)
    at REPLServer.defaultEval (repl.js:346:29)
    at bound (domain.js:280:14)
camertron commented 6 years ago

Hey @loretoparisi, thanks for the bug report! I spent some time over the weekend digging into this, and it appears to be fairly complex. Just wanted to acknowledge the issue though. I'll keep you apprised as I make progress :)

camertron commented 6 years ago

@loretoparisi I decided to build a new package for text segmentation and just released it via npm. It's called cldr-segmentation. Let me know if it meets your needs :)

loretoparisi commented 6 years ago

@camertron this is awesome!!! Also it will help a lot, a I can easily integrate it now (I'm dealing with 20+ languages (word boundary and not) and twitter-cldr is the best implementation currently as segmentation tool for node.js Thanks a lot.

camertron commented 6 years ago

Awesome, glad you're finding it useful!