问题描述
尝试将 customInfoType 与 hotwordRule 结合使用。配置如下所示(取自 nodeJS
实现):
自定义信息类型:
const customConfig = [{
infoType: {
name: 'CZECH_ID'
},regex: {
pattern: /[0-9]{2,6}-?[0-9]{2,10}\/[0-9]{4}/
},likelihood: 'POSSIBLE'
}];
自定义规则集:
const customRuleSet = [{
infoTypes: [{ name: 'CZECH_ID' }],rules: [
{
hotwordRule: {
hotwordRegex: {
pattern: /^CZID$/
}
},proximity: {
windowBefore: 10,windowAfter: 0
}
}
]
}]
这里是inspectConfig
:
const request = {
parent: `projects/${projectId}/locations/global`,inspectConfig: {
infoTypes: infoTypes,customInfoTypes: customConfig,ruleSet: customRuleSet,minLikelihood: 'POSSIBLE',limits: {
maxFindingsPerRequest: maxFindings,},includeQuote: true,item: item,};
运行时我得到:
Error: 3 INVALID_ARGUMENT: `window_before` and `window_after` cannot both be 0.
当我从它通过的运行配置中删除 customeRuleSet
时,虽然没有识别字符串。所以它必须对 proximity
部分做一些事情,但不确定有什么问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)