public TextController(TextResourceManager textResourceManager, ITextConverter textConverter, SearchManager searchManager, IPageWithHtmlTagsCreator pageWithHtmlTagsCreator) { m_textResourceManager = textResourceManager; m_textConverter = textConverter; m_searchManager = searchManager; m_pageWithHtmlTagsCreator = pageWithHtmlTagsCreator; }
public UpdateService(IShopService shopService, IBotService botService, ITrackingRepository trackingRepository, ITextConverter textConverter) { _shopService = shopService ?? throw new ArgumentNullException(nameof(shopService)); _botService = botService ?? throw new ArgumentNullException(nameof(botService)); _trackingRepository = trackingRepository ?? throw new ArgumentNullException(nameof(trackingRepository)); _textConverter = textConverter ?? throw new ArgumentNullException(nameof(textConverter)); }
internal Collection(string tag, ITextRepository textRepository, ITextConverter textConverter) { ValidateCollectionName(tag); this.tag = tag; this.textRepository = textRepository; TextConverter = textConverter; }
public string Convert(ITextConverter converter) { if (converter == null) { throw new ArgumentNullException($"{nameof(converter)} is null."); } return(converter.Convert(parts)); }
static void Train_Test(string train, string test, ITextConverter textConverter) { string path = Path.Combine(Constants.SPP_RootPath, @"model\Sentiment"); new LearnerConsole(path, textConverter, classifier).Learn(train, true, true, c_coll); string root = Constants.SPP_RootPath; Test(root, test, textConverter); }
/// <summary> /// Host a new network server /// </summary> /// <param name="directory">Path server will save data to /// <para>Example: @"C:\MyTemp\Embark\Server\"</para></param> /// <param name="port">port to use, default set to 8030</param> /// <param name="textConverter">Custom converter between objects and text. /// <para>If parameter is NULL, the textConverter is set to default json converter.</para> /// </param> public Server(string directory, int port = 8030, ITextConverter textConverter = null) { if (textConverter == null) textConverter = new JavascriptSerializerTextConverter(); var store = new DiskDataStore(directory); var textRepository = new LocalRepository(store, textConverter); Uri url = new Uri("http://localhost:" + port + "/embark/"); webHost = new WebServiceHost(textRepository, url); }
public LocalRepository(IDataStore dataStore, ITextConverter textComparer) { this.dataStore = dataStore; this.textComparer = textComparer; var futureTimeStamp = System.DateTime.Now.AddMilliseconds(100).Ticks; keyProvider = new DocumentKeySource(futureTimeStamp); hashLock = new HashLock(avaliableLocks: 2000); }
private void RaiseIfArgumentsAreIncorrect(IDirectionChooser <TextType> chooser, ITextConverter <TextPart, MdConvertedItem> converter) { if (chooser == null) { throw new ArgumentException("Chooser can't be null"); } if (converter == null) { throw new ArgumentException("Converter can't be null"); } }
public static async Task <string> Translate(this ITurnContext context, string text) { string translateText = text; ITextConverter textConverter = context.Get <ITextConverter>(); if (textConverter != null) { var language = GetLanguageForTranslate(context); translateText = await textConverter.Translate(language, text); } return(translateText); }
/// <summary> /// Host a new network server /// </summary> /// <param name="directory">Path server will save data to /// <para>Example: @"C:\MyTemp\Embark\Server\"</para></param> /// <param name="port">port to use, default set to 8030</param> /// <param name="textConverter">Custom converter between objects and text. /// <para>If parameter is NULL, the textConverter is set to default json converter.</para> /// </param> public Server(string directory, int port = 8030, ITextConverter textConverter = null) { if (textConverter == null) { textConverter = new JavascriptSerializerTextConverter(); } var store = new DiskDataStore(directory); var textRepository = new LocalRepository(store, textConverter); Uri url = new Uri("http://localhost:" + port + "/embark/"); webHost = new WebServiceHost(textRepository, url); }
public static void ValidateUpload <T>(this ITextConverter converter, T sourceObject, string convertedText) { var reconvertedObject = converter.ToObject <object>(convertedText); var reconvertToText = converter.ToText(reconvertedObject); if (convertedText != reconvertToText) { throw new ArgumentException(string.Format("Could not convert {0} consistently.\r\n" + "Either the object is not a POCO with public get and set properties," + "or your ITextConverter {1} does not suppport the type {2}.", sourceObject.ToString(), converter.ToString(), typeof(T).ToString())); } }
static void Test(string path, string file, ITextConverter textConverter) { string root = Path.Combine(Constants.SPP_RootPath, @"model\sentiment\learning\"); string[] dirs = Directory.GetDirectories(root); int max = 0; foreach (string dir in dirs) { string name = Path.GetFileName(dir); bool run = true; foreach (char ch in name) { if (!char.IsDigit(ch)) { run = false; break; } } if (!run) { continue; } Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine("C VALUE AT: {0}", c_coll[Int32.Parse(name)]); Console.ResetColor(); SECoreImpl learnCoreImpl = CreateLearningCoreImpl(path, Int32.Parse(name)); ISemanticTagger lexiconTagger = new LexiconSentimentTagger(textConverter.Tokenizer); SentimentEngine engine = new SentimentEngine(textConverter, lexiconTagger, learnCoreImpl); SentimentEvaluator evaluator = new SentimentEvaluator(engine); evaluator.Evaluate(file, true, true); if (++max >= c_coll.Length) { break; } } }
public TimerService( ITrackingRepository trackingRepository, IPullAndBearClient pullAndBearClient, IBershkaClient bershkaClient, IBotService botService, ITextConverter textConverter, IUpdateInfoHelper updateInfoHelper) { _trackingRepository = trackingRepository ?? throw new ArgumentNullException(nameof(trackingRepository)); _pullAndBearClient = pullAndBearClient ?? throw new ArgumentNullException(nameof(pullAndBearClient)); _bershkaClient = bershkaClient ?? throw new ArgumentNullException(nameof(bershkaClient)); _botService = botService ?? throw new ArgumentNullException(nameof(botService)); _textConverter = textConverter ?? throw new ArgumentNullException(nameof(textConverter)); _updateInfoHelper = updateInfoHelper ?? throw new ArgumentNullException(nameof(updateInfoHelper)); var existedItems = _trackingRepository.GetItemsAsync().Result; itemsQueue = existedItems.Any() ? new Queue <Item>(existedItems) : new Queue <Item>(); timer = new Timer(10000); // 10 sec timer.Elapsed += OnTimedEvent; timer.AutoReset = true; timer.Enabled = true; }
public ArrayRunElementSegment(string name, ElementContentType type, int length, ITextConverter converter = null) => (Name, Type, Length, TextConverter) = (name, type, length, converter);
public RenderMdToHtml(IDirectionChooser <TextType> chooser, ITextConverter <TextPart, MdConvertedItem> converter) { RaiseIfArgumentsAreIncorrect(chooser, converter); this.chooser = chooser; this.converter = converter; }
public Subtitle(SubRip subrip) { _subFormat = subrip; _paragraphs = new List <Paragraph>(); FileName = "Untitled"; }
/// <summary> /// Modify a local database /// </summary> /// <param name="directory">The path of where to save data /// <para>Example: @"C:\MyTemp\Embark\Local\"</para> /// </param> /// <param name="textConverter">Custom converter between objects and text. /// <para>If parameter is NULL, the textConverter is set to default json converter.</para> /// </param> /// <returns>Client with db commands</returns>> public Client(string directory, ITextConverter textConverter = null) : this(new DiskDataStore(directory), textConverter) { }
/// <summary> /// Get a connection to a server database /// </summary> /// <param name="address">IP Address / DNS Name of server. Example: "220.114.0.12" or "srv-embark-live"</param> /// <param name="port">Port used by server</param> /// <param name="textConverter">Custom converter between objects and text used on the server /// <para>If parameter is NULL, the textConverter is set to default json converter.</para> /// </param> /// <returns>Client with db commands</returns>> public Client(string address, int port, ITextConverter textConverter = null) { this.textConverter = textConverter ?? new JavascriptSerializerTextConverter(); textRepository = new WebServiceRepository(address, port); }
/// <summary> /// Get a temporary in-memory-only database connection /// </summary> /// <returns>Runtime Client with db commands</returns> public static Client GetCachedDB(string directory, ITextConverter textConverter = null, int maxAsyncOperations = 100) => new Client(new CachedDataStore(directory, maxAsyncOperations), textConverter);
/// <summary> /// Modify a custom database /// </summary> /// <param name="dataStore">Custom data store implementation to save data</param> /// <param name="textConverter">Custom converter between objects and text. /// <para>If parameter is NULL, the textConverter is set to default json converter.</para> /// </param> /// <returns>Client with db commands</returns>> public Client(IDataStore dataStore, ITextConverter textConverter = null) { this.textConverter = textConverter ?? new JavascriptSerializerTextConverter(); textRepository = new LocalRepository(dataStore, this.textConverter); }
public BotSample(ITranslateHandler translateHandler, IDialogFactory dialogFactory, ILuisRecognizer recognizer, ITextConverter textConverter, BotAccessors botAccessors) : base(translateHandler, null, dialogFactory, recognizer, textConverter) { Dialogs = dialogFactory.UseDialogAccessor(botAccessors.DialogStateAccessor) .Create <StockDialog>() .Create <TextPrompt>("prompt") .Build(); }
/// <summary> /// Get a temporary in-memory-only database connection /// </summary> /// <returns>Runtime Client with db commands</returns> public static Client GetRuntimeDB(ITextConverter textConverter = null) => new Client(new RuntimeDataStore(), textConverter);
public LuisChatBot(ITranslateHandler translateHandler, IMessageRepository messageRepository, IDialogFactory dialogFactory, ILuisRecognizer recognizer, ITextConverter textConverter, ILogger <BotBase> logger) : this(translateHandler, messageRepository, dialogFactory, logger) { _recognizer = recognizer; _textConverter = textConverter; }
/// <summary> /// 为匹配的成员表达式添加转换器。 /// </summary> public CompositeJsonConverter <T> AddConverter <V>(Expression <Func <T, V> > expression, ITextConverter converter) { if (expression is LambdaExpression lambda) { if (lambda.Body is MemberExpression mbrExp && mbrExp.Member.MemberType == MemberTypes.Property) { _converters.Add(mbrExp.Member as PropertyInfo, converter); } } return(this); }
public LuisChatBot(ITranslateHandler translateHandler, IMessageRepository messageRepository, IDialogFactory dialogFactory, ILuisRecognizer recognizer, ITextConverter textConverter) : this(translateHandler, messageRepository, dialogFactory, recognizer, textConverter, null) { }
public BotDemo(ITranslateHandler translateHandler, IDialogFactory dialogFactory, ILuisRecognizer recognizer, ITextConverter textConverter, BotAccessors accessors) : base(translateHandler, null, dialogFactory, recognizer, textConverter) { Dialogs = dialogFactory.UseDialogAccessor(accessors.DialogStateAccessor) .Create <AvionDialog>(AvionDialog.ID, accessors.AvionStateAccessor) .Create <TextPrompt>("prompt") .Build(); }
public AnalyzeTextAppService() { textConveter = new TextConverter(); textEntityExtraction = new TextEntityExtraction(); textSentimentAnalyzer = new TextSentimentAnalyzer(); }