Sha256: ba7329eb1c2ad051a2cb4b6086b594bafb13153152b483cc731ceee91289edb1

Contents?: true

Size: 888 Bytes

Versions: 4

Compression:

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

doc = nlp.read("Apple is looking at buying U.K. startup for $1 billion")

headings = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
row = []

doc.each do |token|
  row << token.text
end

table = Terminal::Table.new rows: [row], headings: headings
puts table

# +-------+----+---------+----+--------+------+---------+-----+---+----+---------+
# | 1     | 2  | 3       | 4  | 5      | 6    | 7       | 8   | 9 | 10 | 11      |
# +-------+----+---------+----+--------+------+---------+-----+---+----+---------+
# | Apple | is | looking | at | buying | U.K. | startup | for | $ | 1  | billion |
# +-------+----+---------+----+--------+------+---------+-----+---+----+---------+

Version data entries

4 entries across 2 versions & 1 rubygems

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