Sha256: 30a56d64516c3856dd580dbd0961340215062faeb957d14e2cc3987b11f25cf4
Contents?: true
Size: 539 Bytes
Versions: 2
Compression:
Stored size: 539 Bytes
Contents
# frozen_string_literal: true # add path to ruby-spacy lib to load path $LOAD_PATH.unshift(File.expand_path("../../lib", __dir__)) require "ruby-spacy" require "terminal-table" nlp = Spacy::Language.new("en_core_web_lg") doc1 = nlp.read("I like salty fries and hamburgers.") doc2 = nlp.read("Fast food tastes very good.") puts "Doc 1: #{doc1.text}" puts "Doc 2: #{doc2.text}" puts "Similarity: #{doc1.similarity(doc2)}" # Doc 1: I like salty fries and hamburgers. # Doc 2: Fast food tastes very good. # Similarity: 0.7687607012190486
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-spacy-0.2.3 | examples/linguistic_features/similarity.rb |
ruby-spacy-0.2.2 | examples/linguistic_features/similarity.rb |