Re: Request for Comment: Callable CRM114 Classifiers (libcrm114)

Eugene Crosser <[email protected]>
Newsgroups gmane.mail.spam.crm114
Message-ID <[email protected]>
Bill Yerazunis wrote:

>   * If we really want thread safety (and we would need it for some
>     applications, like running in a browser that does threads)

... or in a milter, which has to be thread-safe by its design

>   * File name parsing:   We need to provide a call to break the filenames
>     string into an array of filenames

Does it need to be in the library or can be left to the application that
uses the library?

> - ----- PROPOSED API -----

Maybe that is going to be "over-engineering", but I's suggest two things:

1. abstract classifier object from the underlying css filename.
2. allow feeding data in chunks, like is done in e.g. openssl's crypto API.

example pseudocode attached

Eugene

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
Crm114-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crm114-general
crm114.api.txt (text/plain, 1.5 KB)
typedef ... crm114_classifier;
// to abstract classifier data from the physical file name. CSS might
// be e.g. an area of NOR FLASH memory or some such
typedef ... crm114_ctx;		// global context
typedef ... crm114_learn_ctx;	// learning context (current document)
typedef ... crm114_classify_ctx;// classifying context
typedef ... crm114_result;	// struct for probabilities, pR etc.

crm114_ctx global_context = crm114_ctx_new(void *foo);

crm114_classifier my_classifier = crm114_classifier_new(char *filename);

crm114_learn_ctx my_doc1 = crm114_learn_ctx_new(
				crm114_ctx global_context,
				crm114_classifier my_classifier,
				int classnumber);

repeat
	crm114_learn_next(crm114_learn_ctx my_doc1,
				char *text_chunk,
				size_t chunk_length);
until data is over;

crm114_learn_complete(crm114_learn_ctx my_doc1,
				crm114_result &my_result);
// not sure if learning should return result?

crm114_learn_ctx_free(my_doc1); // may be combined with ..._complete


crm114_classify_ctx my_doc2 = crm114_classify_ctx_new(
				crm114_ctx global_context,
				crm114_classifier my_classifier)

repeat
	crm114_classify_next(crm114_classify_ctx my_doc2,
				char *text_chunk,
				size_t chunk_length);
until data is over;

crm114_classify_complete(crm114_classify_ctx my_doc2,
				crm114_result &my_result);
// my_result contains result of classification

crm114_classify_ctx_free(my_doc2); // may be combined with ..._complete

crm114_classifier_free(my_classifier); // closes the file etc.

crm114_ctx_free(global_context);
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI2Pipfrw/cIw6UWkRAsBGAJoDmDjt5k0128LIvNXy1mzgqRIn2gCfc9tT
HI3QW1oVydnuD2zGr361Eek=
=d5Qu
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.