@@ -0,0 +1,2757 @@
+/**%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage at.illecker.storm.examples.util.unsupervised.util;%0A%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport at.illecker.storm.examples.util.io.FileUtil;%0A%0Apublic class Interjections %7B%0A%0A  public static final String INTERJECTIONS_LIST = System%0A      .getProperty(%22user.dir%22)%0A      + File.separator%0A      + %22resources%22%0A      + File.separator%0A      + %22wordlists%22 + File.separator + %22GATE_interjections.regex%22;%0A%0A  private static final Logger LOG = LoggerFactory%0A      .getLogger(Interjections.class);%0A  private static final Interjections instance = new Interjections();%0A%0A  // GATE interjections%0A  private List%3CPattern%3E m_interjections;%0A%0A  private Interjections() %7B%0A    try %7B%0A      LOG.info(%22Load Interjections from: %22 + INTERJECTIONS_LIST);%0A      Set%3CString%3E interjections = FileUtil.readFile(new FileInputStream(%0A          INTERJECTIONS_LIST));%0A%0A      m_interjections = new ArrayList%3CPattern%3E();%0A      for (String interjection : interjections) %7B%0A        m_interjections.add(Pattern.compile(%22%5E%22 + interjection + %22$%22));%0A      %7D%0A%0A    %7D catch (FileNotFoundException e) %7B%0A      e.printStackTrace();%0A    %7D%0A  %7D%0A%0A  public static Interjections getInstance() %7B%0A    return instance;%0A  %7D%0A%0A  public boolean isInterjection(String string) %7B%0A    for (Pattern interjection : m_interjections) %7B%0A      Matcher m = interjection.matcher(string);%0A      if (m.find()) %7B%0A        return true;%0A      %7D%0A    %7D%0A    return false;%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    Interjections interjections = Interjections.getInstance();%0A    System.out.println(%22isInterjection ':))': %22%0A        + interjections.isInterjection(%22:))%22));%0A    System.out.println(%22isInterjection 'wooow': %22%0A        + interjections.isInterjection(%22wooow%22));%0A  %7D%0A%7D%0A

Add Interjections