当前位置: 首页>>代码示例>>C#>>正文


C# API.GetDataReady方法代码示例

本文整理汇总了C#中API.GetDataReady方法的典型用法代码示例。如果您正苦于以下问题:C# API.GetDataReady方法的具体用法?C# API.GetDataReady怎么用?C# API.GetDataReady使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API的用法示例。


在下文中一共展示了API.GetDataReady方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        //https://msdn.microsoft.com/en-us/library/windows/apps/ff402526(v=vs.105).aspx
        static void Main(string[] args)
        {
            API client = new API();
            var data = client.LoadFile("mainText.txt");
            //var multiData = client.LoadFilesMulticore(new List<string>() { "mainText.txt", "mainTextShort.txt", "prepositions.txt", "unions.txt" });
            var mst_one = client.HandleByMystem(data);
            //var mst_several = client.HandleByMystemMulticore(multiData);

            var stats_words_one = client.ProvideWordsStatsAnalysis(mst_one);
            var dict = client.GetDataReady<string>(stats_words_one);
            var cl_centers = client.GetDefaultClustersCenters(dict);
            var cl_settings = new ClasterSettings<string>(cl_centers, 0.000000000000000000000000001, 1.5f, 10000, dict);
            var result = client.ProvideClusterAnalysis<string>(cl_settings, "1");
            string json = JsonConvert.SerializeObject(result.Result.Select(i => new { name = i.Key, values = i.Value }));

            //ClasterAnalysis<string> ca = new ClasterAnalysis<string>(d, 0.000000000000000000000000001, 1.5f, 10000, clusters);
            //var res = ca.Clusterize();

            //var stats_digrams_one = client.ProvideDigramsStatsAnalysis(mst_one);

            //var stats_words_several = client.ProvideWordsStatsAnalysisMulticore(mst_several);
            //var stats_digrams_several = client.ProvideDigramsStatsAnalysisMulticore(mst_several);

            Console.WriteLine("That's all!");
            /*Multiprocessor mps = new Multiprocessor();
            mps.MultiprocessorFileRead(new List<string>() { "mainText.txt" });
            var texts = mps.Cache;

            MystemProvider mst = new MystemProvider(1);
            var list = mst.LaunchMystem(texts[0].List);

            var words = list.Select(el =>
            {
                if (el.analysis.Length == 0)
                    return el.text;
                return el.analysis[0].lex;
            }).ToList();

            var frequencyWordDict = StatisticsAnalysis.GetFrequencyDictionary(words);

            var frequencyDigramDict = StatisticsAnalysis.GetDigramFrequenceDictionary(words);
            var mutualInf = StatisticsAnalysis.CalculateMutualInformation(frequencyDigramDict, frequencyWordDict, words.Count);
            var tScore = StatisticsAnalysis.CalculateTScore(frequencyDigramDict, frequencyWordDict, words.Count);
            var llh = StatisticsAnalysis.CalculateLogLikelihood(frequencyDigramDict);

            List<Dictionary<WordDigram, double>> dList = new List<Dictionary<WordDigram, double>>();
            dList.Add(frequencyDigramDict.ToDictionary(i => i.Key, i => (double)i.Value));
            //dList.Add(mutualInf);
            //dList.Add(tScore);
            //dList.Add(llh);
            var mergedDictionary = dList.MergeDictionaries<WordDigram>();

            //СЛОВА
            List<Dictionary<string, double>> wlist = new List<Dictionary<string, double>>();
            wlist.Add(frequencyWordDict.ToDictionary(i => i.Key, i => (double)i.Value));
            var d = wlist.MergeDictionaries<string>();
            var m = d.Select(i => new { i.Key, v = i.Value[0] }).ToList();
            var c = m.OrderByDescending(i => i.v).ToList();

            double[,] clusters = new double[,]
            {
                //{ 14.8f, 0.96f, 3.29 }
                //{ 1, 10, 0.2f, 2 }
                //{ 10, 0.1f, 1 }
                { 25 },
                //{ 10 },
                { 5 }
            };
            ClasterAnalysis<string> ca = new ClasterAnalysis<string>(d, 0.000000000000000000000000001, 1.5f, 10000, clusters);
            var res = ca.Clusterize();

            var n = (
                from i in c
                join j in res on i.Key equals j.Key
                select new { word = i.Key, values = j.Value, count = i.v }
            ).ToList();
            //var r = res.Where(i => i.Key.FirstWord == "взаимодействие");*/
        }
开发者ID:CrazyBread,项目名称:TextHandler,代码行数:79,代码来源:Program.cs


注:本文中的API.GetDataReady方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。