-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PhoneNumber] Add filter for "bank account" prefix (#1906)
- Loading branch information
Showing
62 changed files
with
981 additions
and
41 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
.NET/Microsoft.Recognizers.Definitions.Common/English/PhoneNumbersDefinitions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// | ||
// Generation parameters: | ||
// - DataFilename: Patterns\English\English-PhoneNumbers.yaml | ||
// - Language: English | ||
// - ClassName: PhoneNumbersDefinitions | ||
// </auto-generated> | ||
// | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// ------------------------------------------------------------------------------ | ||
|
||
namespace Microsoft.Recognizers.Definitions.English | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
public static class PhoneNumbersDefinitions | ||
{ | ||
public const string NumberReplaceToken = @"@builtin.phonenumber"; | ||
public const string FalsePositivePrefixRegex = @"(account|card)(\s+(#|number))?(\s+is)?:?\s*$"; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
.NET/Microsoft.Recognizers.Definitions.Common/English/PhoneNumbersDefinitions.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<#@ template debug="true" hostspecific="true" language="C#" #> | ||
<# | ||
this.DataFilename = @"Patterns\English\English-PhoneNumbers.yaml"; | ||
this.Language = "English"; | ||
this.ClassName = "PhoneNumbersDefinitions"; | ||
#> | ||
<#@ include file="..\CommonDefinitions.ttinclude"#> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
.NET/Microsoft.Recognizers.Definitions.Common/Portuguese/PhoneNumbersDefinitions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// | ||
// Generation parameters: | ||
// - DataFilename: Patterns\Portuguese\Portuguese-PhoneNumbers.yaml | ||
// - Language: Portuguese | ||
// - ClassName: PhoneNumbersDefinitions | ||
// </auto-generated> | ||
// | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// ------------------------------------------------------------------------------ | ||
|
||
namespace Microsoft.Recognizers.Definitions.Portuguese | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
public static class PhoneNumbersDefinitions | ||
{ | ||
public const string NumberReplaceToken = @"@builtin.phonenumber"; | ||
public const string FalsePositivePrefixRegex = @"conta(\s+(número|bancária(\s+número)?))?(\s+é)?:?\s*$"; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
.NET/Microsoft.Recognizers.Definitions.Common/Portuguese/PhoneNumbersDefinitions.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<#@ template debug="true" hostspecific="true" language="C#" #> | ||
<# | ||
this.DataFilename = @"Patterns\Portuguese\Portuguese-PhoneNumbers.yaml"; | ||
this.Language = "Portuguese"; | ||
this.ClassName = "PhoneNumbersDefinitions"; | ||
#> | ||
<#@ include file="..\CommonDefinitions.ttinclude"#> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.NET/Microsoft.Recognizers.Text.DataDrivenTests/Sequence/TestSequence_Dutch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Recognizers.Text.DataDrivenTests; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.Tests | ||
{ | ||
[TestClass] | ||
public class TestSequence_Dutch : TestBase | ||
{ | ||
[NetCoreTestDataSource] | ||
[TestMethod] | ||
public void PhoneNumberModel(TestModel testSpec) | ||
{ | ||
TestPhoneNumber(testSpec); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.NET/Microsoft.Recognizers.Text.DataDrivenTests/Sequence/TestSequence_French.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Recognizers.Text.DataDrivenTests; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.Tests | ||
{ | ||
[TestClass] | ||
public class TestSequence_French : TestBase | ||
{ | ||
[NetCoreTestDataSource] | ||
[TestMethod] | ||
public void PhoneNumberModel(TestModel testSpec) | ||
{ | ||
TestPhoneNumber(testSpec); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.NET/Microsoft.Recognizers.Text.DataDrivenTests/Sequence/TestSequence_German.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Recognizers.Text.DataDrivenTests; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.Tests | ||
{ | ||
[TestClass] | ||
public class TestSequence_German : TestBase | ||
{ | ||
[NetCoreTestDataSource] | ||
[TestMethod] | ||
public void PhoneNumberModel(TestModel testSpec) | ||
{ | ||
TestPhoneNumber(testSpec); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.NET/Microsoft.Recognizers.Text.DataDrivenTests/Sequence/TestSequence_Hindi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Recognizers.Text.DataDrivenTests; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.Tests | ||
{ | ||
[TestClass] | ||
public class TestSequence_Hindi : TestBase | ||
{ | ||
[NetCoreTestDataSource] | ||
[TestMethod] | ||
public void PhoneNumberModel(TestModel testSpec) | ||
{ | ||
TestPhoneNumber(testSpec); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.NET/Microsoft.Recognizers.Text.DataDrivenTests/Sequence/TestSequence_Italian.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Recognizers.Text.DataDrivenTests; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.Tests | ||
{ | ||
[TestClass] | ||
public class TestSequence_Italian : TestBase | ||
{ | ||
[NetCoreTestDataSource] | ||
[TestMethod] | ||
public void PhoneNumberModel(TestModel testSpec) | ||
{ | ||
TestPhoneNumber(testSpec); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.NET/Microsoft.Recognizers.Text.DataDrivenTests/Sequence/TestSequence_Korean.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Recognizers.Text.DataDrivenTests; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.Tests | ||
{ | ||
[TestClass] | ||
public class TestSequence_Korean : TestBase | ||
{ | ||
[NetCoreTestDataSource] | ||
[TestMethod] | ||
public void PhoneNumberModel(TestModel testSpec) | ||
{ | ||
TestPhoneNumber(testSpec); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.NET/Microsoft.Recognizers.Text.DataDrivenTests/Sequence/TestSequence_Spanish.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Recognizers.Text.DataDrivenTests; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.Tests | ||
{ | ||
[TestClass] | ||
public class TestSequence_Spanish : TestBase | ||
{ | ||
[NetCoreTestDataSource] | ||
[TestMethod] | ||
public void PhoneNumberModel(TestModel testSpec) | ||
{ | ||
TestPhoneNumber(testSpec); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.NET/Microsoft.Recognizers.Text.DataDrivenTests/Sequence/TestSequence_Turkish.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Recognizers.Text.DataDrivenTests; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.Tests | ||
{ | ||
[TestClass] | ||
public class TestSequence_Turkish : TestBase | ||
{ | ||
[NetCoreTestDataSource] | ||
[TestMethod] | ||
public void PhoneNumberModel(TestModel testSpec) | ||
{ | ||
TestPhoneNumber(testSpec); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
.NET/Microsoft.Recognizers.Text.Sequence/Dutch/DutchPhoneNumberExtractorConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Text.RegularExpressions; | ||
using Microsoft.Recognizers.Definitions.Dutch; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.Dutch | ||
{ | ||
public class DutchPhoneNumberExtractorConfiguration : BasePhoneNumberExtractorConfiguration | ||
{ | ||
public DutchPhoneNumberExtractorConfiguration(SequenceOptions options) | ||
: base(options) | ||
{ | ||
FalsePositivePrefixRegex = null; | ||
} | ||
} | ||
} |
15 changes: 4 additions & 11 deletions
15
....Recognizers.Text.Sequence/English/Extractors/EnglishPhoneNumberExtractorConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
using Microsoft.Recognizers.Definitions; | ||
using System.Text.RegularExpressions; | ||
using Microsoft.Recognizers.Definitions.English; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.English | ||
{ | ||
public class EnglishPhoneNumberExtractorConfiguration : PhoneNumberConfiguration | ||
public class EnglishPhoneNumberExtractorConfiguration : BasePhoneNumberExtractorConfiguration | ||
{ | ||
public EnglishPhoneNumberExtractorConfiguration(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; | ||
FalsePositivePrefixRegex = new Regex(PhoneNumbersDefinitions.FalsePositivePrefixRegex); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
.NET/Microsoft.Recognizers.Text.Sequence/Extractors/BasePhoneNumberExtractorConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
using Microsoft.Recognizers.Definitions; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence | ||
{ | ||
public class BasePhoneNumberExtractorConfiguration : PhoneNumberConfiguration | ||
{ | ||
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; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
.NET/Microsoft.Recognizers.Text.Sequence/French/FrenchPhoneNumberExtractorConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Text.RegularExpressions; | ||
using Microsoft.Recognizers.Definitions.French; | ||
|
||
namespace Microsoft.Recognizers.Text.Sequence.French | ||
{ | ||
public class FrenchPhoneNumberExtractorConfiguration : BasePhoneNumberExtractorConfiguration | ||
{ | ||
public FrenchPhoneNumberExtractorConfiguration(SequenceOptions options) | ||
: base(options) | ||
{ | ||
FalsePositivePrefixRegex = null; | ||
} | ||
} | ||
} |
Oops, something went wrong.