breakiteratorrules.java

来自「This is a resource based on j2me embedde」· Java 代码 · 共 385 行 · 第 1/2 页

JAVA
385
字号
/* *  * @(#)BreakIteratorRules.java	1.22 06/10/10 *  * Portions Copyright  2000-2008 Sun Microsystems, Inc. All Rights * Reserved.  Use is subject to license terms. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER *  * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. *  * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). *  * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA *  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. *//* * Licensed Materials - Property of IBM * * (C) Copyright IBM Corp. 1999 All Rights Reserved. * (C) IBM Corp. 1997-1998.  All Rights Reserved. * * The program is provided "as is" without any warranty express or * implied, including the warranty of non-infringement and the implied * warranties of merchantibility and fitness for a particular purpose. * IBM will not be liable for any damages suffered by you as a result * of using the Program. In no event will IBM be liable for any * special, indirect or consequential damages or lost profits even if * IBM has been advised of the possibility of their occurrence. IBM * will not be liable for any third party claims against you. */package sun.text.resources;import java.util.ListResourceBundle;/** * Default break-iterator rules.  These rules are more or less general for * all locales, although there are probably a few we're missing.  The * behavior currently mimics the behavior of BreakIterator in JDK 1.2. * There are known deficiencies in this behavior, including the fact that * the logic for handling CJK characters works for Japanese but not for * Chinese, and that we don't currently have an appropriate locale for * Thai.  The resources will eventually be updated to fix these problems. */ /* Modified for Hindi 3/1/99. */public class BreakIteratorRules extends ListResourceBundle {    public Object[][] getContents() {        return contents;    }    static final Object[][] contents = {        // BreakIteratorClasses lists the class names to instantiate for each        // built-in type of BreakIterator        { "BreakIteratorClasses",               new String[] { "RuleBasedBreakIterator",     // character-break iterator class                              "RuleBasedBreakIterator",     // word-break iterator class                              "RuleBasedBreakIterator",     // line-break iterator class                              "RuleBasedBreakIterator" }    // sentence-break iterator class        },        // rules describing how to break between logical characters        { "CharacterBreakRules",      // ignore non-spacing marks and enclosing marks (since we never      // put a break before ignore characters, this keeps combining      // accents with the base characters they modify)      "<enclosing>=[:Mn::Me:];"      // other category definitions      + "<choseong>=[\u1100-\u115f];"      + "<jungseong>=[\u1160-\u11a7];"      + "<jongseong>=[\u11a8-\u11ff];"      + "<surr-hi>=[\ud800-\udbff];"      + "<surr-lo>=[\udc00-\udfff];"      // break after every character, except as follows:      + ".;"      // keep base and combining characters togethers      + "<base>=[^<enclosing>^[:Cc::Cf::Zl::Zp:]];"      + "<base><enclosing><enclosing>*;"      // keep CRLF sequences together      + "\r\n;"      // keep surrogate pairs together      + "<surr-hi><surr-lo>;"      // keep Hangul syllables spelled out using conjoining jamo together      + "<choseong>*<jungseong>*<jongseong>*;"      // various additions for Hindi support      + "<nukta>=[\u093c];"      + "<danda>=[\u0964\u0965];"      + "<virama>=[\u094d];"      + "<devVowelSign>=[\u093e-\u094c\u0962\u0963];"      + "<devConsonant>=[\u0915-\u0939];"      + "<devNuktaConsonant>=[\u0958-\u095f];"      + "<devCharEnd>=[\u0902\u0903\u0951-\u0954];"      + "<devCAMN>=(<devConsonant>{<nukta>});"      + "<devConsonant1>=(<devNuktaConsonant>|<devCAMN>);"      + "<zwj>=[\u200d];"      + "<devConjunct>=({<devConsonant1><virama>{<zwj>}}<devConsonant1>);"      + "<devConjunct>{<devVowelSign>}{<devCharEnd>};"      + "<danda><nukta>;"        },        // default rules for finding word boundaries        { "WordBreakRules",      // ignore non-spacing marks, enclosing marks, and format characters,      // all of which should not influence the algorithm      //"<ignore>=[:Mn::Me::Cf:];"      "<ignore>=[:Cf:];"      + "<enclosing>=[:Mn::Me:];"      // Hindi phrase separator, kanji, katakana, hiragana, CJK diacriticals,      // other letters, and digits      + "<danda>=[\u0964\u0965];"      + "<kanji>=[\u3005\u4e00-\u9fa5\uf900-\ufa2d];"      + "<kata>=[\u30a1-\u30fa\u30fd\u30fe];"      + "<hira>=[\u3041-\u3094\u309d\u309e];"      + "<cjk-diacrit>=[\u3099-\u309c\u30fb\u30fc];"      + "<letter-base>=[:L::Mc:^[<kanji><kata><hira><cjk-diacrit>]];"      + "<let>=(<letter-base><enclosing>*);"      + "<digit-base>=[:N:];"      + "<dgt>=(<digit-base><enclosing>*);"      // punctuation that can occur in the middle of a word: currently      // dashes, apostrophes, quotation marks, and periods      + "<mid-word>=[:Pd::Pc:\u00ad\u2027\\\"\\\'\\.];"      // punctuation that can occur in the middle of a number: currently      // apostrophes, qoutation marks, periods, commas, and the Arabic      // decimal point      + "<mid-num>=[\\\"\\\'\\,\u066b\\.];"      // punctuation that can occur at the beginning of a number: currently      // the period, the number sign, and all currency symbols except the cents sign      + "<pre-num>=[:Sc:\\#\\.^\u00a2];"      // punctuation that can occur at the end of a number: currently      // the percent, per-thousand, per-ten-thousand, and Arabic percent      // signs, the cents sign, and the ampersand      + "<post-num>=[\\%\\&\u00a2\u066a\u2030\u2031];"      // line separators: currently LF, FF, PS, and LS      + "<ls>=[\n\u000c\u2028\u2029];"      // whitespace: all space separators and the tab character      + "<ws-base>=[:Zs:\t];"      + "<ws>=(<ws-base><enclosing>*);"      // a word is a sequence of letters that may contain internal      // punctuation, as long as it begins and ends with a letter and      // never contains two punctuation marks in a row      + "<word>=((<let><let>*(<mid-word><let><let>*)*){<danda>});"      // a number is a sequence of digits that may contain internal      // punctuation, as long as it begins and ends with a digit and      // never contains two punctuation marks in a row.      + "<number>=(<dgt><dgt>*(<mid-num><dgt><dgt>*)*);"      // break after every character, with the following exceptions      // (this will cause punctuation marks that aren't considered      // part of words or numbers to be treated as words unto themselves)      + ".;"      // keep together any sequence of contiguous words and numbers      // (including just one of either), plus an optional trailing      // number-suffix character      + "{<word>}(<number><word>)*{<number>{<post-num>}};"      // keep together and sequence of contiguous words and numbers      // that starts with a number-prefix character and a number,      // and may end with a number-suffix character      + "<pre-num>(<number><word>)*{<number>{<post-num>}};"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?