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