001 // This file is part of the Attempto Java Packages. 002 // Copyright 2008-2009, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch). 003 // 004 // The Attempto Java Packages is free software: you can redistribute it and/or modify it under the 005 // terms of the GNU Lesser General Public License as published by the Free Software Foundation, 006 // either version 3 of the License, or (at your option) any later version. 007 // 008 // The Attempto Java Packages is distributed in the hope that it will be useful, but WITHOUT ANY 009 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 010 // PURPOSE. See the GNU Lesser General Public License for more details. 011 // 012 // You should have received a copy of the GNU Lesser General Public License along with the Attempto 013 // Java Packages. If not, see http://www.gnu.org/licenses/. 014 015 package ch.uzh.ifi.attempto.ape; 016 017 import java.util.Arrays; 018 import java.util.HashSet; 019 import java.util.Set; 020 021 /** 022 * This class contains the function words of ACE. These words have a predefined meaning and cannot 023 * be used in the lexicon. Function words like "can" or "true", which can be used in the lexicon, 024 * are not covered by this class. 025 * 026 * @author Tobias Kuhn 027 */ 028 public class FunctionWords { 029 030 private static HashSet<String> functionWords = new HashSet<String>(Arrays.asList(new String[] { 031 "null", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", 032 "twelve", "dozen", "there", "and", "or", "not", "that", "than", "of", "if", "then", "such", "be", "provably", 033 "more", "most", "are", "is", "the", "a", "an", "some", "no", "every", "all", "each", "which", "its", "his", 034 "her", "their", "whose", "it", "he", "she", "they", "him", "them", "itself", "himself", "herself", 035 "themselves", "someone", "somebody", "something", "nobody", "nothing", "everyone", "everybody", "everything", 036 "what", "who", "how", "where", "when", "by", "Null", "Zero", "One", "Two", "Three", "Four", "Five", "Six", 037 "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Dozen", "There", "If", "Are", "Is", "The", "A", "An", 038 "Some", "No", "Every", "All", "Each", "Which", "Its", "His", "Her", "Their", "Whose", "It", "He", "She", 039 "They", "Someone", "Somebody", "Something", "Nobody", "Nothing", "Everyone", "Everybody", "Everything", 040 "What", "Who", "How", "Where", "When" 041 })); 042 043 private FunctionWords() {} // no instances allowed 044 045 /** 046 * Checks whether a certain string represents a function word. 047 * 048 * @param s The string to be checked. 049 * @return true if the string represents a function word. 050 */ 051 public static boolean isFunctionWord(String s) { 052 return functionWords.contains(s); 053 } 054 055 /** 056 * Returns a set that contains all function words. 057 * 058 * @return A list containing all function words. 059 */ 060 public static Set<String> getFunctionWords() { 061 return new HashSet<String>(functionWords); 062 } 063 064 }