Re: CRM114 php extension
Khalid Ahsein <[email protected]> Tue, 3 Jan 2012 21:37:36 +0100
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Message-ID | <CAKL5=2n_7nNVhb-U=m4xdnCwL8MGKFrWp4FsbCkrsx46JKZT0w@mail.gmail.com> |
--===============8714269239664990533==
Content-Type: multipart/alternative; boundary=bcaec52c6aad5e2b3a04b5a5ab82
--bcaec52c6aad5e2b3a04b5a5ab82
Content-Type: text/plain; charset=ISO-8859-1
Hello Brad,
There is no problem to adding an object-oriented approach.
Actually, the crm114_open() function create a php resource.
This resource can be encapsulated to a zval pointer in the __construct()
function.
And for the methods (and functions aliases), just grab-it by getThis()
macro.
For example :
$obj = crm114_open('mydb.dat');
$obj = new Crm114('mydb.dat');
And
crm114_add_class('spam', $obj);
$obj->addClass('spam');
I can start preparing the next release, but if you want to do it, I can
help you for that :-)
On Tue, Jan 3, 2012 at 7:52 PM, Brad Waite <[email protected]> wrote:
> On 1/3/2012 11:25 AM, Khalid Ahsein wrote:
>
> > I just released a php extension of the C-callable library crm114.
> > I use it for a blogs platform, to detect the spam articles, since 2
> weeks.
>
> Khalid, this is *fantastic*! This has been on my TODO list ever since
> the library came out (and making a crm114 library was on that list prior
> to that).
>
> > I'm open to discuss with you for any improvements or modifications.
>
> After a quick glance, usage seems straightforward.
>
> Based on the syntax, I assume this is a procedural library? I think an
> object-oriented approach would work very well. Something like this would
> be ideal:
>
> ----
>
> $crm114 = new crm114('mydb.dat');
>
> $spam = $crm114->addClass('spam');
> $pass = $crm114->addClass('pass');
>
> $crm114->learnText($text_clean_1, $pass);
> $crm114->learnText($text_clean_2, $pass);
> $crm114->learnText($text_abuse, $spam);
>
> $classId = $crm114->classifyText($unknown_text);
>
> ----
>
> I'd love to get involved.
>
> -Brad Waite
>
--bcaec52c6aad5e2b3a04b5a5ab82
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hello Brad,<div><br></div><div>There is no problem to adding an object-orie=
nted approach.</div><div><br></div><div>Actually, the crm114_open() functio=
n create a php resource.=A0</div><div>This resource can be encapsulated to =
a zval pointer in the __construct() function.</div>
<div><br></div><div>And for the methods (and functions aliases), just grab-=
it by getThis() macro.</div><div><br></div><div>For example :</div><div><br=
></div><div>$obj =3D=A0crm114_open('mydb.dat');</div><div>$obj =3D =
new Crm114('mydb.dat');</div>
<div><br></div><div>And=A0</div><div><br></div><div>crm114_add_class('s=
pam', $obj);</div><div>$obj->addClass('spam');</div><div><br=
></div><div>I can start preparing the next release, but if you want to do i=
t, I can help you for that :-)</div>
<div><br></div><div><br><div class=3D"gmail_quote">On Tue, Jan 3, 2012 at 7=
:52 PM, Brad Waite <span dir=3D"ltr"><<a href=3D"mailto:[email protected]=
" target=3D"_blank">[email protected]</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div>On 1/3/2012 11:25 AM, Khalid Ahsein wro=
te:<br>
<br>
> I just released a php extension of the C-callable library crm114.<br>
> I use it for a blogs platform, to detect the spam articles, since 2 we=
eks.<br>
<br>
</div>Khalid, this is *fantastic*! This has been on my TODO list ever since=
<br>
the library came out (and making a crm114 library was on that list prior<br=
>
to that).<br>
<div><br>
> I'm open to discuss with you for any improvements or modifications=
.<br>
<br>
</div>After a quick glance, usage seems straightforward.<br>
<br>
Based on the syntax, I assume this is a procedural library? I think an<br>
object-oriented approach would work very well. Something like this would<br=
>
be ideal:<br>
<br>
----<br>
<br>
$crm114 =3D new crm114('mydb.dat');<br>
<br>
$spam =3D $crm114->addClass('spam');<br>
$pass =3D $crm114->addClass('pass');<br>
<br>
$crm114->learnText($text_clean_1, $pass);<br>
$crm114->learnText($text_clean_2, $pass);<br>
$crm114->learnText($text_abuse, $spam);<br>
<br>
$classId =3D $crm114->classifyText($unknown_text);<br>
<br>
----<br>
<br>
I'd love to get involved.<br>
<span><font color=3D"#888888"><br>
-Brad Waite<br>
</font></span></blockquote></div><br></div>
--bcaec52c6aad5e2b3a04b5a5ab82--
--===============8714269239664990533==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
--===============8714269239664990533==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Crm114-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crm114-general
--===============8714269239664990533==--