Natural language Processing

I’m wondering if PHP has the possibilities to build an on-line Natural Language Processing Application. PHP is designed to process strings, I have read on examples where PHP processes strings faster than arrays. And since Natural Spoken Language are strings…

Or are these things far beyond the possibilities from PHP and you need a more low level Language like C or even a special one like LISP. (programmed SKILL before, born out of LISP). Has anyone ever ventured on something like this?

(Yes I know, coming from a guy who still has problems making his classes flexible, it sounds ridicules. But I’m a dreamer :D)

In the end, what are the limitations from PHP?

you guys do realize he’s probably not going to do it?

i mean, this thread is a year old, we would’ve heard something more, yes?

If his computer became self-aware, I guess it speaks fluent PHP?

sorry, coulnd’t resist


Like we noticed! I mean this sorta cool thread popped to top and for a second…well it looked like…somebody was doing something interesting in PHP. How could we not comment endlessly? How could we not chip in to the discussion with barely a single computer science degree between the whole forum? I mean, this was like what…what was promised when we started playing with computers. You know…robots and stuff. This could be cool.

And then…you pointed out it was old.

You make me sad :(.

yours, Marcus

You don’t want to build a natural language processor, you want to build a compiler.

Let me explain: your question, distilled, is “How can I teach a computer to speak a language, without any intuition, no learning, and only the logic I give it?”. All language processors (natural or otherwise) are attempting to answer that question. C is probably a good place to start; you can find loads of books on the topic, and it’s a problem that’s been solved. Building a compiler is a good way to start on this path. Writing an NLP is much harder. We’ve been trying to do it for decades, and we’re still a long way from success.

Regarding PHP limits… as it is Turing complete language, anything that can be done in c,c++ or any other (Turing complete) language, can also be implemented (in theory) with PHP.

It’s just not feasible. Like digging the channel tunnel with a penknife…
You might be able to create a fluent interface, but that’s about it. Remember the sort of thing you used to get in old text adventure games?

He hasn’t logged in since April. My guess is his computer became self aware and has enslaved poor fristi to build it a body :frowning:

Before you go into this subject, understand the limitations of PHP. Languages such as Python are probably best suited for this task. However, thats not to say its not possible. You need to wrap your head around various AI paradigms and neural networks. May I suggest taking some lectures on the topic? People have built careers on this subject, I honestly don’t believe you can create what you have described, without thoroughly understanding the topic in question.

You would require a strong CS background and more notably, certain subjects such as Linear Algebra, Machine Learning, Data Structures and statistics to some extent. The following in an excerpt from the Stanford lectures on Machine learning

Students are expected to have the following background: Knowledge of basic computer science principles and skills, at a level sufficient to write a reasonably non-trivial computer program. Familiarity with the basic probability theory. Familiarity with the basic linear algebra.

The course uses Matlab and/or Octave. It also recommends the following readings:

Browse through some MIT lectures at their OCW website.

Also there a number of universities such as Stanford and Berkley that have similar lectures like the MIT ones. Might be interesting to look at.


Of course you could just use PHP as a web glue for various AI APIs out there:

yours, Marcus


Your main limitation is probably not the programming language. AI and natural language processing are huge and highly complex subjects.

I thought PHP was fast for an on line language.

I know, but rewriting my blog software all of the time is getting boring :confused:
Not that I will venture on this project now. I’m only gaining info ect…
Maybe you know of an application that pushes PHP to its limits? I’m really wondering on what has been pushed out of it.

But in Theory, you say that one who has the knowledge about the subject could write it in PHP?

What are requirements for “natural language processing”?
What is an “on-line Natural Language Processing Application” supposed to do?

I haven’t used Prolog for AI myself, but I assume it’s great for expert systems. And it’s fun. I’m not sure imperative languages are ideal choices for these problem domains.

The idea is to bring some of these technologies closer to the general public. That way they know what is going in those fields. Instead of just a few select who come in contact with them. So why not create a talking website. A site accessible by all, and when they go there people will be able to “talk” to a site.

So you say it can only be done through Declarative programming languages :sick:

No, what can be done in Prolog or Scheme can also be done in PHP, C or Java. Sometimes it’s easier sometimes it’s harder. There’s a reason that there are different paradigms.
Considering the complexity of the topics I would suggest you use the best tool available for the job.

Doh, I ment Scripting Language, not on line :confused: Perl is scripting and can be on line too… What was I drinking :goof:

Thanks for the tip :slight_smile: I’ll need to do more homework on the subject then :smiley:

Hmm. Forgot about this thread.

PHP isn’t slow, but it’s still interpreted, and it’s no match for C/C++, Java, or even the JavaScript engines that are shipping with browsers these days. Text manipulation isn’t one of PHP’s strong points either, and I believe even Perl beats PHP in respects to that.

You mean something like DSL ?

PHP is a general all-rounder. It is unbeaten in the world of the web, because that’s where it belongs.

I’m not entirely sure what you mean by your question here, Fristi. What I get from the general gist of this conversation is that you mean basing a programming language on PHP, but with, for example, English as the language?

If so, that would be insanely hard to accomplish, and to be honest PHP is pretty high level as it is. The problem with a level THAT high in a computer language would be ambiguity.

For example, look at a dictionary for many words. I believe the word with the most definitions in the English dictionary is ‘set’. One of the most common words in programming (related to variables, constants, other values).

Of course, I probably have the wrong end of the stick here, so can you post something similar to what you want to accomplish and I’m sure you’ll get a very detailed response from us fellow members :).