001 package edu.upenn.cis.propbank_shen; 002 003 import java.io.*; 004 005 /** 006 The "person" part of the inflectional information for a predicate argument 007 structure. We mark the person as "3rd" person in the case that the 3rd 008 person marker is present morphologically (Such as "goes"). Otherwise, the 009 argument structure is marked with "NoPerson". 010 011 @author Scott Cotton 012 @see edu.upenn.cis.propbank_shen.Inflection 013 */ 014 public final class InflPerson { 015 private String srep; 016 /** use a private constructor so that only static members 017 can be referenced. This helps us emulate an enumeration */ 018 private InflPerson(String s) {srep = s;} 019 020 /** the third person inflection */ 021 public static final InflPerson Third = new InflPerson("3"); 022 /** no inflection noted */ 023 public static final InflPerson NoPerson = new InflPerson("-"); 024 025 /** create a string representation of the person inflectional info. */ 026 public String toString() { return srep; } 027 /** 028 return the person inflectional information from a string. 029 If the string doesn't make sense, print an error and 030 return the default "NoPerson". 031 032 @return an InflPerson instance 033 */ 034 public static InflPerson ofString(String s) 035 { 036 if (s.equals("3")) { return InflPerson.Third; } 037 else if (s.equals("-")) { return InflPerson.NoPerson; } 038 else { 039 System.err.println("invalid inflection.person string: " 040 + s 041 + ", defaulting to NoPerson"); 042 return InflPerson.NoPerson; 043 } 044 } 045 }