private SequenceRecognizer(SequenceOptions options) { RegisterModel(Culture.English, options.ToString(), new Dictionary <Type, IModel> { [typeof(PhoneNumberModel)] = new PhoneNumberModel(new PhoneNumberParser(), new PhoneNumberExtractor()) }); }
public EnglishPhoneNumberExtractorConfiguration(SequenceOptions options) : base(options) { WordBoundariesRegex = BasePhoneNumbers.WordBoundariesRegex; NonWordBoundariesRegex = BasePhoneNumbers.NonWordBoundariesRegex; EndWordBoundariesRegex = BasePhoneNumbers.EndWordBoundariesRegex; }
protected override void OnSingleInitialization() { var seqOptions = attributes.GetAttribute <SeqAttribute>(); options = new SequenceOptions(seqOptions != null ? seqOptions.options : SeqOpt.None); options.Advanced = options.Advanced || attributes.AnyIs <AdvancedAttribute>(); options.Readonly = options.Readonly || attributes.AnyIs <ReadonlyAttribute>(); // Sequence name { var formatMember = attributes.GetAttribute <FormatMemberAttribute>(); if (formatMember != null) { sequenceName = formatMember.Format(niceName, memberType.GetNiceName()); } else { sequenceName = niceName + " (" + memberType.GetNiceName() + ")"; } if (options.Readonly) { sequenceName += " (Readonly)"; } } advancedKey = id + sequenceName + "advanced"; perItemDrawing = attributes.AnyIs <PerItemAttribute>(); shouldDrawAddingArea = !options.Readonly && elementType.IsA <UnityObject>(); }
public ChinesePhoneNumberExtractorConfiguration(SequenceOptions options) : base(options) { WordBoundariesRegex = PhoneNumbersDefinitions.WordBoundariesRegex; NonWordBoundariesRegex = PhoneNumbersDefinitions.NonWordBoundariesRegex; EndWordBoundariesRegex = PhoneNumbersDefinitions.EndWordBoundariesRegex; }
public TestSequenceRecognizerInitialization() { var config = new SequenceOptions(); controlModel = new PhoneNumberModel( new English.PhoneNumberParser(), new BasePhoneNumberExtractor(new EnglishPhoneNumberExtractorConfiguration(config))); }
public SqlServerSequence(SequenceOptions options) : this() { StartAt = options.StartAt; CurrentValue = StartAt; Increment = options.Increment; MaxValue = options.MaxValue; MinValue = options.MinValue; Cycle = options.Cycle; }
public ChinesePhoneNumberExtractorConfiguration(SequenceOptions options) : base(options) { WordBoundariesRegex = PhoneNumbersDefinitions.WordBoundariesRegex; NonWordBoundariesRegex = PhoneNumbersDefinitions.NonWordBoundariesRegex; EndWordBoundariesRegex = PhoneNumbersDefinitions.EndWordBoundariesRegex; ColonPrefixCheckRegex = new Regex(PhoneNumbersDefinitions.ColonPrefixCheckRegex); ForbiddenPrefixMarkers = (List <char>)PhoneNumbersDefinitions.ForbiddenPrefixMarkers; }
public Sequence(SequenceOptions options):this() { StartAt = options.StartAt; CurrentValue = StartAt; Increment = options.Increment; MaxValue = options.MaxValue; MinValue = options.MinValue; Cycle = options.Cycle; }
public SequenceTableEntity(SequenceOptions options) : this() { StartAt = options.StartAt; CurrentValue = StartAt; Increment = options.Increment; MaxValue = options.MaxValue; MinValue = options.MinValue; Cycle = options.Cycle; }
public BasePhoneNumberExtractorConfiguration(SequenceOptions options) : base(options) { WordBoundariesRegex = BasePhoneNumbers.WordBoundariesRegex; NonWordBoundariesRegex = BasePhoneNumbers.NonWordBoundariesRegex; EndWordBoundariesRegex = BasePhoneNumbers.EndWordBoundariesRegex; ColonPrefixCheckRegex = new Regex(BasePhoneNumbers.ColonPrefixCheckRegex); ColonMarkers = (List <char>)BasePhoneNumbers.ColonMarkers; ForbiddenPrefixMarkers = (List <char>)BasePhoneNumbers.ForbiddenPrefixMarkers; ForbiddenSuffixMarkers = (List <char>)BasePhoneNumbers.ForbiddenSuffixMarkers; }
public BasePhoneNumberExtractorConfiguration(SequenceOptions options) : base(options) { WordBoundariesRegex = BasePhoneNumbers.WordBoundariesRegex; NonWordBoundariesRegex = BasePhoneNumbers.NonWordBoundariesRegex; EndWordBoundariesRegex = BasePhoneNumbers.EndWordBoundariesRegex; ColonPrefixCheckRegex = new Regex(BasePhoneNumbers.ColonPrefixCheckRegex); ColonMarkers = (List <char>)BasePhoneNumbers.ColonMarkers; ForbiddenPrefixMarkers = (List <char>)BasePhoneNumbers.ForbiddenPrefixMarkers; ForbiddenSuffixMarkers = (List <char>)BasePhoneNumbers.ForbiddenSuffixMarkers; AmbiguityFiltersDict = AmbiguityFiltersDict = DefinitionLoader.LoadAmbiguityFilters(BasePhoneNumbers.AmbiguityFiltersDict); }
public void Parse_sequence_verb_with_multi_instance_returns_verb_instance() { var expected = new SequenceOptions { LongSequence = new long[] { }, StringSequence = new[] { "s1", "s2" } }; var result = InvokeChoose( new[] { typeof(Add_Verb), typeof(Commit_Verb), typeof(Clone_Verb), typeof(SequenceOptions) }, new[] { "sequence", "-s", "s1", "-s", "s2" }, true); Assert.IsType <SequenceOptions>(((Parsed <object>)result).Value); expected.Should().BeEquivalentTo(((Parsed <object>)result).Value); }
public EnglishQuotedTextExtractorConfiguration(SequenceOptions options) : base(options) { QuotedTextRegex1 = new Regex(QuotedTextDefinitions.QuotedTextRegex1, RegexOptions.Compiled); QuotedTextRegex2 = new Regex(QuotedTextDefinitions.QuotedTextRegex2, RegexOptions.Compiled); QuotedTextRegex3 = new Regex(QuotedTextDefinitions.QuotedTextRegex3, RegexOptions.Compiled); QuotedTextRegex4 = new Regex(QuotedTextDefinitions.QuotedTextRegex4, RegexOptions.Compiled); QuotedTextRegex5 = new Regex(QuotedTextDefinitions.QuotedTextRegex5, RegexOptions.Compiled); QuotedTextRegex6 = new Regex(QuotedTextDefinitions.QuotedTextRegex6, RegexOptions.Compiled); QuotedTextRegex7 = new Regex(QuotedTextDefinitions.QuotedTextRegex7, RegexOptions.Compiled); QuotedTextRegex8 = new Regex(QuotedTextDefinitions.QuotedTextRegex8, RegexOptions.Compiled); QuotedTextRegex9 = new Regex(QuotedTextDefinitions.QuotedTextRegex9, RegexOptions.Compiled); }
private static async Task <ISequence> CreateSequence(IStateProvider stateProvider, int increment = 1, int startAt = 0, long maxValue = long.MaxValue, long minValue = long.MinValue, bool cycle = false) { var options = new SequenceOptions { Increment = increment, StartAt = startAt, MaxValue = maxValue, Cycle = cycle, MinValue = minValue }; var sequence = await stateProvider.NewAsync(options); return(sequence); }
private static async Task<ISequence> CreateSequence(IStateProvider stateProvider, int increment = 1, int startAt = 0, long maxValue = long.MaxValue, long minValue = long.MinValue,bool cycle = false ) { var options = new SequenceOptions { Increment = increment, StartAt = startAt, MaxValue = maxValue, Cycle = cycle, MinValue = minValue }; var sequence = await stateProvider.NewAsync(options); return sequence; }
protected override void Initialize() { var displayAttr = attributes.GetAttribute <DisplayAttribute>(); _options = new SequenceOptions(displayAttr != null ? displayAttr.SeqOpt : Seq.None); if (_options.Readonly) { displayText += " (Readonly)"; } _advancedKey = RuntimeHelper.CombineHashCodes(id, "advanced"); _perItemDrawing = attributes.AnyIs <PerItemAttribute>(); _shouldDrawAddingArea = !_options.Readonly && _elementType.IsA <UnityObject>(); }
public void Parse_sequence_verb_returns_verb_instance() { // Fixture setup var expected = new SequenceOptions { LongSequence = new long[] { }, StringSequence = new[] { "aa", "b" } }; // Exercize system var result = InvokeChoose( new[] { typeof(Add_Verb), typeof(Commit_Verb), typeof(Clone_Verb), typeof(SequenceOptions) }, new[] { "sequence", "-s", "aa", "b" }); // Verify outcome Assert.IsType <SequenceOptions>(((Parsed <object>)result).Value); expected.Should().BeEquivalentTo(((Parsed <object>)result).Value); // Teardown }
public void Parse_sequence_verb_with_separator_returns_verb_instance(string[] arguments, string[] expectedString) { // Fixture setup var expected = new SequenceOptions { LongSequence = new long[] { }, StringSequence = expectedString }; // Exercize system var result = InvokeChoose( new[] { typeof(Add_Verb), typeof(Commit_Verb), typeof(Clone_Verb), typeof(SequenceOptions) }, arguments); // Verify outcome Assert.IsType <SequenceOptions>(((Parsed <object>)result).Value); expected.Should().BeEquivalentTo(((Parsed <object>)result).Value); // Teardown }
public void Parse_sequence_verb_with_separator_returns_verb_instance(string[] arguments, string[] expectedString) { // Fixture setup var expected = new SequenceOptions { LongSequence = new long[] { }, StringSequence = expectedString }; // Exercize system var result = InstanceChooser.Choose( new[] { typeof(AddOptions), typeof(CommitOptions), typeof(CloneOptions), typeof(SequenceOptions) }, arguments, StringComparer.Ordinal, CultureInfo.InvariantCulture); // Verify outcome Assert.IsType <SequenceOptions>(result.Value); expected.ShouldBeEquivalentTo(result.Value); // Teardown }
protected override void Initialize() { var displayAttr = attributes.GetAttribute <DisplayAttribute>(); _options = new SequenceOptions(displayAttr != null ? displayAttr.SeqOpt : Seq.None); if (_options.Readonly) { displayText += " (Readonly)"; } _advancedKey = RuntimeHelper.CombineHashCodes(id, "advanced"); _shouldDrawAddingArea = !_options.Readonly && _elementType.IsA <UnityObject>(); var perItem = attributes.GetAttribute <PerItemAttribute>(); if (perItem != null) { if (perItem.ExplicitAttributes == null) { _perItemAttributes = attributes.Where(x => !(x is PerItemAttribute)).ToArray(); } else { _perItemAttributes = attributes.Where(x => perItem.ExplicitAttributes.Contains(x.GetType().Name.Replace("Attribute", ""))).ToArray(); } } if (_options.Filter) { _filter = new TextFilter(null, id, true, null); } _originalDisplay = displayText; if (memberValue == null) { memberValue = GetNew(); } member.CollectionCount = memberValue.Count; }
public void Parse_sequence_verb_returns_verb_instance() { // Fixture setup var expected = new SequenceOptions { LongSequence = new long[] { }, StringSequence = new[] { "aa", "b" } }; // Exercize system var result = InstanceChooser.Choose( new[] { typeof(Add_Verb), typeof(Commit_Verb), typeof(Clone_Verb), typeof(SequenceOptions) }, new[] { "sequence", "-s", "aa", "b" }, StringComparer.Ordinal, CultureInfo.InvariantCulture, Enumerable.Empty <ErrorType>()); // Verify outcome Assert.IsType <SequenceOptions>(((Parsed <object>)result).Value); expected.ShouldBeEquivalentTo(((Parsed <object>)result).Value); // Teardown }
public ChineseIpExtractorConfiguration(SequenceOptions options) : base(options) { Ipv4Regex = RegexCache.Get(IpDefinitions.Ipv4Regex, RegexOptions.Compiled); Ipv6Regex = RegexCache.Get(IpDefinitions.Ipv6Regex, RegexOptions.Compiled); }
public EnglishURLExtractorConfiguration(SequenceOptions options) : base(options) { IpUrlRegex = new Regex(BaseURL.IpUrlRegex, RegexOptions.Compiled); UrlRegex = new Regex(BaseURL.UrlRegex, RegexOptions.Compiled); }
public PhoneNumberConfiguration(SequenceOptions options = SequenceOptions.None) { Options = options; }
public SpanishPhoneNumberExtractorConfiguration(SequenceOptions options) : base(options) { FalsePositivePrefixRegex = null; }
public EnglishPhoneNumberExtractorConfiguration(SequenceOptions options) : base(options) { FalsePositivePrefixRegex = new Regex(PhoneNumbersDefinitions.FalsePositivePrefixRegex); }
public URLConfiguration(SequenceOptions options = SequenceOptions.None) { Options = options; }
private SequenceRecognizer(SequenceOptions options) { RegisterModel(Culture.English, options.ToString(), new Dictionary <Type, IModel> { }); }
public ChineseURLExtractorConfiguration(SequenceOptions options) : base(options) { UrlRegex = RegexCache.Get(URLDefinitions.UrlRegex, RegexOptions.Compiled); IpUrlRegex = RegexCache.Get(URLDefinitions.IpUrlRegex, RegexOptions.Compiled); }
public async Task <ISequence> NewAsync(SequenceOptions options) { return(await Task.FromResult(new SqlServerSequence(options))); }
public async Task<ISequence> NewAsync(SequenceOptions options) { return await Task.FromResult(new Sequence(options)); }
public BaseSequenceConfiguration(SequenceOptions options = SequenceOptions.None) { Options = options; }
public async Task <ISequence> NewAsync(SequenceOptions options) { var sequence = new SequenceTableEntity(options); return(await Task.FromResult(sequence)); }