chiark / gitweb /
Rename yppsc-ocr-resolver to dictionary-manager, and database and charset to dictiona...
[ypp-sc-tools.web-live.git] / pctb / README
1 Overview
2 --------
3
4 This tool can:
5   - screenscrape the commodities trading screen
6   - produce the results as a tab separated values file
7   - **TODO** upload the results to PCTB
8
9 To run it, change to this directory, type `make', and then:
10   ./ypp-commodities --tsv >commods.tsv
11
12 While it is capturing the screenshots, do not move the mouse or use
13 the keyboard.  Keyboard focus must stay in the YPP client window.
14
15
16 Command-line options
17 --------------------
18
19 Setting the operation mode:
20   --find-window-only       Just check that we can find the YPP client window.
21   --screenshot-only        Page through and take screenshots, do not OCR
22   --analyse-only | --same  Process previously taken screenshots
23   --everything (default)   Take screenshots and process them
24
25 Options to vary the processing:
26   --single-page         One screenful, no paging - results will be incomplete
27   --quiet               Suppress progress messages
28   --screenshot-file F   Store or read screenshots in F rather than #pages#.pnm
29   --window-id ID        Specified X window is the YPP client - do not search
30   --edit-dictionary     Enable dictionary editing.  See README.dictionary.
31
32 Controlling what happens to the results:
33   --upload (default) Upload to the PCTB server
34   --tsv              Print data as clean tab-separated-values file
35   --raw-tsv          Dump the raw (not deduped, unsorted) OCR'd data
36   --best-prices      Print best buy and sell price for each commodity
37   --arbitrage        Print arbitrage opportunities
38
39
40 Files we use and update
41 -----------------------
42
43 The program reads and writes the following files:
44
45  * #pages#.pnm
46
47    Contains one or more images (as raw ppms, end-to-end) which are the
48    screenshots taken in the last run.  This is (over)written whenever
49    we take screenshots from the YPP client.  You can reprocess an
50    existing set of screenshots with the --same (aka --analyse-only)
51    option; in that case we just read the screenshots file.
52
53    You can specify a different file with --screenshot-file.
54
55    If you want to display the contents of this file, `display' can do
56    it.  Don't try `display vid:#pages#.pnm' as this will consume
57    truly stupendous quantities of RAM - it wedged my laptop.
58
59  * charset-15.txt
60
61    Character set dictionary.  For the semantics of the contents of this
62    file see README.charset.  There is not currently any accurate
63    documentation of this dictionary format.
64
65    If you delete this file you'll have to re-enter a lot of glyph data
66    (and probably get it wrong and make the program misrecognise
67    things).  If you want to undo any mistakes you may have made
68    answering OCR questions you can safely revert this to the version
69    I've supplied.
70
71  * #commodmap#.tsv
72
73    Map from commodity names to the numbers required by the PCTB
74    server.  This is fetched and updated automatically as necessary.
75    It can safely be deleted as it will then be refetched.
76
77  * <file>.new
78
79    When any of these tools overwrite one of the persistent dictionary
80    files, they temporarily write to <file>.new.
81
82 These files are all in the current working directory.  There is not
83 yet any feature to have them be somewhere else.  The helper programs
84   yppsc-ocr-resolver
85   yppsc-commod-processor
86 must (currently) also be in the current directory.
87
88 Future versions may have more helpers and more data files.
89
90
91 Installation requirements
92 -------------------------
93
94 This program has quite a few dependencies:
95                                                         Package (Debian etch)
96
97  - For building, C compiler and build environment       build-essential
98  - pnm library, including dev files for building        libnetpbm10-dev
99  - pnm command line utilities for image manipulation    netpbm
100  - X11 libraries, including dev files for building      libx11-dev
101  - XTEST library, including dev files for building      libxtst-dev
102  - Tk interpreter /usr/bin/wish                         tk8.4
103  - Perl module XML::Parser                              libxml-parser-perl
104  - Perl module JSON::Parser                             libjson-perl
105  - XTEST extension in the X server                      (part of X package)
106  - Perl interpreter and basic modules                   perl (usu.installed)
107
108 On other Linux distros the packages may have different names, but
109 these should be roughly right for Debian and its derivatives.
110
111
112 Reporting problems
113 ------------------
114
115 If you need to report a bug, for example an inability to recognise,
116 please be sure to remember the exact error message and circumstances.
117 Also, for recognition problems there will probably be a very useful
118 screenshot file called `#pages#.pnm'.  This is likely to be very large
119 so don't just email it to me, but if you can put it up on a webpage
120 for me to download that will help.  At least keep a copy of it.
121
122 If the problem is a failure to cope with some particular YPP client
123 display and is reproducible, try running:
124    ./ypp-commodities --raw-tsv --single-page
125 If this reproduces the problem, please email me the screenshot file
126 #pages#.pnm, which will consist only of the single screen, plus the
127 error messasge.  I'll then be able to understand what's wrong,
128 hopefully.
129
130
131 Phoning home - privacy
132 ----------------------
133
134 The main purpose of this program is to connect to the PCTB server and
135 upload data.  The program does not currently phone home at all in
136 modes other than --upload, and when it does it connects to the
137 PCTB server not to a system of mine.
138
139 However, there are some improvements which I may introduce in the
140 future which may change this.  I am considering:
141
142  * Having the ocr character resolver talk to a server run by me
143    to look for missing glpyhs, and/or upload those glyphs back
144    to that server so that they can be shared.
145
146  * Having the upload client upload a copy of the data to a server run
147    by me, when run in --upload mode.
148
149 If I do do this these new functions may be enabled by default, but it
150 will be possible to turn them off, or direct them to different
151 servers, with command-line options, and they will be documented here.
152
153
154  - Ian Jackson
155    ijackson@chiark.greenend.org.uk
156    Aristarchus on the Midnight ocean