提交 a253ea22 编写于 作者: D david.eger@gmail.com

Add some documentation on how to use config files and user dictionaries.



git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@719 d0cd1f9f-072b-0410-8dd7-cf729c803f20
上级 aa14e8b2
......@@ -2,12 +2,12 @@
.\" Title: tesseract
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\" Date: 02/09/2012
.\" Date: 04/09/2012
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "TESSERACT" "1" "02/09/2012" "\ \&" "\ \&"
.TH "TESSERACT" "1" "04/09/2012" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......@@ -110,6 +110,61 @@ There are currently language packs available for the following languages:
\fBara\fR (Arabic), \fBaze\fR (Azerbauijani), \fBbul\fR (Bulgarian), \fBcat\fR (Catalan), \fBces\fR (Czech), \fBchi_sim\fR (Simplified Chinese), \fBchi_tra\fR (Traditional Chinese), \fBchr\fR (Cherokee), \fBdan\fR (Danish), \fBdan\-frak\fR (Danish (Fraktur)), \fBdeu\fR (German), \fBell\fR (Greek), \fBeng\fR (English), \fBenm\fR (Old English), \fBepo\fR (Esperanto), \fBest\fR (Estonian), \fBfin\fR (Finnish), \fBfra\fR (French), \fBfrm\fR (Old French), \fBglg\fR (Galician), \fBheb\fR (Hebrew), \fBhin\fR (Hindi), \fBhrv\fR (Croation), \fBhun\fR (Hungarian), \fBind\fR (Indonesian), \fBita\fR (Italian), \fBjpn\fR (Japanese), \fBkor\fR (Korean), \fBlav\fR (Latvian), \fBlit\fR (Lithuanian), \fBnld\fR (Dutch), \fBnor\fR (Norwegian), \fBpol\fR (Polish), \fBpor\fR (Portuguese), \fBron\fR (Romanian), \fBrus\fR (Russian), \fBslk\fR (Slovakian), \fBslv\fR (Slovenian), \fBsqi\fR (Albanian), \fBspa\fR (Spanish), \fBsrp\fR (Serbian), \fBswe\fR (Swedish), \fBtam\fR (Tamil), \fBtel\fR (Telugu), \fBtgl\fR (Tagalog), \fBtha\fR (Thai), \fBtur\fR (Turkish), \fBukr\fR (Ukrainian), \fBvie\fR (Vietnamese)
.sp
To use a non\-standard language pack named \fBfoo\&.traineddata\fR, set the \fBTESSDATA_PREFIX\fR environment variable so the file can be found at \fBTESSDATA_PREFIX\fR/tessdata/\fBfoo\fR\&.traineddata and give Tesseract the argument \fI\-l foo\fR\&.
.SH "CONFIG FILES AND AUGMENTING WITH USER DATA"
.sp
Tesseract config files consist of lines with variable\-value pairs (space separated)\&. The variables are documented as flags in the source code like the following one in tesseractclass\&.h:
.sp
STRING_VAR_H(tessedit_char_blacklist, "", "Blacklist of chars not to recognize");
.sp
These variables may enable or disable various features of the engine, and may cause it to load (or not load) various data\&. For instance, let\(cqs suppose you want to OCR in English, but suppress the normal dictionary and load an alternative word list and an alternative list of patterns \(em these two files are the most commonly used extra data files\&.
.sp
If your language pack is in /path/to/eng\&.traineddata and the hocr config is in /path/to/configs/hocr then create three new files:
.sp
/path/to/eng\&.user\-words:
.sp
.if n \{\
.RS 4
.\}
.nf
the
quick
brown
fox
jumped
.fi
.if n \{\
.RE
.\}
.sp
/path/to/eng\&.user\-patterns:
.sp
.if n \{\
.RS 4
.\}
.nf
1\-\ed\ed\ed\-GOOG\-411
www\&.\en\e\e\e*\&.com
.fi
.if n \{\
.RE
.\}
.sp
/path/to/configs/bazaar:
.sp
.if n \{\
.RS 4
.\}
.nf
load_system_dawg F
load_freq_dawg F
user_words_suffix user\-words
user_patterns_suffix user\-patterns
.fi
.if n \{\
.RE
.\}
.sp
Now, if you pass the word \fIbazaar\fR as a trailing command line parameter to Tesseract, Tesseract will not bother loading the system dictionary nor the dictionary of frequent words and will load and use the eng\&.user\-words and eng\&.user\-patterns files you provided\&. The former is a simple word list, one per line\&. The format of the latter is documented in dict/trie\&.h on read_pattern_list()\&.
.SH "HISTORY"
.sp
The engine was developed at Hewlett Packard Laboratories Bristol and at Hewlett Packard Co, Greeley Colorado between 1985 and 1994, with some more changes made in 1996 to port to Windows, and some C++izing in 1998\&. A lot of the code was written in C, and then some more was written in C++\&. The C\e++ code makes heavy use of a list system using macros\&. This predates stl, was portable before stl, and is more efficient than stl lists, but has the big negative that if you do get a segmentation violation, it is hard to debug\&.
......
......@@ -121,6 +121,54 @@ To use a non-standard language pack named *foo.traineddata*, set the
*TESSDATA_PREFIX*/tessdata/*foo*.traineddata and give Tesseract the
argument '-l foo'.
CONFIG FILES AND AUGMENTING WITH USER DATA
------------------------------------------
Tesseract config files consist of lines with variable-value pairs (space
separated). The variables are documented as flags in the source code like
the following one in tesseractclass.h:
STRING_VAR_H(tessedit_char_blacklist, "",
"Blacklist of chars not to recognize");
These variables may enable or disable various features of the engine, and
may cause it to load (or not load) various data. For instance, let's suppose
you want to OCR in English, but suppress the normal dictionary and load an
alternative word list and an alternative list of patterns -- these two files
are the most commonly used extra data files.
If your language pack is in /path/to/eng.traineddata and the hocr config
is in /path/to/configs/hocr then create three new files:
/path/to/eng.user-words:
[verse]
the
quick
brown
fox
jumped
/path/to/eng.user-patterns:
[verse]
1-\d\d\d-GOOG-411
www.\n\\\*.com
/path/to/configs/bazaar:
[verse]
load_system_dawg F
load_freq_dawg F
user_words_suffix user-words
user_patterns_suffix user-patterns
Now, if you pass the word 'bazaar' as a trailing command line parameter
to Tesseract, Tesseract will not bother loading the system dictionary nor
the dictionary of frequent words and will load and use the eng.user-words
and eng.user-patterns files you provided. The former is a simple word list,
one per line. The format of the latter is documented in dict/trie.h
on read_pattern_list().
HISTORY
-------
The engine was developed at Hewlett Packard Laboratories Bristol and at
......
......@@ -731,6 +731,50 @@ before any <em>configfile</em>.</p></div>
<strong>TESSDATA_PREFIX</strong>/tessdata/<strong>foo</strong>.traineddata and give Tesseract the
argument <em>-l foo</em>.</p></div>
</div>
<h2 id="_config_files_and_augmenting_with_user_data">CONFIG FILES AND AUGMENTING WITH USER DATA</h2>
<div class="sectionbody">
<div class="paragraph"><p>Tesseract config files consist of lines with variable-value pairs (space
separated). The variables are documented as flags in the source code like
the following one in tesseractclass.h:</p></div>
<div class="paragraph"><p>STRING_VAR_H(tessedit_char_blacklist, "",
"Blacklist of chars not to recognize");</p></div>
<div class="paragraph"><p>These variables may enable or disable various features of the engine, and
may cause it to load (or not load) various data. For instance, let&#8217;s suppose
you want to OCR in English, but suppress the normal dictionary and load an
alternative word list and an alternative list of patterns&#8201;&#8212;&#8201;these two files
are the most commonly used extra data files.</p></div>
<div class="paragraph"><p>If your language pack is in /path/to/eng.traineddata and the hocr config
is in /path/to/configs/hocr then create three new files:</p></div>
<div class="paragraph"><p>/path/to/eng.user-words:</p></div>
<div class="verseblock">
<div class="verseblock-content">the
quick
brown
fox
jumped</div>
<div class="verseblock-attribution">
</div></div>
<div class="paragraph"><p>/path/to/eng.user-patterns:</p></div>
<div class="verseblock">
<div class="verseblock-content">1-\d\d\d-GOOG-411
www.\n\\\*.com</div>
<div class="verseblock-attribution">
</div></div>
<div class="paragraph"><p>/path/to/configs/bazaar:</p></div>
<div class="verseblock">
<div class="verseblock-content">load_system_dawg F
load_freq_dawg F
user_words_suffix user-words
user_patterns_suffix user-patterns</div>
<div class="verseblock-attribution">
</div></div>
<div class="paragraph"><p>Now, if you pass the word <em>bazaar</em> as a trailing command line parameter
to Tesseract, Tesseract will not bother loading the system dictionary nor
the dictionary of frequent words and will load and use the eng.user-words
and eng.user-patterns files you provided. The former is a simple word list,
one per line. The format of the latter is documented in dict/trie.h
on read_pattern_list().</p></div>
</div>
<h2 id="_history">HISTORY</h2>
<div class="sectionbody">
<div class="paragraph"><p>The engine was developed at Hewlett Packard Laboratories Bristol and at
......@@ -785,7 +829,7 @@ Lloyd, Shobhit Saxena, and Thomas Kielbus.</p></div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2012-02-09 14:18:49 PDT
Last updated 2012-04-09 12:34:39 PDT
</div>
</div>
</body>
......
......@@ -172,6 +172,47 @@ before any <emphasis>configfile</emphasis>.</simpara>
<emphasis role="strong">TESSDATA_PREFIX</emphasis>/tessdata/<emphasis role="strong">foo</emphasis>.traineddata and give Tesseract the
argument <emphasis>-l foo</emphasis>.</simpara>
</refsect1>
<refsect1 id="_config_files_and_augmenting_with_user_data">
<title>CONFIG FILES AND AUGMENTING WITH USER DATA</title>
<simpara>Tesseract config files consist of lines with variable-value pairs (space
separated). The variables are documented as flags in the source code like
the following one in tesseractclass.h:</simpara>
<simpara>STRING_VAR_H(tessedit_char_blacklist, "",
"Blacklist of chars not to recognize");</simpara>
<simpara>These variables may enable or disable various features of the engine, and
may cause it to load (or not load) various data. For instance, let&#8217;s suppose
you want to OCR in English, but suppress the normal dictionary and load an
alternative word list and an alternative list of patterns&#8201;&#8212;&#8201;these two files
are the most commonly used extra data files.</simpara>
<simpara>If your language pack is in /path/to/eng.traineddata and the hocr config
is in /path/to/configs/hocr then create three new files:</simpara>
<simpara>/path/to/eng.user-words:</simpara>
<blockquote>
<literallayout>the
quick
brown
fox
jumped</literallayout>
</blockquote>
<simpara>/path/to/eng.user-patterns:</simpara>
<blockquote>
<literallayout>1-\d\d\d-GOOG-411
www.\n\\\*.com</literallayout>
</blockquote>
<simpara>/path/to/configs/bazaar:</simpara>
<blockquote>
<literallayout>load_system_dawg F
load_freq_dawg F
user_words_suffix user-words
user_patterns_suffix user-patterns</literallayout>
</blockquote>
<simpara>Now, if you pass the word <emphasis>bazaar</emphasis> as a trailing command line parameter
to Tesseract, Tesseract will not bother loading the system dictionary nor
the dictionary of frequent words and will load and use the eng.user-words
and eng.user-patterns files you provided. The former is a simple word list,
one per line. The format of the latter is documented in dict/trie.h
on read_pattern_list().</simpara>
</refsect1>
<refsect1 id="_history">
<title>HISTORY</title>
<simpara>The engine was developed at Hewlett Packard Laboratories Bristol and at
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册