Exemplo 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;
 }
Exemplo 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++;
      }
    }
  }
Exemplo n.º 3
0
 public static boolean is(String word) {
   return StopWord.getInstance().isStopWord(word.toLowerCase());
 }
Exemplo n.º 4
0
 public static void main(String[] args) {
   String test = "!";
   System.out.println(StopWord.symbol(test.charAt(0)));
 }
Exemplo n.º 5
0
 public static boolean firstCharSymbol(String word) {
   if (word == null || word.length() == 0) {
     return false;
   }
   return StopWord.getInstance().isSymbol(word.charAt(0));
 }
Exemplo n.º 6
0
 public static boolean symbol(char word) {
   return StopWord.getInstance().isSymbol(word);
 }
Exemplo n.º 7
0
 public static boolean is(int word) {
   return StopWord.getInstance().isStopWord(word);
 }