Here you can find the source of startsWithPhraseSeparator(char[] token)
Parameter | Description |
---|---|
token | a parameter |
public static boolean startsWithPhraseSeparator(char[] token)
//package com.java2s; /**//from w ww . ja v a2 s . c om * ClusteringWiki - personalized and collaborative clustering of search results * Copyright (C) 2010 Texas State University-San Marcos * * Contact: http://dmlab.cs.txstate.edu * * 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 3 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, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Check if token starts with a phrase separator * @param token * @return */ public static boolean startsWithPhraseSeparator(char[] token) { return token.length > 0 && isPhraseSeparator(token[0]); } /** * Check if token starts with a phrase separator * @param token * @return */ public static boolean startsWithPhraseSeparator(String token) { final int ln = token.length(); return ln > 0 && isPhraseSeparator(token.charAt(0)); } /** * Check if token is a phrase separator * @param token * @return */ public static boolean isPhraseSeparator(char[] token) { return isPhraseSeparator(token, 0, token.length); } /** * Check if token is a phrase separator * @param token * @return */ public static boolean isPhraseSeparator(String token) { return isPhraseSeparator(token.toCharArray(), 0, token.length()); } /** * Check if token is a phrase separator * @param token * @param start * @param end * @return */ public static boolean isPhraseSeparator(char[] token, int start, int end) { for (int i = start; i < end; i++) if (!isPhraseSeparator(token[i])) return false; return true; } /** * Check if chracter is a phrase separator * @param token * @return */ public static boolean isPhraseSeparator(char token) { if (Character.isLetterOrDigit(token)) return false; switch (token) { case '.': case '!': case '?': case ',': case '\'': case '"': case '(': case ')': //case '&': //causes break on html codes, should be handled separately case ':': case ';': case '[': case ']': case '{': case '}': case '|': case '\\': case '/': return true; default: //nothing } return false; } }