Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6029311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:52:03+00:00 2026-05-23T04:52:03+00:00

I am trying to write a program to find similarity between two documents, and

  • 0

I am trying to write a program to find similarity between two documents, and since im using only english, I decided to use wordnet, but I cannot find a way to link the wordnet with php, I cannot find any wordnet api from php.

I saw in the forum some one said (Spudley) he called wordnet from php (using shell_exec() function),
Thesaurus class or API for PHP [edited]

I would really like to know a method used or some example code, a tutorial perhaps to start using the wordnet with php.

many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:52:04+00:00Added an answer on May 23, 2026 at 4:52 am

    The PHP extension which is linked to from the WordNet site is very old and out of date — it claims to work with PHP4, so I don’t think it’s been looked at in years.

    There aren’t any other APIs available for WordNet->PHP, so I rolled my own solution.

    WordNet can be run from the command-line, so PHP’s shell_exec() function can read the output.

    If you run WordNet from the command-line (cd to Wordnet’s directory, then just wn) without any parameters, it will show you a list of possible functions that Wordnet supports.

    Still in the command-line, if you then try one/some of those functions, you’ll see how Wordnet outputs its results. For example, if you want synonyms for the word ‘star’, you could try the -synsn function:

    wn star -synsn
    

    This will produce output that looks a bit like this:

    Synonyms/Hypernyms (Ordered by Estimated Frequency) of noun star

    8 senses of star

    Sense 1 star
    => celestial body, heavenly body

    Sense 2 ace, adept, champion, sensation, maven, mavin, virtuoso, genius, hotshot, star, superstar, whiz, whizz, wizard, wiz
    => expert

    Sense 3 star
    => celestial body, heavenly body

    Sense 4 star
    => plane figure, two-dimensional figure

    Sense 5 star, principal, lead
    => actor, histrion, player, thespian, role player

    Sense 6 headliner, star
    => performer, performing artist

    Sense 7 asterisk, star
    => character, grapheme, graphic symbol

    Sense 8 star topology, star
    => topology, network topology

    In PHP, you can read this same output using the shell_exec() function.

    $result = shell_exec('/path/to/wn '.$word.' -synsn');
    

    Now $result should contain the block of text quoted above.

    At this point, you have to do some proper coding. You’ll need to take that block of text and parse it for the data you want.

    This is where it gets tricky. Because the data is presented in a format designed to be read by a human rather than by a program, it is tricky to parse accurately.

    It is important to note that different search options present their output slightly differently. And, some of the results that are returned can be somewhat esoteric. I ended up writing a weighting system to score the results, but it was fairly specific to my needs, so you’ll need to experiment with it to come up with your own system.

    I hope that’s enough help for you. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a program that displays the integers between 1 and
I am trying to write a program to find the largest prime factor of
I am trying to write a program in java where in i can find
I was trying to write a program that would display the prime numbers between
I'm trying to write a simple program using WinSnmp in C++. There is very
i am trying to write a program which inputs two numbers from user as
I am trying to write a c++ program to find all numbers with a
I am trying to write a program to find how many 1-letter, 2-letter, 3-letter,
I'm trying to write a program to find the mean, median, mode of an
I am trying to write a program using the lynx command on this page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.