Esempio n. 1
0
        protected HtmlDocumentParser(
            IHtmlLoader htmlLoader,
            IRecipeNameGenerator nameGenerator,
            INameUnicityOverseer nameUnicityOverseer,
            Func <CultureInfo, IActionDetector> actionDetectorFactory,
            Func <CultureInfo, ITimerDetector> timerDetectorFactory,
            Func <CultureInfo, IMeasureUnitDetector> measureUnitDetectorFactory,
            Func <CultureInfo, ILanguageHelper> languageHelperFactory,
            Func <CultureInfo, ISubrecipeRepository> subrecipeRepositoryFactory)
        {
            this._htmlLoader                 = htmlLoader;
            this._nameGenerator              = nameGenerator;
            this._nameUnicityOverseer        = nameUnicityOverseer;
            this._actionDetectorFactory      = actionDetectorFactory;
            this._timerDetectorFactory       = timerDetectorFactory;
            this._measureUnitDetectorFactory = measureUnitDetectorFactory;
            this._languageHelperFactory      = languageHelperFactory;
            this._subrecipeRepositoryFactory = subrecipeRepositoryFactory;

            if (this._htmlLoader != null)
            {
                this._htmlLoader.Initialize();
            }

            this.Base = new TBase();

            // TODO Localize and put somewhere else
            this._quantityExpression       = new Regex(@"[\xbc-\xbe\w]+[\xbc-\xbe\w'’,./]*", RegexOptions.Compiled);
            this._quantityRangeExpression  = new Regex(@"((ou|à) [\xbc-\xbe0-9]+[\xbc-\xbe0-9'’,./]* )", RegexOptions.Compiled);
            this._ingredientExpression     = new Regex(@"(?<=[a-zA-Z0-9\u00C0-\u017F\s()'’\-\/%] de | d'| d’)([a-zA-Z0-9\u00C0-\u017F\s()'’\-\/%]+)(, [,\w\s]+)*", RegexOptions.Compiled);
            this._ingredientFullExpression = new Regex(@"([a-zA-Z0-9\u00C0-\u017F\s()'’\-\/%]+)(, [,\w\s]+)*", RegexOptions.Compiled);
            this._ingredientUnitExpression = new Regex(@"(?<=[a-zA-Z0-9\u00C0-\u017F\s()'’\-\/%])([a-zA-Z0-9\u00C0-\u017F\s()'’\-\/%]+)(, [,\w\s]+)*", RegexOptions.Compiled);
        }
Esempio n. 2
0
 public RicardoParser(
     IHtmlLoader htmlLoader,
     IRecipeNameGenerator nameGenerator,
     INameUnicityOverseer nameUnicityOverseer,
     Func <CultureInfo, IActionDetector> actionDetectorFactory,
     Func <CultureInfo, ITimerDetector> timerDetectorFactory,
     Func <CultureInfo, IMeasureUnitDetector> measureUnitDetectorFactory,
     Func <CultureInfo, ILanguageHelper> languageHelperFactory,
     Func <CultureInfo, ISubrecipeRepository> subrecipeRepositoryFactory)
     : base(htmlLoader, nameGenerator, nameUnicityOverseer, actionDetectorFactory, timerDetectorFactory, measureUnitDetectorFactory, languageHelperFactory, subrecipeRepositoryFactory)
 {
 }
Esempio n. 3
0
 public RecipeNameController(IQuickRecipeRepository repo, IRecipeNameGenerator nameGenerator, INameUnicityOverseer nameUnicityOverseer)
 {
     this._repo                = repo;
     this._nameGenerator       = nameGenerator;
     this._nameUnicityOverseer = nameUnicityOverseer;
 }