mirror of
https://github.com/xfgryujk/blivechat.git
synced 2024-12-26 12:50:33 +08:00
修改一个命名
This commit is contained in:
parent
57ec8495e1
commit
e478959a1b
@ -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]
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user