Sha256: 0b775492481894aac7d4f253bd234462b929ac899e0d5bc0492d162cf7fa0d0f

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

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

nlp = Spacy::Language.new("ja_core_news_lg")
ja_doc1 = nlp.read("今日は雨ばっかり降って、嫌な天気ですね。")
puts "doc1: #{ja_doc1.text}"
ja_doc2 = nlp.read("あいにくの悪天候で残念です。")
puts "doc2: #{ja_doc2.text}"
puts "Similarity: #{ja_doc1.similarity(ja_doc2)}"

# doc1: 今日は雨ばっかり降って、嫌な天気ですね。
# doc2: あいにくの悪天候で残念です。
# Similarity: 0.8684192637149641

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-spacy-0.2.3 examples/japanese/similarity.rb
ruby-spacy-0.2.2 examples/japanese/similarity.rb