示例#1
0
        //public static Finder Finder;
        public Tagger()
        {
            var dic = new Dictionary();
            dic.LoadVerbEntries(@"../../FarsiVerbs.dat");
            //if (Finder == null)
            //    Finder = new Finder(dic, ENUM_FIND_MODE.DATABASE);
            m_LemmaDic = new Dictionary<string, KeyValuePair<string, PersianPOSTag>>();

            _lemmatizer = new PersianSuffixRecognizer(false);
            Mapper = new Dictionary<string, PersianPOSTag>();
            const string mapperfile = @"../../words.dat";

            var reader = new StreamReader(mapperfile);
            while (!reader.EndOfStream)
            {
                string line = reader.ReadLine();
                string[] parts = line.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                Mapper.Add(parts[0].Trim(), (PersianPOSTag)Enum.Parse(typeof(PersianPOSTag), parts[1].Trim()));
            }
            reader.Close();
        }
示例#2
0
        //public static Finder Finder;

        public Tagger()
        {
            var dic = new Dictionary();

            dic.LoadVerbEntries(@"../../FarsiVerbs.dat");
            //if (Finder == null)
            //    Finder = new Finder(dic, ENUM_FIND_MODE.DATABASE);
            m_LemmaDic = new Dictionary <string, KeyValuePair <string, PersianPOSTag> >();

            _lemmatizer = new PersianSuffixRecognizer(false);
            Mapper      = new Dictionary <string, PersianPOSTag>();
            const string mapperfile = @"../../words.dat";

            var reader = new StreamReader(mapperfile);

            while (!reader.EndOfStream)
            {
                string   line  = reader.ReadLine();
                string[] parts = line.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                Mapper.Add(parts[0].Trim(), (PersianPOSTag)Enum.Parse(typeof(PersianPOSTag), parts[1].Trim()));
            }
            reader.Close();
        }