Skip to content

Commit 521bd5c

Browse files
committed
Address comment
1 parent 4ffa12b commit 521bd5c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Microsoft.ML.Transforms/Text/NgramHashingTransformer.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,8 @@ public ColumnOptions(string name,
946946
throw Contracts.ExceptParam(nameof(numberOfBits), $"Cannot support invertHash for a {0} bit hash. 30 is the maximum possible.", numberOfBits);
947947

948948
if (ngramLength == 1 && skipLength != 0)
949-
throw Contracts.ExceptUserArg(nameof(skipLength), $"Number of skips can only be zero when the maximum n-gram's length is one.");
949+
throw Contracts.ExceptUserArg(nameof(skipLength), string.Format(
950+
"{0} (actual value: {1}) can only be zero when {2} set to one.", nameof(skipLength), skipLength, nameof(ngramLength)));
950951
if (ngramLength + skipLength > NgramBufferBuilder.MaxSkipNgramLength)
951952
{
952953
throw Contracts.ExceptUserArg(nameof(skipLength),

src/Microsoft.ML.Transforms/Text/NgramTransform.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,8 @@ internal ColumnOptions(string name,
847847
string inputColumnName = null)
848848
{
849849
if (ngramLength == 1 && skipLength != 0)
850-
throw Contracts.ExceptUserArg(nameof(skipLength), $"Number of skips can only be zero when the maximum n-gram's length is one.");
850+
throw Contracts.ExceptUserArg(nameof(skipLength), string.Format(
851+
"{0} (actual value: {1}) can only be zero when {2} set to one.", nameof(skipLength), skipLength, nameof(ngramLength)));
851852
if (ngramLength + skipLength > NgramBufferBuilder.MaxSkipNgramLength)
852853
throw Contracts.ExceptUserArg(nameof(skipLength),
853854
$"The sum of skipLength and ngramLength must be less than or equal to {NgramBufferBuilder.MaxSkipNgramLength}");

0 commit comments

Comments
 (0)