Sha256: 36655ffa42137cbcbd761785f1c6b90be934356d0e369d1d7e8cf9d82a2a3a14

Contents?: true

Size: 516 Bytes

Versions: 2

Compression:

Stored size: 516 Bytes

Contents

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

nlp = Spacy::Language.new("en_core_web_sm")

lemmatizer = nlp.get_pipe("lemmatizer")
puts "Lemmatizer mode: " + lemmatizer.mode

doc = nlp.read("I was reading the paper.")

headings = ["lemma"]
rows = []

doc.each do |token|
  rows << [token.lemma]
end

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

# Lemmatizer mode: rule
# +-------+
# | lemma |
# +-------+
# | I     |
# | be    |
# | read  |
# | the   |
# | paper |
# | .     |
# +-------+

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-spacy-0.1.4.1 examples/linguistic_features/lemmatization.rb
ruby-spacy-0.1.4 examples/linguistic_features/lemmatization.rb