示例#1
0
 internal static void LoadAvailablePlugins()
 {
     try
     {
         PluginLoader loader = new PluginLoader();
         loader.LoadPlugins();
         LogWritter.Write("Loaded " + PluginLoader.Plugins.Count + " plugins.");
     }
     catch (Exception e)
     {
         LogWritter.Write(string.Format("Plugins couldn't be loaded: {0}", e.Message));
         Environment.Exit(0);
     }
 }
示例#2
0
 internal static void LoadAvailablePlugins()
 {
     try
     {
         PluginLoader loader = new PluginLoader();
         loader.LoadPlugins();
         LogWritter.Write("Loaded " + PluginLoader.Plugins.Count + " plugins.");
     }
     catch (Exception e)
     {
         LogWritter.Write(string.Format("Plugins couldn't be loaded: {0}", e.Message));
         Environment.Exit(0);
     }
     foreach (IPlugin plugin in PluginLoader.Plugins.Where(p => p.LoadType == LoadType.LOADER_EXECUTION))
     {
         plugin.Run();
         LogWritter.Write("Run plugin on loader execution: " + plugin.Name + ".");
     }
 }
示例#3
0
 /// <summary>
 /// 情感倾向分析接口
 /// 对包含主观观点信息的文本进行情感极性类别
 /// </summary>
 public static NLPSentimentClassify SentimentClassify(string data)
 {
     try
     {
         var obj = nlp.SentimentClassify(data);
         LogWritter.Write(LogType.Debug, obj.ToString(), "SentimentClassify");
         return(obj.ToObject <NLPSentimentClassify>());
     }
     catch (Exception exp)
     {
     }
     return(null);
 }
示例#4
0
 /// <summary>
 /// 短文本相似度接口
 /// 短文本相似度接口用来判断两个文本的相似度得分
 /// </summary>
 public static NLPSimNet SimNet(string src, string target)
 {
     try
     {
         var obj = nlp.Simnet(src, target);
         LogWritter.Write(LogType.Debug, obj.ToString(), "SimNet");
         return(obj.ToObject <NLPSimNet>());
     }
     catch (Exception exp)
     {
     }
     return(null);
 }
示例#5
0
 /// <summary>
 ///  词法分析(定制版)接口
 ///  词法分析接口向用户提供分词、词性标注、专名识别三大功能;
 ///  能够识别出文本串中的基本词汇(分词),对这些词汇进行重组、标注组合后词汇的词性,并进一步识别出命名实体。
 /// </summary>
 public static NLPLexer Lexer(string data)
 {
     try
     {
         var obj = nlp.Lexer(data);
         LogWritter.Write(LogType.Debug, obj.ToString(), "Lexer");
         return(obj.ToObject <NLPLexer>());
     }
     catch (Exception exp)
     {
     }
     return(null);
 }
示例#6
0
 /// <summary>
 /// 依存句法分析接口
 /// 依存句法分析接口可自动分析文本中的依存句法结构信息,利用句子中词与词之间的依存关系来表示词语的句法结构信息(如“主谓”、“动宾”、“定中”等结构关系),并用树状结构来表示整句的结构(如“主谓宾”、“定状补”等)。
 /// </summary>
 public static NLPDepParser DepParser(string data)
 {
     try
     {
         var options = new Dictionary <string, object>
         {
             { "mode", 1 }
         };
         var obj = nlp.DepParser(data, options);
         LogWritter.Write(LogType.Debug, obj.ToString(), "SentimentClassify");
         return(obj.ToObject <NLPDepParser>());
     }
     catch (Exception exp)
     {
     }
     return(null);
 }
示例#7
0
        internal string DownTodayBg()
        {
            string date     = DateTime.Now.ToString("yyyyMMdd");
            string filename = AppDomain.CurrentDomain.BaseDirectory + "BINGBG\\" + date + "\\bg.jpg";

            if (!FileUtils.Exists(filename))
            {
                string result = APIRequest.RequestByGet(CommonConfig.CommonData.APIURL.BingImageURL + "?format=js&idx=0&n=1");
                try
                {
                    var IMAGEPATH = JsonConvertUtils.JsonToObject <BingImageObj>(result);
                    var URL       = BING_URL_HEAD + IMAGEPATH.images[0].url;
                    Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "BINGBG\\" + date);
                    SavePhotoFromUrl(filename, URL);
                    LogWritter.Write(LogType.Debug, "已下载图片", "BingIMGDownloader");
                }
                catch (Exception ex)
                { }
            }
            return("");
        }