1

I have this Perl script:

use strict;
use warnings;
use WordNet::QueryData;
use WordNet::Similarity::random;
use WordNet::Similarity::path;
use WordNet::Similarity::wup;
use WordNet::Similarity::lch;
use WordNet::Similarity::jcn;
use WordNet::Similarity::res;
use WordNet::Similarity::lin;
use WordNet::Similarity::hso;
use WordNet::Similarity::lesk;
use WordNet::Similarity::vector; 
use WordNet::Similarity::vector_pairs; 

#loading wordnet
my $wn = WordNet::QueryData->new;
my $path = WordNet::Similarity::path->new($wn, "config-files/config-path.conf");
my $value = $path->getRelatedness("eat#v#1", "play#v#1");
print "PATH Similarity = $value\n";

This script computes the path similarity between the two verbs (eat , play) using the Wordnet ontology.

I want to use this script inside my php code but I don't want to use exec(),system(),shell_exec() functions to call the perl script.

So my question: is there any way to use this perl script inside my php code directly?

7
  • stackoverflow.com/questions/3438626/… --- stackoverflow.com/questions/455369/… Commented May 10, 2017 at 15:13
  • Well, there is no production worthy solution that I can think of. But if you just want to fiddle with it, then configure apache to process .pl scripts with perl, and run curl requests to and from your script. Commented May 10, 2017 at 15:14
  • Why don't you want to use any of those functions? Commented May 10, 2017 at 15:48
  • When you're ready to do the opposite ... Commented May 10, 2017 at 16:17
  • 3
    Are you sure communication is the bottleneck? Maybe you're not doing it efficiently. Are you restarting the script for each pair? You could start the perl script as a coprocess, send word pairs to it through a pipe, and receive the responses through another pipe. Make sure you disable buffering to prevent deadlock. Commented May 10, 2017 at 18:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.