Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.

Commit 9520e9d

Browse files
committed
Initial commit of Kritzel
0 parents  commit 9520e9d

37 files changed

+5785
-0
lines changed

Diff for: AUTHORS

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Kritzel application:
2+
Christoph Feck <[email protected]>
3+
4+
CellWriter handwriting recognition engine:
5+
Michael Levin <[email protected]>
6+
7+
WritePad® handwriting recognition engine:
8+
PhatWare® Corporation, http://phatware.com/

Diff for: CMakeLists.txt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
project (kritzel)
2+
cmake_minimum_required (VERSION 3.0 FATAL_ERROR)
3+
4+
set (QT_MIN_VERSION "5.6.0")
5+
set (KF5_MIN_VERSION "5.25.0")
6+
7+
find_package (ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
8+
set (CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
9+
10+
include (KDEInstallDirs)
11+
include (KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
12+
include (KDECMakeSettings)
13+
14+
find_package (Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
15+
Core
16+
Widgets
17+
)
18+
19+
# find_package(Enchant)
20+
21+
if (ENCHANT_FOUND)
22+
include_directories (${ENCHANT_INCLUDE_DIRS})
23+
endif ()
24+
25+
add_subdirectory (src)
26+

Diff for: COPYING

+674
Large diffs are not rendered by default.

Diff for: README-cellwriter.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### About CellWriter
2+
3+
This project uses code from CellWriter written by Michael Levin. The files
4+
in directory "cellwriter" were taken from http://code.google.com/p/cellwriter/
5+
with the modifications in "cellwriter.diff". Only the files that are required to
6+
handle recognition are included.
7+
8+
The full repository is available and distributed under the GPLv2+ license at
9+
10+
* https://github.com/risujin/cellwriter

Diff for: README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Kritzel
2+
3+
### About
4+
5+
Sample Qt5 application that uses the cellwriter engine to
6+
recognize handwritten characters.
7+
8+
### Training
9+
10+
The cellwriter application must still be used to train.
11+
Alternatively, copy file "profile" into "~/.cellwriter"
12+
before characters can be recognized, but this will only
13+
work for my handwriting style.
14+
15+
### Building
16+
17+
Requirements:
18+
19+
* Kitware's CMake 3.0+ https://cmake.org/
20+
* Qt Company's Qt 5.6+ https://wiki.qt.io/
21+
* extra-cmake-modules https://github.com/KDE/extra-cmake-modules
22+
23+
Optional:
24+
25+
* PhatWare®'s WritePad Handwriting Recognition Engine https://github.com/phatware/WritePad-Handwriting-Recognition-Engine

Diff for: cellwriter.diff

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
Only in src: cellwidget.c
2+
diff -u src/common.h /local/git/playground/accessibility/kritzel/src/cellwriter/common.h
3+
--- src/common.h 2011-03-12 07:28:04.000000000 +0100
4+
+++ /local/git/playground/accessibility/kritzel/src/cellwriter/common.h 2012-08-08 21:18:49.424449284 +0200
5+
@@ -20,9 +20,10 @@
6+
7+
*/
8+
9+
-#include <gtk/gtk.h>
10+
+/*#include <gtk/gtk.h>*/
11+
#include <math.h>
12+
13+
+#if 0
14+
/*
15+
Limits
16+
*/
17+
@@ -38,6 +39,7 @@
18+
19+
int single_instance_init(SingleInstanceFunc callback, const char *str);
20+
void single_instance_cleanup(void);
21+
+#endif
22+
23+
/*
24+
Unicode blocks
25+
@@ -62,6 +64,7 @@
26+
int profile_sync_int(int *var);
27+
int profile_sync_short(short *var);
28+
29+
+#if 0
30+
/*
31+
Window
32+
*/
33+
@@ -98,6 +101,7 @@
34+
35+
/* Multiply to convert RGB to GDK color */
36+
#define COLOR_SCALE 256
37+
+#endif
38+
39+
/* Constants may not have been defined if GLib is not included */
40+
#ifndef TRUE
41+
@@ -110,6 +114,7 @@
42+
#define NULL ((void*)0)
43+
#endif
44+
45+
+#if 0
46+
/* A macro used to initialize GdkColor with RGB values */
47+
#define RGB_TO_GDKCOLOR(r, g, b) {0, (r) * 256, (g) * 256, (b) * 256 }
48+
49+
@@ -167,6 +172,7 @@
50+
void log_errno(const char *message);
51+
void log_print(const char *format, ...);
52+
void trace_full(const char *file, const char *func, const char *fmt, ...);
53+
+#endif
54+
55+
/*
56+
Angles
57+
Only in /local/git/playground/accessibility/kritzel/src/cellwriter/: config.h
58+
Only in src: keyevent.c
59+
Only in src: keys.h
60+
Only in src: keywidget.c
61+
Only in /local/git/playground/accessibility/kritzel/src/cellwriter/: libcellwriter.c
62+
Only in /local/git/playground/accessibility/kritzel/src/cellwriter/: libcellwriter.h
63+
Only in src: libegg
64+
Only in src: main.c
65+
Only in src: options.c
66+
diff -u src/preprocess.c /local/git/playground/accessibility/kritzel/src/cellwriter/preprocess.c
67+
--- src/preprocess.c 2011-03-12 07:27:41.000000000 +0100
68+
+++ /local/git/playground/accessibility/kritzel/src/cellwriter/preprocess.c 2012-08-08 21:25:20.225563545 +0200
69+
@@ -43,7 +43,8 @@
70+
#define GLUABLE_PENALTY 0.08f
71+
#define GLUE_PENALTY 0.02f
72+
73+
-int ignore_stroke_dir = TRUE, ignore_stroke_num = TRUE, prep_examined;
74+
+int ignore_stroke_dir = TRUE, ignore_stroke_num = TRUE;
75+
+extern int prep_examined;
76+
77+
static float measure_partial(Stroke *as, Stroke *b, Vec2 *offset, float scale_b)
78+
{
79+
Only in /local/git/playground/accessibility/kritzel/src/cellwriter/: profile.c
80+
diff -u src/recognize.c /local/git/playground/accessibility/kritzel/src/cellwriter/recognize.c
81+
--- src/recognize.c 2011-10-08 20:38:34.000000000 +0200
82+
+++ /local/git/playground/accessibility/kritzel/src/cellwriter/recognize.c 2012-07-28 16:29:10.628702362 +0200
83+
@@ -24,7 +24,7 @@
84+
#include <stdlib.h>
85+
#include <string.h>
86+
#include <math.h>
87+
-#include <gtk/gtk.h>
88+
+/*#include <gtk/gtk.h>*/
89+
#include "common.h"
90+
#include "recognize.h"
91+
92+
@@ -527,6 +527,7 @@
93+
msec / (prep_examined - num_disqualified) : -1,
94+
strength);
95+
96+
+#if 0
97+
/* Print out the top candidate scores in detail */
98+
if (log_level >= G_LOG_LEVEL_DEBUG)
99+
for (i = 0; i < num_alts && alts[i]; i++) {
100+
@@ -551,6 +552,7 @@
101+
log_print("%d", alts[i]->transform.glue[j]);
102+
log_print("]\n");
103+
}
104+
+#endif
105+
106+
/* Select the top result */
107+
input->ch = alts[0] ? alts[0]->ch : 0;
108+
diff -u src/recognize.h /local/git/playground/accessibility/kritzel/src/cellwriter/recognize.h
109+
--- src/recognize.h 2011-10-08 20:38:44.000000000 +0200
110+
+++ /local/git/playground/accessibility/kritzel/src/cellwriter/recognize.h 2012-07-28 19:59:54.382633634 +0200
111+
@@ -73,7 +73,7 @@
112+
*/
113+
114+
/* This will prevent the word frequency table from loading */
115+
-/* #define DISABLE_WORDFREQ */
116+
+#define DISABLE_WORDFREQ
117+
118+
/* Largest allowed engine weight */
119+
#define MAX_RANGE 100
120+
Only in src: singleinstance.c
121+
Only in src: statusicon.c
122+
diff -u src/stroke.c /local/git/playground/accessibility/kritzel/src/cellwriter/stroke.c
123+
--- src/stroke.c 2011-03-12 07:27:19.000000000 +0100
124+
+++ /local/git/playground/accessibility/kritzel/src/cellwriter/stroke.c 2012-07-28 15:53:07.295747694 +0200
125+
@@ -23,7 +23,7 @@
126+
#include "config.h"
127+
#include <string.h>
128+
#include <math.h>
129+
-#include <gtk/gtk.h>
130+
+/*#include <gtk/gtk.h>*/
131+
#include "common.h"
132+
#include "recognize.h"
133+
134+
Only in /local/git/playground/accessibility/kritzel/src/cellwriter/: unicode.c
135+
Only in src: window.c
136+
diff -u src/wordfreq.c /local/git/playground/accessibility/kritzel/src/cellwriter/wordfreq.c
137+
--- src/wordfreq.c 2011-03-12 07:27:12.000000000 +0100
138+
+++ /local/git/playground/accessibility/kritzel/src/cellwriter/wordfreq.c 2012-08-08 21:32:39.994065737 +0200
139+
@@ -33,6 +33,8 @@
140+
Word frequency engine
141+
*/
142+
143+
+#include "enchant.h"
144+
+
145+
#ifndef DISABLE_WORDFREQ
146+
147+
/* TODO needs to be internationalized (wide char)

Diff for: cmake/modules/FindEnchant.cmake

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# - Try to find Enchant
2+
# Once done, this will define
3+
#
4+
# ENCHANT_INCLUDE_DIRS - the Enchant include drectories
5+
# ENCHANT_LIBRARIES - link these to use Enchant
6+
#
7+
# Copyright (C) 2012 Samsung Electronics
8+
#
9+
# Redistribution and use in source and binary forms, with or without
10+
# modification, are permitted provided that the following conditions
11+
# are met:
12+
# 1. Redistributions of source code must retain the above copyright
13+
# notice, this list of conditions and the following disclaimer.
14+
# 2. Redistributions in binary form must reproduce the above copyright
15+
# notice, this list of conditions and the following disclaimer in the
16+
# documentation and/or other materials provided with the distribution.
17+
#
18+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
19+
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
22+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25+
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27+
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28+
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
30+
find_package(PkgConfig)
31+
32+
# TODO Remove the check for Enchant 1.x once all major LTS GNU/Linux
33+
# distributions ship the 2.x series (probably around mid-2020).
34+
35+
foreach (ENCHANT_NAME enchant-2 enchant)
36+
pkg_check_modules(PC_ENCHANT ${ENCHANT_NAME})
37+
38+
find_path(ENCHANT_INCLUDE_DIRS
39+
NAMES enchant.h
40+
PATHS ${PC_ENCHANT_INCLUDEDIR}
41+
${PC_ENCHANT_INCLUDE_DIRS}
42+
)
43+
44+
find_library(ENCHANT_LIBRARIES
45+
NAMES ${ENCHANT_NAME}
46+
PATHS ${PC_ENCHANT_LIBDIR}
47+
${PC_ENCHANT_LIBRARY_DIRS}
48+
)
49+
50+
# Only stop searching if the three have been found. This covers for corner
51+
# cases in which e.g. both versions of the library are installed, but the
52+
# headers are usable/present for one of them.
53+
if (PC_ENCHANT_FOUND AND ENCHANT_INCLUDE_DIRS AND ENCHANT_LIBRARIES)
54+
break ()
55+
endif ()
56+
endforeach (ENCHANT_NAME)
57+
58+
mark_as_advanced(
59+
ENCHANT_INCLUDE_DIRS
60+
ENCHANT_LIBRARIES
61+
)

0 commit comments

Comments
 (0)