Ejemplo n.º 1
0
 public static boolean isOnlySymbols(String value) {
   for (int i = 0; i < value.length(); i++) {
     if (!StopWord.symbol(value.charAt(i))) {
       return false;
     }
   }
   return true;
 }
Ejemplo n.º 2
0
  public InputTextInvertedIndex(int[] tokens, boolean isRemoveStopWords) {
    indexIncludingStopWords = new TIntObjectHashMap<TIntLinkedList>();
    indexWithoutStopWords = new TIntObjectHashMap<TIntLinkedList>();
    int noStopwordsPosition = 0;
    for (int position = 0; position < tokens.length; ++position) {
      int token = tokens[position];
      TIntLinkedList positions = indexIncludingStopWords.get(token);
      if (positions == null) {
        positions = new TIntLinkedList();
        indexIncludingStopWords.put(token, positions);
      }
      positions.add(position);

      if (!isRemoveStopWords || !StopWord.isStopwordOrSymbol(token)) {
        positions = indexWithoutStopWords.get(token);
        if (positions == null) {
          positions = new TIntLinkedList();
          indexWithoutStopWords.put(token, positions);
        }
        positions.add(noStopwordsPosition);
        noStopwordsPosition++;
      }
    }
  }
Ejemplo n.º 3
0
 public static boolean is(String word) {
   return StopWord.getInstance().isStopWord(word.toLowerCase());
 }
Ejemplo n.º 4
0
 public static void main(String[] args) {
   String test = "!";
   System.out.println(StopWord.symbol(test.charAt(0)));
 }
Ejemplo n.º 5
0
 public static boolean firstCharSymbol(String word) {
   if (word == null || word.length() == 0) {
     return false;
   }
   return StopWord.getInstance().isSymbol(word.charAt(0));
 }
Ejemplo n.º 6
0
 public static boolean symbol(char word) {
   return StopWord.getInstance().isSymbol(word);
 }
Ejemplo n.º 7
0
 public static boolean is(int word) {
   return StopWord.getInstance().isStopWord(word);
 }