package jp.gr.java_conf.dyama.rink.corpus;

import jp.gr.java_conf.dyama.rink.corpus.TagSet.PartOfSpeech;

public interface Common {

    public enum POS implements PartOfSpeech {
        UNDEFINED(   0, "Undefined part of speech tag"),
        BOS(         1, "Beginning Of Sentence"),
        EOS(         2, "End Of Sentence"),
        NONE(        3, "NONE"),
        BLANK(       4, "Blank"),
        ;

        private int id_ ;
        private String description_ ;
        private POS(int id, String description){
            id_ = id;
            description_ = description ;
            if (description == null)
                description_ = "";
        }


        static private Common.POS[] ARRAY = Common.POS.values();

        /**
         * parse integer as a POS tag
         * @param i POS ID
         * @return POS tag. return UNDEFINED if i is undefined.
         */
        public static TagSet.PartOfSpeech parseInt(int i){
            for(POS pos : ARRAY){
                if (pos.getID() == i)
                    return pos;
            }
            return UNDEFINED;
        }

        /**
         * parse string as a POS tag
         * @param str POS tag string.
         * @return POS tag. return UNDEFINED if str is undefined or null.
         */
        public static TagSet.PartOfSpeech parseString(String str){
            if (str == null)
                return UNDEFINED;
            for(POS pos : ARRAY){
                if (pos.toString().equals(str))
                    return pos;
            }
            return UNDEFINED;
        }

        @Override
        public int getID() {
            return id_;
        }

        @Override
        public String getDescription() {
            return description_;
        }

    }
}

@@ -755,24 +755,24 @@
   * 
-p
+P
 arse
- integer as
+s a ID into
  a P
@@ -798,20 +798,16 @@
 param i 
-POS 
 ID%0A     
@@ -1122,21 +1122,24 @@
   * 
-p
+P
 arse
+s a
  string 
 as a
@@ -1138,10 +1138,12 @@
 ing 
-as
+into
  a P
@@ -1140,32 +1140,33 @@
 g into a POS tag
+.
 %0A         * @par
@@ -1171,16 +1171,23 @@
 aram str
+ing the
  POS tag
@@ -1243,19 +1243,26 @@
 INED if 
-str
+the string
  is unde
@@ -1352,16 +1352,19 @@
 ring str
+ing
 )%7B%0A     
@@ -1377,16 +1377,19 @@
  if (str
+ing
  == null
@@ -1503,16 +1503,19 @@
 uals(str
+ing
 ))%0A     

revise API document