![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Ruby gem to access functionality of GNfinder project written in Go. This gem allows to perform fast and accurate scientific name finding in texts, web-pages, as well as a large variety of documents. Document files can be accessed either locally or via a URL.
This gem uses REST API to access a running GNfinder server. You can find how
to run it in GNfinder README file. By default it uses
https://finder.globalnames.org/api/v1
gem install gnfinder
The purpose of this gem is to access GNfinder functionality from Ruby applications. If you need to find names using other languages, use the source code of this gem for reference. For other usages read the original Go-lang GNfinder README file.
First you need to create an instance of a gnfinder
client
require 'gnfinder'
gf = Gnfinder::Client.new
By default the client will try to connect to
https://finder.globalnames.org/api/v1
. If you have another location for the
server use:
require 'gnfinder'
# you can use global public gnfinder server
# located at finder-rpc.globalnames.org
gf = Gnfinder::Client.new(host = 'finder.example.org', port = 80)
# localhost, port 8000
gf = Gnfinder::Client.new(host = '0.0.0.0', port = 8000)
You can find format of returning result in GNfinder API docs
txt = File.read('utf8-text-with-names.txt')
res = gf.find_names(txt)
puts res.names[0].value
puts res.names[0].odds
If you need to find names in an HTML page, or a PDF document available on
Internet, use find_url
method.
url = 'https://en.wikipedia.org/wiki/Monochamus_galloprovincialis'
res = gf.find_url(url)
puts res.names[0].value
puts res.names[0].odds
Many different file types are supported (PDF, JPB, TIFF, MS Word, MS Excel etc).
path = "/path/to/file.pdf"
res = gf.find_file(path)
puts res.names[0].value
Support of file-uploading uses 'multipart/form' approach. Here is an
illustration for curl
:
curl -v -F sources[]=1 -F sources[]=12 -F file=@file.pdf \
https://finder.globalnames.org/api/v1/find
Returned result is quite detailed and contains many accessor methods, for example:
Some languages that are close to Latin (Italian, French, Portugese) would generate too many false positives. To decrease amount of false positives you can disable Bayes algorithm by running:
names = gf.find_names(txt, no_bayes: true).names
It is possible to supply the prevalent language to set a language for a text by hand. That might Bayes algorithms work better
List of supported languages will increase with time.
res = gf.find_names(txt, language: 'eng')
puts res.language
res = gf.find_names(txt, language: 'deu')
puts res.language
# Setting is ignored if language string is not known by gnfinder.
# Only 3-character notations iso-639-2 code are supported
res = gf.find_names(txt, language: 'rus')
puts res.language
To enable automatic detection of prevalent language of a text use:
res = gf.find_names(txt, detect_language: true) puts res.language puts res.detect_language puts res.language_detected
If detected language is not yet supported by Bayes algorithm, default language (English) will be used.
In case if found names need to be validated against a large collection of
name-strings, use with_verification
option. For each name algorithm will
return the following information:
NONE
: name-string is unknownEXACT
: name-string matched exactly.CANONICAL_EXACT
: canonical form of a name-string matched exactly.CANONICAL_FUZZY
: fuzzy match of a canonical string.PARTIAL_EXACT
: only part of a name matched. For examle only genus of a
species was found.PARTIAL_FUZZY
: fuzzy match of a partial result. For example canonical
form of a trinomial matched on a species level with some corrections.res = gf.find_names(txt, verification: true)
Sometimes it is important to know if a name was found in a particular data-source (data-sources). There is a parameter that takes IDs from the data-source list. If a name-string was found in these data-sources, match results will be returned back.
res = gf.find_names(txt, verification: true, sources: [1, 4, 179])
It is possible to combine parameters. However if a parameter makes no sense in a particular context it is silently ignored.
# Runs Bayes' algorithms using English training set, runs verification and
# returns matched results for 3 data-sources if they are available.
res = gf.find_names(txt, language: 'eng', verification: true,
sources: [1, 4, 179])
# Ignores `sources:` settings, because `with_verification` is not set to `true`
res = gf.find_names(txt, language: 'eng', sources: [1, 4, 179])
If you get an error, you might need to set a GOPATH
environment variable.
After starting the server with default host and port (localhost:8778) you will be able to run tests for this Ruby client with:
bundle exec rake
To run rubocop test
bundle exec rake rubocop
To run tests without rubocop
bundle exec rspec
FAQs
Unknown package
We found that gnfinder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.