示例#1
0
        public static AveragedPerceptronTagger Load(Stream fileStreamIn)
        {
            StreamReader             textReader   = new StreamReader(fileStreamIn);
            List <object>            dataContents = CustomJsonParser.ParseList(textReader);
            AveragedPerceptronTagger tagger       = new AveragedPerceptronTagger();

            tagger.ConvertWeightDictionary((Dictionary <object, object>)dataContents[0]);
            tagger.KnownTags = tagger.ConvertKnownTagsDictionary((Dictionary <object, object>)dataContents[1]);
            tagger.ConvertClassesList((List <object>)dataContents[2]);
            tagger.Model = new AveragedPerceptron(tagger);
            return(tagger);
        }
示例#2
0
 public static AveragedPerceptronTagger GetTagger()
 {
     if (Global == null)
     {
         AnsDecoderStream stream;
         try
         {
             stream = new AnsDecoderStream(new FileStream(DefaultModelFileLocations.POS_TAGGER_ENG_FILE, FileMode.Open, FileAccess.Read));
         }
         catch (IOException)
         {
             return(null);
         }
         using (stream)
             Global = Load(stream);
     }
     return(Global);
 }
 public AveragedPerceptron(AveragedPerceptronTagger parent)
 {
     ParentTagger = parent;
 }