Sha256: d3d522c64d67c5ee589df07e6769602e72013eec86b14360800c8c3f4859d045

Contents?: true

Size: 821 Bytes

Versions: 6

Compression:

Stored size: 821 Bytes

Contents

require "ruby-spacy"
require "terminal-table"

nlp = Spacy::Language.new("en_core_web_lg")
doc = nlp.read("dog cat banana afskfsd")

headings = ["text", "has_vector", "vector_norm", "is_oov"]
rows = []

doc.each do |token|
  rows << [token.text, token.has_vector, token.vector_norm, token.is_oov]
end

table = Terminal::Table.new rows: rows, headings: headings
puts table

# +---------+------------+-------------------+--------+
# | text    | has_vector | vector_norm       | is_oov |
# +---------+------------+-------------------+--------+
# | dog     | true       | 7.033673286437988 | false  |
# | cat     | true       | 6.680818557739258 | false  |
# | banana  | true       | 6.700014114379883 | false  |
# | afskfsd | false      | 0.0               | true   |
# +---------+------------+-------------------+--------+

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-spacy-0.1.4.1 examples/get_started/word_vectors.rb
ruby-spacy-0.1.4 examples/get_started/word_vectors.rb
ruby-spacy-0.1.3 examples/get_started/word_vectors.rb
ruby-spacy-0.1.2 examples/get_started/word_vectors.rb
ruby-spacy-0.1.1 examples/get_started/word_vectors.rb
ruby-spacy-0.1.0 examples/get_started/word_vectors.rb