MCPcopy
hub / github.com/sml2h3/ddddocr / _update_valid_indices

Method _update_valid_indices

ddddocr/models/charset_manager.py:113–124  ·  view source on GitHub ↗

更新有效字符索引

(self)

Source from the content-addressed store, hash-verified

111 self._update_valid_indices()
112
113 def _update_valid_indices(self) -> None:
114 """更新有效字符索引"""
115 self.valid_charset_range_index.clear()
116
117 if len(self.charset_range) > 0:
118 for item in self.charset_range:
119 if item in self.charset:
120 self.valid_charset_range_index.append(self.charset.index(item))
121 # 未知字符没有索引,直接忽略
122 else:
123 # 当没有设置字符集范围时,使用完整字符集的所有索引
124 self.valid_charset_range_index = list(range(len(self.charset)))
125
126 def get_valid_indices(self) -> List[int]:
127 """

Callers 5

load_default_charsetMethod · 0.95
load_custom_charsetMethod · 0.95
set_rangesMethod · 0.95
initializeMethod · 0.80
predictMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected