realclean: clean
rm -f $(TARGETS)
+ rm -f raw.tsv
+ rm -f _pages.ppm _upload-*.html _commodmap.tsv
+ rm -f _master-*.txt _local-*.txt
rm -f ./#pages#.ppm ./#upload-*#.html ./#commodmap#.tsv
rm -f ./#master-*#.txt ./#local-*#.txt raw.tsv
Options to vary the processing:
--single-page One screenful, no paging - results will be incomplete
--quiet Suppress progress messages
- --screenshot-file F Store or read screenshots in F rather than #pages#.pnm
+ --screenshot-file F Store or read screenshots in F rather than _pages.ppm
--window-id ID Specified X window is the YPP client - do not search
--edit-charset Enable character set editing. See README.dictionary.
- --no-edit-charset Do not edit charset even if #local-char*#.txt exists.
+ --no-edit-charset Do not edit charset even if _local-char*.txt exists.
--find-island Find and print the ocean and island. Suppresses OCR
and output unless used with result processing option.
--test-servers Set default servers to be the test servers, not
If you need to report a bug, for example an inability to recognise,
please be sure to remember the exact error message and circumstances.
Also, for recognition problems there will probably be a very useful
-screenshot file called `#pages#.pnm'. This is likely to be very large
+screenshot file called `_pages.ppm'. This is likely to be very large
so don't just email it to me, but if you can put it up on a webpage
for me to download that will help. At least keep a copy of it.
display and is reproducible, try running:
./ypp-commodities --raw-tsv --single-page
If this reproduces the problem, please email me the screenshot file
-#pages#.pnm, which will consist only of the single screen, plus the
+_pages.ppm, which will consist only of the single screen, plus the
error messasge. I'll then be able to understand what's wrong,
hopefully.
If you think you have made mistakes answering OCR queries (for
example, the recognised data is wrong), you should delete the file
-#local-char*#.txt, which contains your local updates. It will then
+_local-char*.txt, which contains your local updates. It will then
only use the centrally provided (and vetted) master file (which is
automatically updated when you run the PCTB client, by default).
It is also possible to have the OCR system reject particular strings.
-If you put a regexp in #local-reject#.txt, any OCR result which
+If you put a regexp in _local-reject.txt, any OCR result which
matches this string will instead cause an OCR failure, invoking the
-OCR dictionary editor if appropriate. #master-reject#.txt is the
+OCR dictionary editor if appropriate. _master-reject.txt is the
centrally maintained version of this file.
-Alternatively you can edit #local-char15#.txt with a text editor. The
+Alternatively you can edit _local-char*.txt with a text editor. The
format is not documented at the moment.
with the --edit-charset option. So run
./ypp-commodities --edit-charset
In future, this option is not usually needed, because it is the
-default if there is a local character set dictionary #local-<h>#.txt
+default if there is a local character set dictionary _local-<h>.txt
for the relevant character height.
With --edit-charset, when the OCR finds characters it does not
The program reads and writes the following files:
- * #pages#.pnm
+ * _pages.ppm
Contains one or more images (as raw ppms, end-to-end) which are the
screenshots taken in the last run. This is (over)written whenever
You can specify a different file with --screenshot-file.
If you want to display the contents of this file, `display' can do
- it. Don't try `display vid:#pages#.pnm' as this will consume
+ it. Don't try `display vid:_pages.ppm' as this will consume
truly stupendous quantities of RAM - it wedged my laptop.
- * #master-newcommods#.txt #local-newcommods#.txt
+ * _master-newcommods.txt _local-newcommods.txt
Dictionary of newly introduced commodities. When a new commodity
appears in Puzzle Pirates, the PCTB server operators need to add it
double-check what you're doing before overriding the uploader by
telling it to ignore an unrecognised commodity.
- * #master-reject#.txt #local-reject#.txt
+ * _master-reject.txt _local-reject.txt
Dictionary of regexps which, when the OCR appears to match, we
reject instead. At the moment this is used to stop us thinking
character set dictionary is missing the lowercase `y ' glyph.
See README.charset.
- * #master-char*#.txt #local-char*#.txt
- #master-pixmap#.txt #local-pixmap#.txt
+ * _master-char*.txt _local-char*.txt
+ _master-pixmap.txt _local-pixmap.txt
Character set and image dictionaries. For the semantics of the
char* files README.charset. There is not currently any accurate
documentation of this dictionary format.
- #master-*#.txt contain the centrally defined and approved data.
+ _master-*.txt contain the centrally defined and approved data.
They are downloaded automatically from the SC PCTB server and
updated each run. You can safely delete this file, if everything
is online, if you want to fetch a fresh copy.
- #local-*#.txt are a local copy of your submissions, so that they
+ _local-*.txt are a local copy of your submissions, so that they
will be used by your client pending approval by me. You can delete
this file if you think you may have made a mistake.
See README.privacy for details of the communications with the SC
server about the contents of these dictionaries.
- * #commodmap#.tsv
+ * _commodmap.tsv
Map from commodity names to the numbers required by the PCTB
server. This is fetched and updated automatically as necessary.
It can safely be deleted as it will then be refetched.
- * #upload-1#.html #upload-2#.html
+ * _upload-1.html _upload-2.html _upload-3.html
We screenscrape the pages from the PCTB upload server. The actual
HTML returned from the upload server is left in these dropping
files for debugging etc.
- * <file>.tmp
+ * _<file>.tmp
When any of these tools overwrite one of the persistent dictionary
- files, they temporarily write to <file>.tmp. We also use a couple
+ files, they temporarily write to _<file>.tmp. We also use a couple
of other temporary files.
Future versions may have more helpers and more data files.
sub load_commodmap() {
undef %commodmap;
- my $c= new IO::File "#commodmap#.tsv";
+ my $c= new IO::File "_commodmap.tsv";
if (!$c) { $!==&ENOENT or die $!; return; }
while (<$c>) {
m/^(\S.*\S)\t(\d+)\n$/ or die "$_";
my $incommodmap=0;
my $intag='';
my %got;
- my $o= new IO::File "#commodmap#.tsv.tmp",'w' or die $!;
+ my $o= new IO::File "_commodmap.tsv.tmp",'w' or die $!;
undef %commodmap;
my $xp= new XML::Parser
# print STDERR "[[[$content]]]\n";
$xp->parse($content);
close $o or die $!;
- rename "#commodmap#.tsv.tmp","#commodmap#.tsv" or die $!;
+ rename "_commodmap.tsv.tmp","_commodmap.tsv" or die $!;
}
our %newcommods;
my $rsync= $ENV{'YPPSC_PCTB_RSYNC'};
$rsync= 'rsync' if !defined $rsync;
- my $local= "#master-newcommods#.txt";
+ my $local= "_master-newcommods.txt";
my $src= $ENV{'YPPSC_PCTB_DICT_UPDATE'};
if ($src) {
my $remote= "$src/master-newcommods.txt";
die "$? $!" if $! or $?;
}
read_newcommods($local);
- read_newcommods('#local-newcommods#.txt');
+ read_newcommods('_local-newcommods.txt');
}
our (%stallmap, @stallmap);
sub save_upload_html ($$) {
my ($which, $resptxt) = @_;
- open R, ">./#upload-$which#.html" or die $!;
+ open R, ">./_upload-$which.html" or die $!;
print R $resptxt or die $!;
close R or die $!;
}
my $resptxt= $resp->content();
save_upload_html('1', $resptxt);
- open R, ">./#upload-1#.html" or die $!;
+ open R, ">./_upload-1.html" or die $!;
print R $resptxt or die $!;
close R or die $!;
save_upload_html('3', $resptxt);
print "\n" or die $!;
- system('w3m -T text/html -dump < \#upload-3#.html');
+ system('w3m -T text/html -dump < _upload-3.html');
print "\n" or die $!;
}
const char *src= getenv("YPPSC_PCTB_DICT_UPDATE");
char *remote= masprintf("%s/master-%s.txt", src, stem);
- char *local= masprintf("#master-%s#.txt", stem);
+ char *local= masprintf("_master-%s.txt", stem);
if (DEBUGP(rsync))
fprintf(stderr,"executing rsync to fetch %s to %s\n",remote,local);
execlp(rsync, "rsync",
o_serv_dict_submit, o_flags & ff_dict_submit);
if (!o_screenshot_fn)
- o_screenshot_fn= masprintf("%s/#pages#.ppm",get_vardir());
+ o_screenshot_fn= masprintf("%s/_pages.ppm",get_vardir());
/* Actually do the work */
use IO::Handle;
-open CM, "#commodmap#.tsv" or die $!;
+open CM, "_commodmap.tsv" or die $!;
$debug=1 if @ARGV;
}
proc execpnm_createphoto {photoname args} {
- set tmpfile ./#dictimage#.tmp
+ set tmpfile ./_dictimage.tmp
eval exec $args > $tmpfile
image create photo $photoname -file $tmpfile
file delete $tmpfile
proc select_database {dbname_spec} {
global dbname
set dbname $dbname_spec
- read_database "./#local-$dbname#.txt"
+ read_database "./_local-$dbname.txt"
}
proc do_database_update {im def} {
int h, endsword;
char lbuf[100];
- char *dbfname= masprintf("%s/#%s-char%d#.txt",
+ char *dbfname= masprintf("%s/_%s-char%d.txt",
get_vardir(), which, rd->h);
if (!dbfile_open(dbfname))
static void load_rejections(const char *which) {
char lbuf[1000];
- char *fname= masprintf("%s/#%s-reject#.txt", get_vardir(), which);
+ char *fname= masprintf("%s/_%s-reject.txt", get_vardir(), which);
int c, lno=0;
Rejection *rej;
memset(found,0,sizeof(found));
- fnpat= pcre_compile("\\#(?:master|local)\\-char([1-9]\\d{0,2})\\#\\.txt$",
+ fnpat= pcre_compile("_(?:master|local)\\-char([1-9]\\d{0,2})\\.txt$",
PCRE_ANCHORED|PCRE_DOLLAR_ENDONLY,
&pcre_err,&pcre_erroffset, 0);
debugf("pcre_compile %p %s\n",fnpat,pcre_err);
static int identify1(const RgbImage *base, Rect portion,
char result[MAXIMGIDENT], const char *what,
const char *which) {
- char *dbfile_name= masprintf("#%s-pixmap#.txt",which);
+ char *dbfile_name= masprintf("_%s-pixmap.txt",which);
if (!dbfile_open(dbfile_name))
goto not_found;