001
002 package edu.upenn.cis.propbank_shen;
003
004 /**
005 A class emulating an enumeration of labels representing
006 "modifiers" in the propbank. Even though there is obviously
007 a vast amount of overlap between the denotation of the labels,
008 a single modifier is chosen as the appropriate annotation
009 if it is deemed "the most" appropriate. I don't think this
010 distinction is at all well defined, but it is common practice
011 in this field and what the linguists want.
012
013 <ul>
014 <li> EXT extent
015 <li> LOC location
016 <li> DIR direction
017 <li> NEG negation (not in PREDITOR)
018 <li> MOD general modification
019 <li> ADV adverbial modification
020 <li> MNR manner
021 <li> PRD secondary predication
022 <li> REC recipricol (eg herself, etc)
023 <li> TMP temporal
024 <li> PRP purpose - deprecated !!!
025 <li> PNC purpose no cause
026 <li> CAU cause
027 <li> STR stranded
028 </ul>
029 @author Scott Cotton
030 */
031
032
033 public final class ModLabel {
034
035 private String label_name;
036 private String label_descr;
037
038 // private constructor
039 private ModLabel(String nm, String descr) {
040 label_name = nm;
041 label_descr = descr;
042
043 }
044
045 public final ModLabel prepMod(String prep) {
046 return new ModLabel(prep, "preposition");
047 }
048
049 /**
050 Convert a ModLabel to a string
051 */
052 public final String toString() { return label_name; }
053
054 /**
055 Given a string, return the associated ModLabel
056
057 @param s the string to be converted to a ModLabel
058 */
059 public static final ModLabel ofString(String s) {
060 if (s.equals("EXT")) { return ModLabel.EXT; }
061 else if (s.equals("LOC")) { return ModLabel.LOC; }
062 else if (s.equals("MOD")) { return ModLabel.MOD; }
063 else if (s.equals("ADV")) { return ModLabel.ADV; }
064 else if (s.equals("MNR")) { return ModLabel.MNR; }
065 else if (s.equals("PRD")) { return ModLabel.PRD; }
066 else if (s.equals("REC")) { return ModLabel.REC; }
067 else if (s.equals("TMP")) { return ModLabel.TMP; }
068 else if (s.equals("PRP")) { return ModLabel.PRP; }
069 else if (s.equals("PNC")) { return ModLabel.PNC; }
070 else if (s.equals("CAU")) { return ModLabel.CAU; }
071 else if (s.equals("STR")) { return ModLabel.STR; }
072 else {
073 return new ModLabel(s, "preposition");
074 }
075 }
076
077 public boolean equals (Object label) {
078 if (this == label)
079 return true;
080 if (!(label instanceof ModLabel))
081 return false;
082 ModLabel m = (ModLabel)label;
083 return label_name.equals(m.label_name) &&
084 label_descr.equals(m.label_descr);
085 }
086
087 // public int hashCode () {
088 // return 7 * label_name.hashCode() + label_descr.hashCode();
089 // }
090
091 /**
092 Return a brief english description of the associated label
093 */
094 public final String getDescription() { return label_descr; }
095
096
097 public static final ModLabel EXT = new ModLabel("EXT", "extent");
098 public static final ModLabel LOC = new ModLabel("LOC", "location");
099 public static final ModLabel DIR = new ModLabel("DIR", "direction");
100 public static final ModLabel MOD = new ModLabel("MOD", "modal");
101 public static final ModLabel ADV = new ModLabel("ADV", "adverbial");
102 public static final ModLabel MNR = new ModLabel("MNR", "manner");
103 public static final ModLabel PRD = new ModLabel("PRD", "secondary predication");
104 public static final ModLabel REC = new ModLabel("REC", "recipricol");
105 public static final ModLabel TMP = new ModLabel("TMP", "temporal");
106 public static final ModLabel PRP = new ModLabel("PRP", "purpose (deprecated)");
107 public static final ModLabel PNC = new ModLabel("PNC", "purpose, not the cause");
108 public static final ModLabel CAU = new ModLabel("CAU", "cause");
109 public static final ModLabel STR = new ModLabel("STR", "stranded");
110 }