semantic similarity between sentences

前端 未结 3 1891
梦如初夏
梦如初夏 2020-12-02 23:59

I\'m doing a project. I need any opensource tool or technique to find the semantic similarity of two sentences, where I give two sentences as an input, and receive score (i.

3条回答
  •  -上瘾入骨i
    2020-12-03 00:56

    I have developed a simple open-source tool that does the semantic comparison according to categories: https://sourceforge.net/projects/semantics/files/

    It works with sentences of any length, is simple, stable, fast, small in size... Here is a sample output:
    Similarity between the sentences
    -Pete and Rob have found a dog near the station.
    -Pete and Rob have never found a dog near the station.
    is: 1.0000000000


    Similarity between the sentences
    -Patricia found a dog near the station.
    -It was a dog who found Pete and Rob under the snow.
    is: 0.7363210405107239


    Similarity between the sentences
    -Patricia found a dog near the station.
    -I am fine, thanks!
    is: 0.0


    Similarity between the sentences
    -Hello there, how are you?
    -I am fine, thanks!
    is: 0.29160592175990213



    USAGE:

    import semantics.Compare;
    public class USAGE {
    
    public static void main(String[] args) {
    
        String a = "This is a first sentence.";
        String b = "This is a second one.";
    
        Compare c = new Compare(a,b);
        System.out.println("Similarity between the sentences\n-"+a+"\n-"+b+"\n is: " + c.getResult());
    
        }
    
    }
    

提交回复
热议问题