import_lexiconT_import_lexiconImportLexiconImportLexiconimport_lexicon (算子)

名称

import_lexiconT_import_lexiconImportLexiconImportLexiconimport_lexicon — 从文本文件创建词典。

签名

import_lexicon( : : Name, FileName : LexiconHandle)

Herror T_import_lexicon(const Htuple Name, const Htuple FileName, Htuple* LexiconHandle)

void ImportLexicon(const HTuple& Name, const HTuple& FileName, HTuple* LexiconHandle)

void HLexicon::HLexicon(const HString& Name, const HString& FileName)

void HLexicon::HLexicon(const char* Name, const char* FileName)

void HLexicon::HLexicon(const wchar_t* Name, const wchar_t* FileName)   ( Windows only)

void HLexicon::ImportLexicon(const HString& Name, const HString& FileName)

void HLexicon::ImportLexicon(const char* Name, const char* FileName)

void HLexicon::ImportLexicon(const wchar_t* Name, const wchar_t* FileName)   ( Windows only)

static void HOperatorSet.ImportLexicon(HTuple name, HTuple fileName, out HTuple lexiconHandle)

public HLexicon(string name, string fileName)

void HLexicon.ImportLexicon(string name, string fileName)

def import_lexicon(name: str, file_name: str) -> HHandle

描述

import_lexiconimport_lexiconImportLexiconImportLexiconImportLexiconimport_lexicon creates a new lexicon based on a list of words in the file specified by FileNameFileNameFileNameFileNamefileNamefile_name. The format of the file is a simple text file with one word per line. By specifying a unique textual NameNameNameNamenamename, you can later refer to the lexicon from syntax expressions like those used, e.g., by do_ocr_word_mlpdo_ocr_word_mlpDoOcrWordMlpDoOcrWordMlpDoOcrWordMlpdo_ocr_word_mlp

Note that lexicon support in HALCON is currently not aimed at natural languages. Rather, it is intended as a post-processing step in OCR applications that only need to distinguish between a limited set of not more than a few thousand valid words, e.g., country or product names. When the lexicon file contains entries with special, non-ASCII characters, it is expected to be encoded in UTF-8. However, old lexicon files which use the local 8-bit encoding, can still be loaded as long as they contain at least one byte sequence, which cannot be misinterpreted as UTF-8 character. MVTec itself does not provide any lexica.

执行信息

此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。

参数

NameNameNameNamenamename (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Unique name for the new lexicon.

默认值: 'lex1' "lex1" "lex1" "lex1" "lex1" "lex1"

FileNameFileNameFileNameFileNamefileNamefile_name (输入控制)  filename.read HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of a text file containing words for the new lexicon.

默认值: 'words.txt' "words.txt" "words.txt" "words.txt" "words.txt" "words.txt"

File extension: .txt

LexiconHandleLexiconHandleLexiconHandleLexiconHandlelexiconHandlelexicon_handle (输出控制)  lexicon HLexicon, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the lexicon.

可能的后继

do_ocr_word_mlpdo_ocr_word_mlpDoOcrWordMlpDoOcrWordMlpDoOcrWordMlpdo_ocr_word_mlp, do_ocr_word_svmdo_ocr_word_svmDoOcrWordSvmDoOcrWordSvmDoOcrWordSvmdo_ocr_word_svm

替代

create_lexiconcreate_lexiconCreateLexiconCreateLexiconCreateLexiconcreate_lexicon

另见

lookup_lexiconlookup_lexiconLookupLexiconLookupLexiconLookupLexiconlookup_lexicon, suggest_lexiconsuggest_lexiconSuggestLexiconSuggestLexiconSuggestLexiconsuggest_lexicon

模块

光学字符识别/光学字符验证