修改一个命名

This commit is contained in:
John Smith 2023-07-29 11:52:09 +08:00
parent 57ec8495e1
commit e478959a1b
3 changed files with 5 additions and 5 deletions

View File

@ -41,7 +41,7 @@ export class Trie {
return this.get(key) !== null
}
greedyMatch(str) {
lazyMatch(str) {
let node = this._root
for (let char of str) {
let nextNode = node.children[char]

View File

@ -272,7 +272,7 @@ export default {
let blockKeywordsTrie = this.blockKeywordsTrie
for (let i = 0; i < content.length; i++) {
let remainContent = content.substring(i)
if (blockKeywordsTrie.greedyMatch(remainContent) !== null) {
if (blockKeywordsTrie.lazyMatch(remainContent) !== null) {
return false
}
}
@ -327,7 +327,7 @@ export default {
let pos = 0
while (pos < data.content.length) {
let remainContent = data.content.substring(pos)
let matchEmoticon = emoticonsTrie.greedyMatch(remainContent)
let matchEmoticon = emoticonsTrie.lazyMatch(remainContent)
if (matchEmoticon === null) {
pos++
continue

View File

@ -446,7 +446,7 @@ class TencentTranslate(FlowControlTranslateProvider):
logger.warning('TencentTranslate request failed: status=%d %s', r.status, r.reason)
return None
data = (await r.json())['Response']
except (aiohttp.ClientError, asyncio.TimeoutError):
except (aiohttp.ClientConnectionError, asyncio.TimeoutError):
return None
error = data.get('Error', None)
if error is not None:
@ -554,7 +554,7 @@ class BaiduTranslate(FlowControlTranslateProvider):
logger.warning('BaiduTranslate request failed: status=%d %s', r.status, r.reason)
return None
data = await r.json()
except (aiohttp.ClientError, asyncio.TimeoutError):
except (aiohttp.ClientConnectionError, asyncio.TimeoutError):
return None
error_code = data.get('error_code', None)
if error_code is not None: