1   package gate.creole.morph;
2   
3   import java.util.regex.Pattern;
4   /**
5    * <p>Title: </p>
6    * <p>Description: </p>
7    * <p>Copyright: Copyright (c) 2003</p>
8    * <p>Company: </p>
9    * @author not attributable
10   * @version 1.0
11   */
12  
13  public class MyPattern implements Comparable {
14  
15    private Pattern pattern;
16    private String function;
17    private String category;
18  
19    public MyPattern(Pattern pattern, String function, String category) {
20      this.pattern = pattern;
21      this.function = function;
22      this.category = category;
23    }
24  
25    public int compareTo(Object obj) {
26      // this is always to be added at the end
27      return 1;
28    }
29  
30    public Pattern getPattern() {
31      return pattern;
32    }
33  
34    public void setPattern(Pattern pattern) {
35      this.pattern = pattern;
36    }
37  
38    public String getFunction() {
39      return function;
40    }
41  
42    public void setFunction(String function) {
43      this.function = function;
44    }
45  
46    public String getCategory() {
47      return category;
48    }
49  
50    public boolean isSameCategory(String category) {
51      if(this.category.equals("*") || category.equals("*")) {
52         return true;
53      } else {
54        if (this.category.equals("verb")) {
55          if (category.equals("VB") ||
56              category.equals("VBD") ||
57              category.equals("VBG") ||
58              category.equals("VBN") ||
59              category.equals("VBP") ||
60              category.equals("VBZ")) {
61            return true;
62          }
63          else {
64            return false;
65          }
66        }
67        else if (this.category.equals("noun")) {
68          if (category.equals("NN") ||
69              category.equals("NNP") ||
70              category.equals("NNPS") ||
71              category.equals("NNS") ||
72              category.equals("NP") ||
73              category.equals("NPS")) {
74            return true;
75          }
76          else {
77            return false;
78          }
79        } else {
80          return false;
81        }
82      }
83    }
84  
85    public void setCategory(String cat) {
86      this.category = cat;
87    }
88  }