Skip to content

Commit

Permalink
[KO NumberWithUnit] Korean Temperature refinements (#2830)
Browse files Browse the repository at this point in the history
* Korean Temperature refinements

* Fixed failing Duration cases due to unit change

Co-authored-by: aitelint <[email protected]>
  • Loading branch information
aitelint and aitelint authored Jan 11, 2022
1 parent f4744ce commit e6d72a0
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public static class NumbersDefinitions
public static readonly string TwoNumberRangeRegex5 = $@"(?<number1>([십백천만억조경열]|(영|령|공|일|이(?!다)|두|삼|사|오|육|(?<!며)칠|팔|구))+)\s*{TillRegex}\s*(?<number2>([십백천만억조경열]|(영|령|공|일|이(?!다)|두|삼|사|오|육|칠|팔|구))+)\s*([십백천만억조경열]|((미만|적|낮|작|더적|더낮|더적|이하이다|까지|아래))+)";
public static readonly string TwoNumberRangeRegex6 = $@"((?<number1>((?!((,(?!\d+))|(,(?!\d+))|。|\D)).)+)\s*{TillRegex}+\s*(?<number2>((?!((,(?!\d+))|(,(?!\d+))|。)).)+)\s*(까지))";
public static readonly string TwoNumberRangeRegex7 = $@"({OneNumberRangeMoreRegex2}\s*{OneNumberRangeLessRegex5})";
public const string InexactNumberUnitRegex = @"(몇|며|여러)";
public const string InexactNumberUnitRegex = @"(몇(?!.+\?)|며|여러)";
public static readonly Dictionary<string, string> RelativeReferenceOffsetMap = new Dictionary<string, string>
{
{ @"마지막", @"0" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static class NumbersWithUnitDefinitions
public const string BuildPrefix = @"";
public const string BuildSuffix = @"";
public const string ConnectorToken = @"";
public const bool CheckFirstSuffix = true;
public static readonly Dictionary<string, string> CurrencySuffixList = new Dictionary<string, string>
{
{ @"Afghan afghani", @"아프가니" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public TemperatureParserConfiguration(CultureInfo ci)
{
this.BindDictionary(NumbersWithUnitDefinitions.TemperaturePrefixList);
this.BindDictionary(NumbersWithUnitDefinitions.TemperatureSuffixList);
this.CheckFirstSuffix = NumbersWithUnitDefinitions.CheckFirstSuffix;
}
}
}
2 changes: 1 addition & 1 deletion Patterns/Korean/Korean-Numbers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ TwoNumberRangeRegex7: !nestedRegex
def: ({OneNumberRangeMoreRegex2}\s*{OneNumberRangeLessRegex5})
references: [OneNumberRangeMoreRegex2, OneNumberRangeLessRegex5]
InexactNumberUnitRegex: !simpleRegex
def: (몇|며|여러)
def: (몇(?!.+\?)|며|여러)
RelativeReferenceOffsetMap: !dictionary
types: [ string, string ]
entries:
Expand Down
1 change: 1 addition & 0 deletions Patterns/Korean/Korean-NumbersWithUnit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ AgeSuffixList: !dictionary
BuildPrefix: ''
BuildSuffix: ''
ConnectorToken: ''
CheckFirstSuffix: !bool true
#CurrencyExtractorConfiguration
CurrencySuffixList: !dictionary
types: [string, string]
Expand Down
50 changes: 1 addition & 49 deletions Specs/NumberWithUnit/Korean/TemperatureModel.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[
{
"Input": "외부 온도는 섭씨 40도입니다. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -19,8 +17,6 @@
},
{
"Input": "텍사스는 화씨 90도입니다. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -37,8 +33,6 @@
},
{
"Input": "화씨 마이너스 5도",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -55,8 +49,6 @@
},
{
"Input": "섭씨 6도",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -73,8 +65,6 @@
},
{
"Input": "화씨 98.6도는 정상 온도입니다. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -91,8 +81,6 @@
},
{
"Input": "온도를 섭씨 30도로 설정하십시오. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -109,8 +97,6 @@
},
{
"Input": "정상 온도는 화씨 98.6도입니다. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -127,8 +113,6 @@
},
{
"Input": "화씨 100 도 ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -145,8 +129,6 @@
},
{
"Input": "섭씨 20 도 ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -163,8 +145,6 @@
},
{
"Input": "화씨 100.2도는 낮다. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -181,16 +161,14 @@
},
{
"Input": "10.5도 ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
"Text": "10.5도",
"TypeName": "temperature",
"Resolution": {
"value": "10.5",
"unit": "C"
"unit": "Degree"
},
"Start": 0,
"End": 4
Expand All @@ -199,8 +177,6 @@
},
{
"Input": "섭씨 20도 ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand Down Expand Up @@ -297,8 +273,6 @@
},
{
"Input": "온도를 화씨 70도로 설정하세요. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand Down Expand Up @@ -347,8 +321,6 @@
},
{
"Input": "온도를 화씨 75도로 유지하세요. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -365,8 +337,6 @@
},
{
"Input": "온도를 섭씨 40도로 하세요.",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand Down Expand Up @@ -399,8 +369,6 @@
},
{
"Input": "섭씨 10도를 화씨로 변환하세요. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -427,8 +395,6 @@
},
{
"Input": "섭씨 34.9도를 화씨로",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -455,8 +421,6 @@
},
{
"Input": "섭씨 200도를 화씨로 변환하세요. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -483,8 +447,6 @@
},
{
"Input": "화씨를 섭씨로 화씨 101도는 섭씨 몇 도입니까? ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand Down Expand Up @@ -531,8 +493,6 @@
},
{
"Input": "섭씨 50도 섭씨를 화씨로 ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand Down Expand Up @@ -569,8 +529,6 @@
},
{
"Input": "화씨 51도를 섭씨로 변환해 주시겠습니까?",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -597,8 +555,6 @@
},
{
"Input": "화씨 106도를 섭씨로 변환하세요. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -625,8 +581,6 @@
},
{
"Input": "화씨 45도를 섭씨로 변환하세요. ",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand All @@ -653,8 +607,6 @@
},
{
"Input": "화씨 마이너스 20도를 섭씨로 어떻게 변환하나요?",
"Comment": "The unit is split around the number (e.g. '섭씨 40도' = 'Celsius 40 degree') but only the last unit in the suffix is used to determine the unit type.",
"IgnoreResolution": true,
"NotSupportedByDesign": "javascript,python,java",
"Results": [
{
Expand Down

0 comments on commit e6d72a0

Please sign in to comment.