Hi everyone - I'm new to this forum and new to PHP!

I have a question - is it possible to use a cosine similarity algorithm to compare the similarity of two strings in PHP? If so, is there freely available source code that can perform the task?

I can use a CSA in Java, but unfortunately the server that I'm running my site on at the moment does not support the integration of Java (not that I would know how to do it anyway).

If it is not possible to implement a CSA for whatever reason, is there an alternative algorithm you suggest I use? The best I can think of is "Levenschtein Distance". Basically the aim is to compare a given string, to a collection of strings in a database, and list the database strings in order of similarity to the original string.

Thanks in advance! 😕

    Can you read the Java source? It should be possible to port. Or find a definition of the algorithm and implement that.

      Write a Reply...