Git Product home page Git Product logo

sentence-similarity-based-on-semantic-nets-and-corpus-statistics-'s Introduction

Sentence-similarity-based-on-Semantic-nets-and-Corpus-Statistics-

This is an implementation of the paper written by Yuhua Li, David McLean, Zuhair A. Bandar, James D. O’Shea, and Keeley Crockett

Implemented sentence similarity as a linear combination of semantic and word order similarity

Semantic and word order similarities are calculated from semantic and order vectors computed for each sentence with the assistance of wordnet

sentence-similarity-based-on-semantic-nets-and-corpus-statistics-'s People

Contributors

chanddu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sentence-similarity-based-on-semantic-nets-and-corpus-statistics-'s Issues

TypeError: semantic_similarity() takes 1 positional argument but 3 were given

Hello professors,

I've tried to make use of the code for the sentence similarity, but receive the following error:

Traceback (most recent call last):
  File "sentence-similarity.py", line 236, in <module>
    print(similarity("hello world I like ice cream", "hello earth I don't like ice cream ", True))
  File "sentence-similarity.py", line 208, in similarity
    return DELTA * semantic_similarity(sentence_1, sentence_2, info_content_norm) +         (1.0 - DELTA) * word_order_similarity(sentence_1, sentence_2)
TypeError: semantic_similarity() takes 1 positional argument but 3 were given

The error I get is that semantic_similarity() only takes row as a parameter. But in the function similarity the 3 arguments are given as parameters to semantic_similarity().

I have therefore tried to change the parameters to the function, and replaced
def semantic_similarity(row):
with
def semantic_similarity(sentence_1, sentence_2, info_content_norm):
and removed the first 2 lines of the function:

def semantic_similarity(sentence_1, sentence_2, info_content_norm):
     # sentence_1  = re.sub('[^A-Za-z0-9\s]', '', row['question1']).lower()
     # sentence_2 = re.sub('[^A-Za-z0-9\s]', '', row['question2']).lower()

When I'm giving the following sentences as parameters to the function:

  • A quick brown dog jumps over the lazy fox.
  • A quick brown fox jumps over the lazy dog.

the resulting similarity is 1.0. As described in your paper this should not be the case, as the method is not supposed to treat the sentences as bag of words.

I'm not sure if I'm correct in changing the parameters to the function and/or if the first two lines should be commented out.

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.