Sha256: 25bf9aa6ef56d751e494695bb393e0d8c64b0510ead01e47fc2fc2e80b20c374

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

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

doc = nlp.read("これは文です。今私は「これは文です」と言いました。")

puts "doc has annotation SENT_START: #{doc.has_annotation("SENT_START")}"

doc.sents.each do |sent|
  puts sent.text
end

# doc has annotation SENT_START: true
# これは文です。
# 今私は「これは文です」と言いました。

Version data entries

2 entries across 2 versions & 1 rubygems

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