Creates a new language analysis.
Example of the general usage of language analyses:
Namespace: Ankiro.SearchServer.Web.ServicesExamples
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using Ankiro.Suite.Client.LanguageAnalyzeService; using Ankiro.Suite.Client.ManagementService; using Ankiro.SearchServer.Data.Language; using Ankiro.SearchServer.Data; namespace Ankiro.Suite.Client.LanguageSample { public class CreateLanguageAnalysisSample { private readonly ManagementWebServiceClient _managementService; private readonly LanguageAnalyzeWebService _languageAnalyzeService; private readonly string _analyseName; public CreateLanguageAnalysisSample( ManagementWebServiceClient managementService, LanguageAnalyzeWebService languageAnalyzeService, string analyseName ) { _managementService = managementService; _languageAnalyzeService = languageAnalyzeService; _analyseName = analyseName; } public LanguageAnalysisData CreateLanguageAnalysis(ThesaurusData thesaurusPrimary, ThesaurusData thesaurusSecondary, string indexName, IEnumerable<string> propertyNames) { ServerIndexData index = _managementService.GetIndexByName(indexName); if (index == null) throw new InvalidOperationException("Index does not exist."); // The id of the thesaurus which will be used as a source of existing words, // and eventual destination of identified words. // Select the set of index property id's that should be processed by this language analysis var analysis = new LanguageAnalysisData { Name = _analyseName, PrimaryThesaurusId = thesaurusPrimary.Id, SecondaryThesaurusId = thesaurusSecondary.Id, IndexPropertyIds = index.Properties.Where(x => propertyNames.Contains(x.Name)).Select(x => x.Id).ToList() }; // Create the language analysis, and refresh the local copy to get creation id of analysis instance analysis = _languageAnalyzeService.CreateLanguageAnalysis(analysis); var analysisParameters = new LanguageAnalysisParametersData { LanguageAnalysisId = analysis.Id, Type = LanguageAnalysisType.Standard, Flags = WordAnalyzeFlags.All, PercentageOfDocumentsToAnalyze = 100, PercentageOfFrequencyTermsToSave = 100, MinimumTermFrequencyToSave = 1, MinimumTermFrequencyToMarkForThesaurusInclusion = 1 }; _languageAnalyzeService.RunLanguageAnalysis(analysisParameters); analysis = _languageAnalyzeService.GetLanguageAnalysis(analysis.Id); LanguageAnalysisSessionData session = _languageAnalyzeService.GetLanguageAnalysisSessions(analysis.Id).LastOrDefault(); if (session == null) throw new ApplicationException("Language analysis failed."); Console.WriteLine("Total number of distinct known words: " + session.KnownWordCount); return analysis; } } }
Assembly: Ankiro.SearchServer.Web (in Ankiro.SearchServer.Web.dll) Version: 1.13.770.19253 (1.13.770.19253)
Syntax
Parameters
- analysis
- Type: Ankiro.SearchServer.Data.Language LanguageAnalysisData
Return Value
Type: LanguageAnalysisDataSee Also