Skip to content

niggels/text-similarity-test

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Similarity Test (using TensorFlow.js)

version

It outputs a percent similarity between two sentences.

This tool could possibly be used to check whether a free-form answer closely matches the expected answer in meaning. For best results, you probably should constrain responses to short sentences (i.e. short answer questions only).

Try it in your browser

https://codepen.io/hchiam/pen/oNjzQRa

Try it from your own computer

open index.html or yarn start or npm start

You can run useModelToEmbedAllSentences from CLI with node tfjs-stuff.js

Import it into your own project

<script src="https://cdn.jsdelivr.net/gh/hchiam/text-similarity-test@1.0.0/tfjs-stuff.js"></script>
var sentence1 = "Hello there!";
var sentence2 = "Hi, nice to see you!";
function callback(similarityScore) {
  alert(Math.round(similarityScore * 100 * 100) / 100 + "%");
}
useModel(sentence1, sentence2, callback); // useModel comes from tfjs-stuff.js

More things I'm testing

(See the coglangtext sub-folder.)

Useful references used

Related repos

https://github.com/hchiam/learning-tensorflow

https://github.com/hchiam/text-similarity-test-microservice

About

Text Similarity Test (using TensorFlow.js)

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 89.9%
  • HTML 9.4%
  • CSS 0.7%