Sha256: 968007e1728d53395dbacdb039d78ebe5bf59db2900b629df8945a9bbcb5ac85

Contents?: true

Size: 474 Bytes

Versions: 2

Compression:

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

sentence = "I live in New York"
doc = nlp.read(sentence)

puts "Before: #{doc.tokens.map(&:text).join(", ")}"

doc.retokenize(3, 4)

puts "After: #{doc.tokens.map(&:text).join(", ")}"

# Before: I, live, in, New, York
# After: I, live, in, New York

Version data entries

2 entries across 2 versions & 1 rubygems

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