⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alphabetictokenizer.java

📁 矩阵的QR分解算法
💻 JAVA
字号:
/* *    This program is free software; you can redistribute it and/or modify *    it under the terms of the GNU General Public License as published by *    the Free Software Foundation; either version 2 of the License, or *    (at your option) any later version. * *    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 for more details. * *    You should have received a copy of the GNU General Public License *    along with this program; if not, write to the Free Software *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *//* * AlphabeticStringTokenizer.java * Copyright (C) 2003, 2007 University of Waikato, Hamilton, New Zealand */package weka.core.tokenizers;import java.util.NoSuchElementException;/** <!-- globalinfo-start --> * Alphabetic string tokenizer, tokens are to be formed only from contiguous alphabetic sequences. * <p/> <!-- globalinfo-end --> *  * @author  Asrhaf M. Kibriya (amk14@cs.waikato.ac.nz) * @author  FracPete (fracpete at waikato dot ac dot nz) * @version $Revision: 1.1 $ */public class AlphabeticTokenizer  extends Tokenizer {  /** for serialization */  private static final long serialVersionUID = 6705199562609861697L;  /** the characters of the string */  protected char[] m_Str;    /** the current position */  protected int m_CurrentPos;    /**   * Returns a string describing the stemmer   *    * @return 		a description suitable for displaying in the    * 			explorer/experimenter gui   */  public String globalInfo() {    return         "Alphabetic string tokenizer, tokens are to be formed only from "      + "contiguous alphabetic sequences.";  }    /**   * returns whether there are more elements still   *    * @return true 	if there are still more elements   */  public boolean hasMoreElements() {    int beginpos = m_CurrentPos;    while ( (beginpos < m_Str.length) && 	((m_Str[beginpos] < 'a') || (m_Str[beginpos] > 'z')) &&	((m_Str[beginpos] < 'A') || (m_Str[beginpos] > 'Z')) ) {      beginpos++;        }    m_CurrentPos = beginpos;    if ( (beginpos < m_Str.length) && 	(((m_Str[beginpos] >= 'a') && (m_Str[beginpos] <= 'z')) ||	 ((m_Str[beginpos] >= 'A') && (m_Str[beginpos] <= 'Z'))) ) {      return true;    }    else {      return false;    }  }  /**   * returns the next element   *    * @return 		the next element   */  public Object nextElement() {    int beginpos, endpos;        beginpos = m_CurrentPos;    while ( (beginpos < m_Str.length) && 	((m_Str[beginpos] < 'a') && (m_Str[beginpos] > 'z')) &&	((m_Str[beginpos] < 'A') && (m_Str[beginpos] > 'Z')) ) {      beginpos++;        }    m_CurrentPos = endpos = beginpos;    if (beginpos >= m_Str.length)      throw new NoSuchElementException("No more tokens present");    while ((endpos < m_Str.length) &&	( ((m_Str[endpos] >= 'a') && (m_Str[endpos]<='z')) ||	  ((m_Str[endpos] >= 'A') && (m_Str[endpos]<='Z'))) ) {      endpos++;    }    String s = new String(m_Str, beginpos, endpos - m_CurrentPos);    m_CurrentPos = endpos;    return s;  }        /**   * Sets the string to tokenize. Tokenization happens immediately.   *    * @param s		the string to tokenize   */  public void tokenize(String s) {    m_CurrentPos = 0;    m_Str = new char[s.length()];    s.getChars(0, s.length(), m_Str, 0);  }  /**   * Runs the tokenizer with the given options and strings to tokenize.   * The tokens are printed to stdout.   *    * @param args	the commandline options and strings to tokenize   */  public static void main(String[] args) {    runTokenizer(new AlphabeticTokenizer(), args);  }}

⌨️ 快捷键说明

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