Project

ner-ruby

0.0
No release in over 3 years
There's a lot of open issues
NER using ONNX models via onnx-ruby and tokenizer-ruby. Extracts people, places, organizations, and other entities from text.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.0
~> 13.0
~> 3.0

Runtime

 Project Readme

ner-ruby

Named Entity Recognition for Ruby. Extract entities (people, places, organizations) from text using ONNX models or API backends.

Installation

gem "ner-ruby"

Usage

require "ner_ruby"

# ONNX backend
recognizer = NerRuby::Recognizer.new(
  model_path: "path/to/model.onnx",
  labels: [:PER, :LOC, :ORG, :MISC]
)

entities = recognizer.recognize("John works at Google in Mountain View")
entities.each do |e|
  puts "#{e.text} (#{e.label}) [#{e.start_offset}:#{e.end_offset}] score=#{e.score}"
end

# API backend
recognizer = NerRuby::Recognizer.new(
  backend: :api,
  provider: :openai,
  api_key: ENV["OPENAI_API_KEY"]
)

Features

  • ONNX Runtime inference with auto label map from config.json
  • API backend support (OpenAI, etc.)
  • IOB/BIO tag decoding with wordpiece token merging
  • Character span offsets (start_offset, end_offset)
  • Numerically stable softmax
  • Empty/nil text guards

License

MIT