Sha256: 0b08b330af702b0eaf155d6981aa28968b51a83f026317e4d3d8f3984c39a8bc

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 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")

orange = nlp.vocab("orange")
lemon = nlp.vocab("lemon")

book = nlp.vocab("book")
magazine = nlp.vocab("magazine")

puts "orange <=> lemon:   #{orange.similarity(lemon)}"
puts "book   <=> magazine: #{book.similarity(magazine)}"
puts "orange <=> book: #{orange.similarity(book)}"

# orange <=> lemon:   0.7080526351928711
# book   <=> magazine: 0.4355940818786621
# orange <=> book: 0.12197211384773254

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-spacy-0.2.3 examples/linguistic_features/similarity_between_lexemes.rb
ruby-spacy-0.2.2 examples/linguistic_features/similarity_between_lexemes.rb