From 743dd5977d45e8205f8078293bbc36cd36214722 Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Tue, 23 Nov 2021 02:43:47 +1100 Subject: [PATCH] remove field of application and second line from IEV retrieved entry: https://github.com/glossarist/iev-document/issues/4 --- lib/iev.rb | 9 +- lib/iev/version.rb | 2 +- spec/examples/103_08_14.html | 324 +++++++++++++++++++++++++++++++++++ spec/iev_spec.rb | 7 + 4 files changed, 338 insertions(+), 4 deletions(-) create mode 100644 spec/examples/103_08_14.html diff --git a/lib/iev.rb b/lib/iev.rb index 92afd27..44c8521 100644 --- a/lib/iev.rb +++ b/lib/iev.rb @@ -16,10 +16,13 @@ module Iev # def self.get(code, lang) url = "http://www.electropedia.org/iev/iev.nsf/"\ - "display?openform&ievref=#{code}" + "display?openform&ievref=#{code}" doc = Nokogiri::HTML OpenURI.open_uri(url), nil, "UTF-8" xpath = "//table/tr/td/div/font[.=\"#{lang}\"]/../../"\ - "following-sibling::td[2]" - doc.at(xpath)&.text&.strip + "following-sibling::td[2]" + a = doc&.at(xpath)&.children&.to_xml + a&.sub(%r{
.*$}, "") + &.sub(%r{, <.*$}, "") + &.gsub(%r{<[^>]*>}, "")&.strip end end diff --git a/lib/iev/version.rb b/lib/iev/version.rb index cae4f9a..ad516ca 100644 --- a/lib/iev/version.rb +++ b/lib/iev/version.rb @@ -1,3 +1,3 @@ module Iev - VERSION = "0.2.6".freeze + VERSION = "0.3.0".freeze end diff --git a/spec/examples/103_08_14.html b/spec/examples/103_08_14.html new file mode 100644 index 0000000..c63189c --- /dev/null +++ b/spec/examples/103_08_14.html @@ -0,0 +1,324 @@ + + + +IEC 60050 - International Electrotechnical Vocabulary - Details for IEV number 103-08-14: "<i>p</i>-fractile" + + + + + + + + + + + + + + + + + + +
+
+ +
+ + +

+

+

+

+

+
+
+ + +
Queries, comments, suggestions? Please contact us.
+
+ + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AreaMathematics - Functions / Probability

IEV ref103-08-14

en
p-fractile, <of a probability distribution>
p-quantile, <of a probability distribution>
for a number p between 0 and 1, value of a random variable for which the distribution function equals p or jumps from a value less than or equal to p to a value greater than p

fr
fractile d'ordre p, <d'une loi de probabilité> m
quantile d'ordre p, <d'une loi de probabilité> m
pour un nombre p compris entre 0 et 1, valeur d'une variable aléatoire pour laquelle la fonction de répartition prend une valeur p ou saute d'une valeur inférieure ou égale à p à une valeur supérieure à p

ar
(لتوزيع احتمالى) p- كمية
(لتوزيع احتمالى) p- كسرية

de
p-Quantil, <einer Wahrscheinlichkeitsverteilung> n
p-Fraktil, <einer Wahrscheinlichkeitsverteilung> n

es
fractil de orden p (de una ley de probabilidad)

it
p-frattile (di una distribuzione di probabilità)
quantile di ordine p (di una distribuzione di probabilità)

ko
p 분위수, <확률분포>

ja
p-分位点, <確率分布の>
p-分位点, <確率分布の>
p-フラクタイル, <確率分布の>
p-クォンタイル, <確率分布の>

pl
kwantyl rzędu p
fraktyl rzędu p

pt
fractil-p (de uma distribuição de probabilidade)
quantil-p (de uma distribuição de probabilidade)

sr
p-квантил, <расподеле вероватноће> м јд

sv
p-fraktil (av en sannolikhetsfördelning)

zh
p-分位数, <一个概率分布的>
+ +

+ + +
Publication date: 2009-12
Copyright © IEC 2021. All Rights Reserved.
+
+ + diff --git a/spec/iev_spec.rb b/spec/iev_spec.rb index 4b01dff..d0c048d 100644 --- a/spec/iev_spec.rb +++ b/spec/iev_spec.rb @@ -22,6 +22,13 @@ expect(File.exist?("testcache2")).to be_truthy end + # p-fractile, <of a probability distribution>
p-quantile, <of a probability distribution> + it "strips extraneous information from term" do + mock_open_uri("103-08-14") + term = @db.fetch "103-08-14", "en" + expect(term).to eq "p-fractile" + end + it "return empty string if code not found" do mock_open_uri("111-11-11") term = @db.fetch "111-11-11", "en"