Sha256: 32fb70d1664933b9096fe8a449576349c0d9249b0f9aec0d01f1d657566021d0

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

class TwitterCldr.SegmentationTokenizer
  constructor : ->
    recognizers = [
      new TwitterCldr.TokenRecognizer("break", /\u00f7/, ((val) -> 
        TwitterCldr.Utilities.trim_string(val))) # ÷ character
      new TwitterCldr.TokenRecognizer("no_break", /\u00d7/, ((val) -> 
        TwitterCldr.Utilities.trim_string(val))) # × character
    ]
    ur_tokenizer = new TwitterCldr.UnicodeRegexTokenizer
    ur_tokenizer.insert_before("string", recognizers)
    @tokenizer = ur_tokenizer
    

  tokenize : (pattern) ->
    result = []
    tokens = @tokenizer.tokenize pattern
    for token in tokens
      if token.value.replace(/^\s+|\s+$/g, "").length isnt  0
        result.push token

    result

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr_js-2.4.0 lib/twitter_cldr/js/mustache/tokenizers/segmentation_tokenizer.coffee