001 package edu.upenn.cis.propbank_shen;
002
003 /**
004 This class represents inflectional information as is found in the
005 english propbank. Basically, inflectional information is stuff
006 like "third person plural singular", but we only represent a portion
007 of this information for a few reasons: first, some of it is already
008 in the part of speech tags in the penn treebank, and second,
009 only some of this information is really relevant to the primary aim
010 of this study -- to find out more about the relationship between
011 syntax and semantics (as it appears in a million words of wall street
012 journal from the hot 90's...).
013
014 <p>
015
016 Anyway, we keep inflectional information in 5 slots:
017 <ol>
018 <li> Form
019 <li> Tense
020 <li> Aspect
021 <li> Person
022 <li> Voice
023 </ol>
024
025 @author Scott Cotton
026 @see edu.upenn.cis.propbank_shen.InflForm
027 @see edu.upenn.cis.propbank_shen.InflTense
028 @see edu.upenn.cis.propbank_shen.InflAspect
029 @see edu.upenn.cis.propbank_shen.InflPerson
030 @see edu.upenn.cis.propbank_shen.InflVoice
031 */
032 public class Inflection {
033
034 public InflForm form;
035 public InflTense tense;
036 public InflAspect aspect;
037 public InflPerson person;
038 public InflVoice voice;
039
040 public Inflection(InflForm f,
041 InflTense it,
042 InflAspect ia,
043 InflPerson ip,
044 InflVoice iv)
045 {
046 form = f;
047 tense = it;
048 aspect = ia;
049 person = ip;
050 voice = iv;
051 }
052
053 /**
054 construct an inflection instance from a string of the form
055 FORM . TENSE . ASPECT . PERSON . VOICE
056 (one character for each slot, the dots denote concatenation and
057 aren't to be taken literally).
058 */
059 public Inflection(String s) throws CorruptDataException
060 {
061 if (s.length() != 5) {
062 throw new CorruptDataException("invalid inflection string: " + s);
063 }
064 form = InflForm.ofString(s.substring(0, 1));
065 tense = InflTense.ofString(s.substring(1,2));
066 aspect = InflAspect.ofString(s.substring(2,3));
067 person = InflPerson.ofString(s.substring(3,4));
068 voice = InflVoice.ofString(s.substring(4,5));
069 }
070
071 /**
072 construct a canonical string representing the inflectional information.
073 */
074 public String toString()
075 {
076 return (form.toString()
077 + tense.toString()
078 + aspect.toString()
079 + person.toString()
080 + voice.toString());
081 }
082 }
083
084